List of usage examples for android.animation ObjectAnimator start
@Override public void start()
From source file:com.android.launcher3.folder.Folder.java
public void animateClosed() { if (!(getParent() instanceof DragLayer)) return;// w ww .j av a 2 s. c o m final ObjectAnimator oa = LauncherAnimUtils.ofViewAlphaAndScale(this, 0, 0.9f, 0.9f); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { setLayerType(LAYER_TYPE_NONE, null); close(true); } @Override public void onAnimationStart(Animator animation) { Utilities.sendCustomAccessibilityEvent(Folder.this, AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, getContext().getString(R.string.folder_closed)); mState = STATE_ANIMATING; } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); }
From source file:cc.flydev.launcher.Folder.java
public void animateOpen() { positionAndSizeAsIcon();/* w w w . j av a 2 s . c o m*/ if (!(getParent() instanceof DragLayer)) return; centerAboutIcon(); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); Cling cling = mLauncher.showFirstRunFoldersCling(); if (cling != null) { cling.bringScrimToFront(); bringToFront(); cling.bringToFront(); } setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); }
From source file:com.example.launcher3.Folder.java
public void animateOpen() { positionAndSizeAsIcon();//from ww w . j a va2 s . c o m if (!(getParent() instanceof DragLayer)) return; centerAboutIcon(); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); /* * Cling cling = mLauncher.showFirstRunFoldersCling(); if (cling * != null) { cling.bringScrimToFront(); bringToFront(); * cling.bringToFront(); } */ setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); }
From source file:nu.yona.timepicker.time.TimePickerDialog.java
private void setCurrentItemShowing(int index, boolean animateCircle, boolean delayLabelAnimate, boolean announce) { TextView labelToAnimate;// w w w . j a v a2s . c o m if (tabHost.getCurrentTab() == 0) { mTimePicker.setCurrentItemShowing(index, animateCircle); switch (index) { case HOUR_INDEX: int hours = mTimePicker.getHours(); if (!mIs24HourMode) { hours = hours % 12; } mTimePicker.setContentDescription(mHourPickerDescription + ": " + hours); if (announce) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectHours); } labelToAnimate = mHourView; break; case MINUTE_INDEX: int minutes = mTimePicker.getMinutes(); mTimePicker.setContentDescription(mMinutePickerDescription + ": " + minutes); if (announce) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectMinutes); } labelToAnimate = mMinuteView; break; default: int seconds = mTimePicker.getSeconds(); mTimePicker.setContentDescription(mSecondPickerDescription + ": " + seconds); if (announce) { Utils.tryAccessibilityAnnounce(mTimePicker, mSelectSeconds); } labelToAnimate = mSecondView; } int hourColor = (index == HOUR_INDEX) ? mSelectedColor : mUnselectedColor; int minuteColor = (index == MINUTE_INDEX) ? mSelectedColor : mUnselectedColor; int secondColor = (index == SECOND_INDEX) ? mSelectedColor : mUnselectedColor; mHourView.setTextColor(hourColor); mMinuteView.setTextColor(minuteColor); mSecondView.setTextColor(secondColor); ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f); if (delayLabelAnimate) { pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY); } pulseAnimator.start(); } else { mTimePickerEnd.setCurrentItemShowing(index, animateCircle); switch (index) { case HOUR_INDEX: int hours = mTimePickerEnd.getHours(); if (!mIs24HourMode) { hours = hours % 12; } mTimePickerEnd.setContentDescription(mHourPickerDescription + ": " + hours); if (announce) { Utils.tryAccessibilityAnnounce(mTimePickerEnd, mSelectHours); } labelToAnimate = mHourViewEnd; break; case MINUTE_INDEX: int minutes = mTimePickerEnd.getMinutes(); mTimePickerEnd.setContentDescription(mMinutePickerDescription + ": " + minutes); if (announce) { Utils.tryAccessibilityAnnounce(mTimePickerEnd, mSelectMinutes); } labelToAnimate = mMinuteViewEnd; break; default: int seconds = mTimePickerEnd.getSeconds(); mTimePickerEnd.setContentDescription(mSecondPickerDescription + ": " + seconds); if (announce) { Utils.tryAccessibilityAnnounce(mTimePickerEnd, mSelectSeconds); } labelToAnimate = mSecondView; } int hourColor = (index == HOUR_INDEX) ? mSelectedColor : mUnselectedColor; int minuteColor = (index == MINUTE_INDEX) ? mSelectedColor : mUnselectedColor; int secondColor = (index == SECOND_INDEX) ? mSelectedColor : mUnselectedColor; mHourViewEnd.setTextColor(hourColor); mMinuteViewEnd.setTextColor(minuteColor); mSecondView.setTextColor(secondColor); ObjectAnimator pulseAnimator = Utils.getPulseAnimator(labelToAnimate, 0.85f, 1.1f); if (delayLabelAnimate) { pulseAnimator.setStartDelay(PULSE_ANIMATOR_DELAY); } pulseAnimator.start(); } }
From source file:com.box.myview.MyTopSnackBar.TSnackbar.java
/** * @param drawable//w ww . ja va2 s .c om * @param left * @param right * @return */ public TSnackbar addIconProgressLoading(Drawable drawable, boolean left, boolean right) { final ObjectAnimator animator = ObjectAnimator.ofInt(drawable, "level", 0, 10000); animator.setDuration(1000); animator.setInterpolator(new LinearInterpolator()); animator.setRepeatCount(ValueAnimator.INFINITE); animator.setRepeatMode(ValueAnimator.INFINITE); mView.setBackgroundColor(mContext.getResources().getColor(Prompt.SUCCESS.getBackgroundColor())); if (left) { mView.getMessageView().setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); } if (right) { mView.getMessageView().setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null); } animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { if (mCallback != null) { mCallback.onShown(TSnackbar.this); } SnackbarManager.getInstance().onShown(mManagerCallback); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.start(); return this; }
From source file:com.bookkos.bircle.CaptureActivity.java
private void animateTranslationX(View target) { // translationX0f?200f????? ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "translationX", 0f, 200f); // 1???// ww w . j a v a 2 s . com objectAnimator.setDuration(1000); // ??? objectAnimator.start(); }
From source file:com.bookkos.bircle.CaptureActivity.java
private void animateTranslationY(View target, float start_height, float end_height) { // translationY????(ON) ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(target, "translationY", start_height, end_height); // 1???// w ww . j a v a 2 s . c om objectAnimator.setDuration(300); // ??? objectAnimator.start(); }
From source file:com.auratech.launcher.Folder.java
public void animateOpen() { positionAndSizeAsIcon();//from ww w . jav a 2s. com if (!(getParent() instanceof DragLayer)) return; centerAboutIcon(); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY); oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, String.format(getContext().getString(R.string.folder_opened), mContent.getCountX(), mContent.getCountY())); mState = STATE_ANIMATING; } @Override public void onAnimationEnd(Animator animation) { mState = STATE_OPEN; setLayerType(LAYER_TYPE_NONE, null); // Only show cling if we are not in the middle of a drag - this would be quite jarring. if (!mDragController.isDragging()) { Cling cling = mLauncher.getLauncherClings().showFoldersCling(); if (cling != null) { cling.bringScrimToFront(); bringToFront(); cling.bringToFront(); } } setFocusOnFirstChild(); } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); // Make sure the folder picks up the last drag move even if the finger doesn't move. if (mDragController.isDragging()) { mDragController.forceTouchMove(); } }
From source file:com.actionbarsherlock.sample.hcgallery.MainActivity.java
public void toggleVisibleTitles() { // Use these for custom animations. final FragmentManager fm = getSupportFragmentManager(); final TitlesFragment f = (TitlesFragment) fm.findFragmentById(R.id.frag_title); final View titlesView = f.getView(); mLabelIndex = 1 - mLabelIndex;/* w ww. java 2s . c o m*/ // Determine if we're in portrait, and whether we're showing or hiding the titles // with this toggle. final boolean isPortrait = getResources() .getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT; final boolean shouldShow = f.isHidden() || mCurrentTitlesAnimator != null; // Cancel the current titles animation if there is one. if (mCurrentTitlesAnimator != null) mCurrentTitlesAnimator.cancel(); // Begin setting up the object animator. We'll animate the bottom or right edge of the // titles view, as well as its alpha for a fade effect. ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(titlesView, PropertyValuesHolder.ofInt(isPortrait ? "bottom" : "right", shouldShow ? getResources().getDimensionPixelSize(R.dimen.titles_size) : 0), PropertyValuesHolder.ofFloat("alpha", shouldShow ? 1 : 0)); // At each step of the animation, we'll perform layout by calling setLayoutParams. final ViewGroup.LayoutParams lp = titlesView.getLayoutParams(); objectAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator valueAnimator) { // *** WARNING ***: triggering layout at each animation frame highly impacts // performance so you should only do this for simple layouts. More complicated // layouts can be better served with individual animations on child views to // avoid the performance penalty of layout. if (isPortrait) { lp.height = (Integer) valueAnimator.getAnimatedValue(); } else { lp.width = (Integer) valueAnimator.getAnimatedValue(); } titlesView.setLayoutParams(lp); } }); if (shouldShow) { fm.beginTransaction().show(f).commit(); objectAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animator) { mCurrentTitlesAnimator = null; } }); } else { objectAnimator.addListener(new AnimatorListenerAdapter() { boolean canceled; @Override public void onAnimationCancel(Animator animation) { canceled = true; super.onAnimationCancel(animation); } @Override public void onAnimationEnd(Animator animator) { if (canceled) return; mCurrentTitlesAnimator = null; fm.beginTransaction().hide(f).commit(); } }); } // Start the animation. objectAnimator.start(); mCurrentTitlesAnimator = objectAnimator; invalidateOptionsMenu(); // Manually trigger onNewIntent to check for ACTION_DIALOG. onNewIntent(getIntent()); }
From source file:com.fairphone.fplauncher3.Folder.java
public void animateClosed() { if (!(getParent() instanceof DragLayer)) { return;//w ww .ja v a 2 s .c om } PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.9f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.9f); /*final ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY);*/ setLayerType(LAYER_TYPE_HARDWARE, null); float animatorDurationScale = Settings.Global.getFloat(getContext().getContentResolver(), Settings.Global.ANIMATOR_DURATION_SCALE, 1); ObjectAnimator oa; if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mPowerManager.isPowerSaveMode()) || animatorDurationScale < 0.01f) { // power save mode is no fun - skip alpha animation and just set it to 0 // otherwise the icons will stay around until the duration of the animation oa = LauncherAnimUtils.ofPropertyValuesHolder(this, scaleX, scaleY); setAlpha(0f); } else { oa = LauncherAnimUtils.ofPropertyValuesHolder(this, alpha, scaleX, scaleY); } oa.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { onCloseComplete(); setLayerType(LAYER_TYPE_NONE, null); mState = STATE_SMALL; } @Override public void onAnimationStart(Animator animation) { sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, getContext().getString(R.string.folder_closed)); mState = STATE_ANIMATING; } }); oa.setDuration(mExpandDuration); setLayerType(LAYER_TYPE_HARDWARE, null); oa.start(); }