List of usage examples for android.view.animation AlphaAnimation AlphaAnimation
public AlphaAnimation(float fromAlpha, float toAlpha)
From source file:com.crearo.gpslogger.ui.fragments.display.GpsSimpleViewFragment.java
public void setSatelliteCount(int count) { ImageView imgSatelliteCount = (ImageView) rootView.findViewById(R.id.simpleview_imgSatelliteCount); TextView txtSatelliteCount = (TextView) rootView.findViewById(R.id.simpleview_txtSatelliteCount); if (count > -1) { setColor(imgSatelliteCount, IconColorIndicator.Good); AlphaAnimation fadeIn = new AlphaAnimation(0.6f, 1.0f); fadeIn.setDuration(1200);//from w ww . j av a 2 s . c om fadeIn.setFillAfter(true); txtSatelliteCount.startAnimation(fadeIn); txtSatelliteCount.setText(String.valueOf(count)); } else { clearColor(imgSatelliteCount); txtSatelliteCount.setText(""); } }
From source file:com.leavjenn.smoothdaterangepicker.date.SmoothDateRangePickerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Log.d(TAG, "onCreateView: "); getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); View view = inflater.inflate(R.layout.sdrp_dialog, container); mDayOfWeekView = (TextView) view.findViewById(R.id.date_picker_header); mDayOfWeekViewEnd = (TextView) view.findViewById(R.id.date_picker_header_end); mMonthAndDayView = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day); mMonthAndDayViewEnd = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day_end); mMonthAndDayView.setOnClickListener(this); mMonthAndDayViewEnd.setOnClickListener(this); mSelectedMonthTextView = (TextView) view.findViewById(R.id.date_picker_month); mSelectedMonthTextViewEnd = (TextView) view.findViewById(R.id.date_picker_month_end); mSelectedDayTextView = (TextView) view.findViewById(R.id.date_picker_day); mSelectedDayTextViewEnd = (TextView) view.findViewById(R.id.date_picker_day_end); mYearView = (TextView) view.findViewById(R.id.date_picker_year); mYearViewEnd = (TextView) view.findViewById(R.id.date_picker_year_end); mYearView.setOnClickListener(this); mYearViewEnd.setOnClickListener(this); mDurationView = (LinearLayout) view.findViewById(R.id.date_picker_duration_layout); mDurationView.setOnClickListener(this); mDurationTextView = (TextView) view.findViewById(R.id.date_picker_duration_days); mDurationEditText = (EditText) view.findViewById(R.id.date_picker_duration_days_et); // disable soft keyboard popup when edittext is selected mDurationEditText.setRawInputType(InputType.TYPE_CLASS_TEXT); mDurationEditText.setTextIsSelectable(true); mDurationDayTextView = (TextView) view.findViewById(R.id.tv_duration_day); mDurationArrow = (TextView) view.findViewById(R.id.arrow_start); mDurationArrow.setOnClickListener(this); mDurationArrowEnd = (TextView) view.findViewById(R.id.arrow_end); mDurationArrowEnd.setOnClickListener(this); viewList = new ArrayList<>(); viewList.add(MONTH_AND_DAY_VIEW, mMonthAndDayView); viewList.add(YEAR_VIEW, mYearView);/* w w w.j a va2 s .c om*/ viewList.add(MONTH_AND_DAY_VIEW_END, mMonthAndDayViewEnd); viewList.add(YEAR_VIEW_END, mYearViewEnd); viewList.add(DURATION_VIEW, mDurationView); int listPosition = -1; int listPositionOffset = 0; int listPositionEnd = -1; int listPositionOffsetEnd = 0; int currentView = MONTH_AND_DAY_VIEW; if (savedInstanceState != null) { mWeekStart = savedInstanceState.getInt(KEY_WEEK_START); mMinYear = savedInstanceState.getInt(KEY_YEAR_START); mMaxYear = savedInstanceState.getInt(KEY_YEAR_END); currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW); listPosition = savedInstanceState.getInt(KEY_LIST_POSITION); listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET); listPositionEnd = savedInstanceState.getInt(KEY_LIST_POSITION_END); listPositionOffsetEnd = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET_END); mMinDate = (Calendar) savedInstanceState.getSerializable(KEY_MIN_DATE); mMaxDate = (Calendar) savedInstanceState.getSerializable(KEY_MAX_DATE); mMinSelectableDate = (Calendar) savedInstanceState.getSerializable(KEY_MIN_DATE_SELECTABLE); highlightedDays = (Calendar[]) savedInstanceState.getSerializable(KEY_HIGHLIGHTED_DAYS); selectableDays = (Calendar[]) savedInstanceState.getSerializable(KEY_SELECTABLE_DAYS); mThemeDark = savedInstanceState.getBoolean(KEY_THEME_DARK); mAccentColor = savedInstanceState.getInt(KEY_ACCENT); mVibrate = savedInstanceState.getBoolean(KEY_VIBRATE); mDismissOnPause = savedInstanceState.getBoolean(KEY_DISMISS); } final Activity activity = getActivity(); mDayPickerView = new SimpleDayPickerView(activity, this); mYearPickerView = new YearPickerView(activity, this); mDayPickerViewEnd = new SimpleDayPickerView(activity, this); mYearPickerViewEnd = new YearPickerView(activity, this); mNumberPadView = new NumberPadView(activity, this); Resources res = getResources(); mDayPickerDescription = res.getString(R.string.mdtp_day_picker_description); mSelectDay = res.getString(R.string.mdtp_select_day); mYearPickerDescription = res.getString(R.string.mdtp_year_picker_description); mSelectYear = res.getString(R.string.mdtp_select_year); int bgColorResource = mThemeDark ? R.color.mdtp_date_picker_view_animator_dark_theme : R.color.mdtp_date_picker_view_animator; view.setBackgroundColor(activity.getResources().getColor(bgColorResource)); if (mThemeDark) { view.findViewById(R.id.hyphen).setBackgroundColor( activity.getResources().getColor(R.color.date_picker_selector_unselected_dark_theme)); Utils.setMultiTextColorList(activity.getResources().getColorStateList(R.color.sdrp_selector_dark), mDayOfWeekView, mDayOfWeekViewEnd, mSelectedMonthTextView, mSelectedMonthTextViewEnd, mSelectedDayTextView, mSelectedDayTextViewEnd, mYearView, mYearViewEnd, mDurationTextView, mDurationDayTextView, mDurationArrow, mDurationArrowEnd, mDurationEditText, (TextView) view.findViewById(R.id.tv_duration)); } mAnimator = (AccessibleDateAnimator) view.findViewById(R.id.animator); mAnimator.addView(mDayPickerView); mAnimator.addView(mYearPickerView); mAnimator.addView(mDayPickerViewEnd); mAnimator.addView(mYearPickerViewEnd); mAnimator.addView(mNumberPadView); mAnimator.setDateMillis(mCalendar.getTimeInMillis()); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(ANIMATION_DURATION); mAnimator.setInAnimation(animation); Animation animation2 = new AlphaAnimation(1.0f, 0.0f); animation2.setDuration(ANIMATION_DURATION); mAnimator.setOutAnimation(animation2); Button okButton = (Button) view.findViewById(R.id.ok); okButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tryVibrate(); if (mCallBack != null) { mCallBack.onDateRangeSet(SmoothDateRangePickerFragment.this, mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH), mCalendarEnd.get(Calendar.YEAR), mCalendarEnd.get(Calendar.MONTH), mCalendarEnd.get(Calendar.DAY_OF_MONTH)); } dismiss(); } }); okButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium")); Button cancelButton = (Button) view.findViewById(R.id.cancel); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tryVibrate(); if (getDialog() != null) getDialog().cancel(); } }); cancelButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium")); cancelButton.setVisibility(isCancelable() ? View.VISIBLE : View.GONE); //If an accent color has not been set manually, try and get it from the context if (mAccentColor == -1) { int accentColor = Utils.getAccentColorFromThemeIfAvailable(getActivity()); if (accentColor != -1) { mAccentColor = accentColor; } } if (mAccentColor != -1) { if (mDayOfWeekView != null) mDayOfWeekView.setBackgroundColor(mAccentColor); if (mDayOfWeekViewEnd != null) mDayOfWeekViewEnd.setBackgroundColor(mAccentColor); view.findViewById(R.id.layout_container).setBackgroundColor(mAccentColor); view.findViewById(R.id.day_picker_selected_date_layout).setBackgroundColor(mAccentColor); view.findViewById(R.id.day_picker_selected_date_layout_end).setBackgroundColor(mAccentColor); mDurationView.setBackgroundColor(mAccentColor); mDurationEditText.setHighlightColor(Utils.darkenColor(mAccentColor)); mDurationEditText.getBackground().setColorFilter(Utils.darkenColor(mAccentColor), PorterDuff.Mode.SRC_ATOP); okButton.setTextColor(mAccentColor); cancelButton.setTextColor(mAccentColor); mYearPickerView.setAccentColor(mAccentColor); mDayPickerView.setAccentColor(mAccentColor); mYearPickerViewEnd.setAccentColor(mAccentColor); mDayPickerViewEnd.setAccentColor(mAccentColor); } updateDisplay(false); setCurrentView(currentView); if (listPosition != -1) { if (currentView == MONTH_AND_DAY_VIEW) { mDayPickerView.postSetSelection(listPosition); } else if (currentView == YEAR_VIEW) { mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset); } } if (listPositionEnd != -1) { if (currentView == MONTH_AND_DAY_VIEW_END) { mDayPickerViewEnd.postSetSelection(listPositionEnd); } else if (currentView == YEAR_VIEW_END) { mYearPickerViewEnd.postSetSelectionFromTop(listPositionEnd, listPositionOffsetEnd); } } mHapticFeedbackController = new HapticFeedbackController(activity); return view; }
From source file:com.borax12.materialdaterangepicker.date.DatePickerDialog.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); View view = inflater.inflate(R.layout.range_date_picker_dialog, container, false); tabHost = (TabHost) view.findViewById(R.id.tabHost); tabHost.findViewById(R.id.tabHost);/* w w w. j av a 2s . com*/ tabHost.setup(); final Activity activity = getActivity(); TabHost.TabSpec startDatePage = tabHost.newTabSpec("start"); startDatePage.setContent(R.id.start_date_group); startDatePage.setIndicator((startTitle != null && !startTitle.isEmpty()) ? startTitle : activity.getResources().getString(R.string.mdtrp_from)); TabHost.TabSpec endDatePage = tabHost.newTabSpec("end"); endDatePage.setContent(R.id.end_date_group); endDatePage.setIndicator((endTitle != null && !endTitle.isEmpty()) ? endTitle : activity.getResources().getString(R.string.mdtrp_to)); tabHost.addTab(startDatePage); tabHost.addTab(endDatePage); mDayOfWeekView = (TextView) view.findViewById(R.id.date_picker_header); mMonthAndDayView = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day); mMonthAndDayViewEnd = (LinearLayout) view.findViewById(R.id.date_picker_month_and_day_end); mMonthAndDayView.setOnClickListener(this); mMonthAndDayViewEnd.setOnClickListener(this); mSelectedMonthTextView = (TextView) view.findViewById(R.id.date_picker_month); mSelectedMonthTextViewEnd = (TextView) view.findViewById(R.id.date_picker_month_end); mSelectedDayTextView = (TextView) view.findViewById(R.id.date_picker_day); mSelectedDayTextViewEnd = (TextView) view.findViewById(R.id.date_picker_day_end); mYearView = (TextView) view.findViewById(R.id.date_picker_year); mYearViewEnd = (TextView) view.findViewById(R.id.date_picker_year_end); mYearView.setOnClickListener(this); mYearViewEnd.setOnClickListener(this); int listPosition = -1; int listPositionOffset = 0; int listPositionEnd = -1; int listPositionOffsetEnd = 0; int currentView = MONTH_AND_DAY_VIEW; int currentViewEnd = MONTH_AND_DAY_VIEW; if (savedInstanceState != null) { mWeekStart = savedInstanceState.getInt(KEY_WEEK_START); mWeekStartEnd = savedInstanceState.getInt(KEY_WEEK_START_END); mMinYear = savedInstanceState.getInt(KEY_YEAR_START); mMaxYear = savedInstanceState.getInt(KEY_MAX_YEAR); currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW); currentViewEnd = savedInstanceState.getInt(KEY_CURRENT_VIEW_END); listPosition = savedInstanceState.getInt(KEY_LIST_POSITION); listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET); listPositionEnd = savedInstanceState.getInt(KEY_LIST_POSITION_END); listPositionOffsetEnd = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET_END); mMinDate = (Calendar) savedInstanceState.getSerializable(KEY_MIN_DATE); mMaxDate = (Calendar) savedInstanceState.getSerializable(KEY_MAX_DATE); mMinDateEnd = (Calendar) savedInstanceState.getSerializable(KEY_MIN_DATE_END); mMaxDateEnd = (Calendar) savedInstanceState.getSerializable(KEY_MAX_DATE_END); highlightedDays = (Calendar[]) savedInstanceState.getSerializable(KEY_HIGHLIGHTED_DAYS); selectableDays = (Calendar[]) savedInstanceState.getSerializable(KEY_SELECTABLE_DAYS); highlightedDaysEnd = (Calendar[]) savedInstanceState.getSerializable(KEY_HIGHLIGHTED_DAYS_END); selectableDaysEnd = (Calendar[]) savedInstanceState.getSerializable(KEY_SELECTABLE_DAYS_END); mThemeDark = savedInstanceState.getBoolean(KEY_THEME_DARK); mAccentColor = savedInstanceState.getInt(KEY_ACCENT); mVibrate = savedInstanceState.getBoolean(KEY_VIBRATE); mDismissOnPause = savedInstanceState.getBoolean(KEY_DISMISS); } mDayPickerView = new com.borax12.materialdaterangepicker.date.SimpleDayPickerView(activity, this); mYearPickerView = new com.borax12.materialdaterangepicker.date.YearPickerView(activity, this); mDayPickerViewEnd = new com.borax12.materialdaterangepicker.date.SimpleDayPickerView(activity, this); mYearPickerViewEnd = new com.borax12.materialdaterangepicker.date.YearPickerView(activity, this); Resources res = getResources(); mDayPickerDescription = res.getString(R.string.mdtrp_day_picker_description); mSelectDay = res.getString(R.string.mdtrp_select_day); mYearPickerDescription = res.getString(R.string.mdtrp_year_picker_description); mSelectYear = res.getString(R.string.mdtrp_select_year); int bgColorResource = mThemeDark ? R.color.mdtrp_date_picker_view_animator_dark_theme : R.color.mdtrp_date_picker_view_animator; view.setBackgroundColor(ContextCompat.getColor(activity, bgColorResource)); mAnimator = (com.borax12.materialdaterangepicker.date.AccessibleDateAnimator) view .findViewById(R.id.animator); mAnimatorEnd = (com.borax12.materialdaterangepicker.date.AccessibleDateAnimator) view .findViewById(R.id.animator_end); mAnimator.addView(mDayPickerView); mAnimator.addView(mYearPickerView); mAnimator.setDateMillis(mCalendar.getTimeInMillis()); // TODO: Replace with animation decided upon by the design team. Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(ANIMATION_DURATION); mAnimator.setInAnimation(animation); // TODO: Replace with animation decided upon by the design team. Animation animation2 = new AlphaAnimation(1.0f, 0.0f); animation2.setDuration(ANIMATION_DURATION); mAnimator.setOutAnimation(animation2); mAnimatorEnd.addView(mDayPickerViewEnd); mAnimatorEnd.addView(mYearPickerViewEnd); mAnimatorEnd.setDateMillis(mCalendarEnd.getTimeInMillis()); // TODO: Replace with animation decided upon by the design team. Animation animationEnd = new AlphaAnimation(0.0f, 1.0f); animationEnd.setDuration(ANIMATION_DURATION); mAnimatorEnd.setInAnimation(animation); // TODO: Replace with animation decided upon by the design team. Animation animation2End = new AlphaAnimation(1.0f, 0.0f); animation2End.setDuration(ANIMATION_DURATION); mAnimatorEnd.setOutAnimation(animation2); Button okButton = (Button) view.findViewById(R.id.ok); okButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tryVibrate(); if (mCallBack != null) { mCallBack.onDateSet(DatePickerDialog.this, mCalendar.get(Calendar.YEAR), mCalendar.get(Calendar.MONTH), mCalendar.get(Calendar.DAY_OF_MONTH), mCalendarEnd.get(Calendar.YEAR), mCalendarEnd.get(Calendar.MONTH), mCalendarEnd.get(Calendar.DAY_OF_MONTH)); } dismiss(); } }); okButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium")); Button cancelButton = (Button) view.findViewById(R.id.cancel); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tryVibrate(); if (getDialog() != null) getDialog().cancel(); } }); cancelButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium")); cancelButton.setVisibility(isCancelable() ? View.VISIBLE : View.GONE); //If an accent color has not been set manually, try and get it from the context if (mAccentColor == -1) { int accentColor = Utils.getAccentColorFromThemeIfAvailable(getActivity()); if (accentColor != -1) { mAccentColor = accentColor; } } if (mAccentColor != -1) { if (mDayOfWeekView != null) mDayOfWeekView.setBackgroundColor(Utils.darkenColor(mAccentColor)); view.findViewById(R.id.day_picker_selected_date_layout).setBackgroundColor(mAccentColor); view.findViewById(R.id.day_picker_selected_date_layout_end).setBackgroundColor(mAccentColor); okButton.setTextColor(mAccentColor); cancelButton.setTextColor(mAccentColor); mYearPickerView.setAccentColor(mAccentColor); mDayPickerView.setAccentColor(mAccentColor); mYearPickerViewEnd.setAccentColor(mAccentColor); mDayPickerViewEnd.setAccentColor(mAccentColor); } updateDisplay(false); setCurrentView(currentView); if (listPosition != -1) { if (currentView == MONTH_AND_DAY_VIEW) { mDayPickerView.postSetSelection(listPosition); } else if (currentView == YEAR_VIEW) { mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset); } } if (listPositionEnd != -1) { if (currentViewEnd == MONTH_AND_DAY_VIEW) { mDayPickerViewEnd.postSetSelection(listPositionEnd); } else if (currentViewEnd == YEAR_VIEW) { mYearPickerViewEnd.postSetSelectionFromTop(listPositionEnd, listPositionOffsetEnd); } } mHapticFeedbackController = new HapticFeedbackController(activity); tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() { @Override public void onTabChanged(String tabId) { com.borax12.materialdaterangepicker.date.MonthAdapter.CalendarDay calendarDay; if (tabId.equals("start")) { calendarDay = new com.borax12.materialdaterangepicker.date.MonthAdapter.CalendarDay( mCalendar.getTimeInMillis()); mDayPickerView.goTo(calendarDay, true, true, false); } else { calendarDay = new com.borax12.materialdaterangepicker.date.MonthAdapter.CalendarDay( mCalendarEnd.getTimeInMillis()); mDayPickerViewEnd.goTo(calendarDay, true, true, false); } } }); return view; }
From source file:com.aero2.android.DefaultActivities.SmogMapActivity.java
public void fadeSplashScreen() { // Set Runnable to remove splash screen just in case final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override//from ww w .j a v a 2s . co m public void run() { removeSplashScreen(); } }, 1000); if (!permissionJustGranted) { RelativeLayout layout = (RelativeLayout) findViewById(R.id.map_layout); AlphaAnimation animation = new AlphaAnimation(-2f, 1.0f); animation.setFillAfter(true); animation.setDuration(1500); //apply the animation ( fade In ) to your LAyout layout.startAnimation(animation); } }
From source file:se.toxbee.sleepfighter.activity.EditGPSFilterAreaActivity.java
/** * Sets up the help splash.//from w w w. ja va 2 s. c o m */ private void setupSplash() { this.splashInfoContainer = (LinearLayout) this.findViewById(R.id.edit_gpsfilter_area_splash); TextView textView = (TextView) this.splashInfoContainer.findViewById(R.id.edit_gpsfilter_area_splash_text); textView.setText(Html.fromHtml(this.getString(R.string.edit_gpsfilter_area_splash_text))); textView.setMovementMethod(new ScrollingMovementMethod()); // Define fade out animation. this.splashFadeOut = new AlphaAnimation(1.00f, 0.00f); this.splashFadeOut.setDuration(SPLASH_FADE_DELAY); this.splashFadeOut.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation animation) { } public void onAnimationRepeat(Animation animation) { } public void onAnimationEnd(Animation animation) { splashInfoContainer.setVisibility(View.GONE); } }); // Don't show if not new and we got polygon. if (!this.isConsideredFresh()) { this.splashInfoContainer.setVisibility(View.GONE); } }
From source file:com.breadwallet.tools.animation.BRAnimator.java
public static void hideCopyBubble(final Activity context) { try {/* w w w.j a va 2 s . c o m*/ if (context == null) return; if (copy == null) return; final RelativeLayout root = (RelativeLayout) context.findViewById(R.id.main_layout); if (copy.getVisibility() == View.VISIBLE) { Animation animation = new AlphaAnimation(1f, 0f); animation.setDuration(150); animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { root.removeView(copy); } @Override public void onAnimationRepeat(Animation animation) { } }); copy.startAnimation(animation); } } catch (Exception e) { e.printStackTrace(); } }
From source file:de.dmxcontrol.activity.ControlActivity.java
private Dialog createSplashDialog() { Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar); dialog.setContentView(R.layout.dialog_splash); ImageView image = (ImageView) dialog.findViewById(R.id.image_splash); image.setImageResource(R.drawable.image_splash); AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(500);//from www . j av a2 s. com animation.setInterpolator( AnimationUtils.loadInterpolator(this, android.R.anim.accelerate_decelerate_interpolator)); set.addAnimation(animation); animation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); animation.setDuration(1000); animation.setInterpolator( AnimationUtils.loadInterpolator(this, android.R.anim.accelerate_decelerate_interpolator)); set.addAnimation(animation); image.setAnimation(set); dismissSplashDelayed(); return dialog; }
From source file:com.xander.panel.PanelController.java
private Animation createBgAnimation(int animType) { AlphaAnimation an = null;/*from w ww . j a va2 s . c o m*/ if (ANIM_TYPE_SHOW == animType) { an = new AlphaAnimation(0, 1); } else { an = new AlphaAnimation(1, 0); } an.setDuration(DURATION_ALPHA); an.setFillAfter(true); return an; }
From source file:com.PPRZonDroid.MainActivity.java
/** * Refresh block lisst on right// w w w . j ava 2s .c o m */ private void refresh_block_list() { int i; BlList.clear(); for (i = 0; i < AC_DATA.AircraftData[AC_DATA.SelAcInd].BlockCount; i++) { BlList.add(new BlockModel(AC_DATA.AircraftData[AC_DATA.SelAcInd].AC_Blocks[i].BlName)); } mBlListAdapter.BlColor = AC_DATA.muiGraphics.get_color(AC_DATA.AircraftData[AC_DATA.SelAcInd].AC_Color); mBlListAdapter.SelectedInd = AC_DATA.AircraftData[AC_DATA.SelAcInd].SelectedBlock; AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, +1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f); animation.setDuration(250); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f); BlListView.setLayoutAnimation(controller); mBlListAdapter.notifyDataSetChanged(); }
From source file:org.zywx.wbpalmstar.plugin.ueximage.ImagePreviewView.java
private void initAnimation() { final int duration = 300; LinearInterpolator interpolator = new LinearInterpolator(); fadeInAnim = new AlphaAnimation(0, 1); fadeInAnim.setDuration(duration);/*w ww.j ava2s.c o m*/ fadeInAnim.setInterpolator(interpolator); fadeOutAnim = new AlphaAnimation(1, 0); fadeOutAnim.setDuration(duration); fadeOutAnim.setInterpolator(interpolator); }