List of usage examples for android.animation AnimatorListenerAdapter AnimatorListenerAdapter
AnimatorListenerAdapter
From source file:com.rbware.github.androidcouchpotato.app.OnboardingSupportFragment.java
boolean startLogoAnimation() { Animator animator = null;//w w w. j a v a2 s.c o m if (mLogoResourceId != 0) { mLogoView.setVisibility(View.VISIBLE); mLogoView.setImageResource(mLogoResourceId); Animator inAnimator = AnimatorInflater.loadAnimator(getActivity(), R.animator.lb_onboarding_logo_enter); Animator outAnimator = AnimatorInflater.loadAnimator(getActivity(), R.animator.lb_onboarding_logo_exit); outAnimator.setStartDelay(LOGO_SPLASH_PAUSE_DURATION_MS); AnimatorSet logoAnimator = new AnimatorSet(); logoAnimator.playSequentially(inAnimator, outAnimator); logoAnimator.setTarget(mLogoView); animator = logoAnimator; } else { animator = onCreateLogoAnimation(); } if (animator != null) { animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (getActivity() != null) { startEnterAnimation(); } } }); animator.start(); return true; } return false; }
From source file:android.support.v17.leanback.app.OnboardingSupportFragment.java
private boolean startLogoAnimation() { Animator animator = null;/*from w w w. j av a 2 s . c o m*/ if (mLogoResourceId != 0) { mLogoView.setVisibility(View.VISIBLE); mLogoView.setImageResource(mLogoResourceId); Animator inAnimator = AnimatorInflater.loadAnimator(getActivity(), R.animator.lb_onboarding_logo_enter); Animator outAnimator = AnimatorInflater.loadAnimator(getActivity(), R.animator.lb_onboarding_logo_exit); outAnimator.setStartDelay(LOGO_SPLASH_PAUSE_DURATION_MS); AnimatorSet logoAnimator = new AnimatorSet(); logoAnimator.playSequentially(inAnimator, outAnimator); logoAnimator.setTarget(mLogoView); animator = logoAnimator; } else { animator = onCreateLogoAnimation(); } if (animator != null) { animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (getActivity() != null) { startEnterAnimation(); } } }); animator.start(); return true; } return false; }
From source file:cc.flydev.launcher.Folder.java
public void animateOpen() { positionAndSizeAsIcon();//from w w w .j a v a 2 s.c om 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.farmerbb.taskbar.service.DashboardService.java
private void fadeOut(final boolean sendIntent) { mAppWidgetHost.stopListening();//from w ww . j a va2s . com DashboardHelper.getInstance().setDashboardOpen(false); layout.animate().alpha(0).setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { layout.setVisibility(View.GONE); if (sendIntent) LocalBroadcastManager.getInstance(DashboardService.this) .sendBroadcast(new Intent("com.farmerbb.taskbar.DASHBOARD_DISAPPEARING")); } }); }
From source file:com.example.launcher3.Folder.java
public void animateOpen() { positionAndSizeAsIcon();//from ww w . jav a2 s .co 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:ch.berta.fabio.fabprogress.FabProgress.java
private void fadeIn(final boolean reverse) { animate().setDuration(ICON_CHANGE_ANIM_DURATION).alpha(1).scaleX(1f).scaleY(1f) .setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR).setListener(new AnimatorListenerAdapter() { @Override/*from w ww.j ava 2s . c o m*/ public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); if (!reverse) { if (mProgressFinalAnimationListener != null) { mProgressFinalAnimationListener.onProgressFinalAnimationComplete(); } if (mIsReusable) { postDelayed(new Runnable() { @Override public void run() { resetProgress(); } }, REUSABLE_RESET_DELAY); } } } }).start(); }
From source file:com.android.tv.ui.TunableTvView.java
public TunableTvView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); inflate(getContext(), R.layout.tunable_tv_view, this); ApplicationSingletons appSingletons = TvApplication.getSingletons(context); mDvrDataManager = CommonFeatures.DVR.isEnabled(context) && BuildCompat.isAtLeastN() ? appSingletons.getDvrDataManager() : null;//from www .j a v a2 s . c o m mChannelDataManager = appSingletons.getChannelDataManager(); mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); mCanModifyParentalControls = PermissionUtils.hasModifyParentalControls(context); mTracker = appSingletons.getTracker(); mBlockScreenType = BLOCK_SCREEN_TYPE_NORMAL; mBlockScreenView = (BlockScreenView) findViewById(R.id.block_screen); if (!mCanModifyParentalControls) { mBlockScreenView.setImage(R.drawable.ic_message_lock_no_permission); mBlockScreenView.setScaleType(ImageView.ScaleType.CENTER); } else { mBlockScreenView.setImage(R.drawable.ic_message_lock); } mBlockScreenView.setShrunkenImage(R.drawable.ic_message_lock_preview); mBlockScreenView.addFadeOutAnimationListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { adjustBlockScreenSpacingAndText(); } }); mHideScreenView = (BlockScreenView) findViewById(R.id.hide_screen); mHideScreenView.setImageVisibility(false); mBufferingSpinnerView = findViewById(R.id.buffering_spinner); mBlockScreenForTuneView = findViewById(R.id.block_screen_for_tune); mDimScreenView = findViewById(R.id.dim); mDimScreenView.animate().setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (mActionAfterFade != null) { mActionAfterFade.run(); } } @Override public void onAnimationCancel(Animator animation) { if (mActionAfterFade != null) { mActionAfterFade.run(); } } }); }
From source file:com.jlabs.peepaid.searchviewlay.SearchViewLayout.java
private void animateStates(final boolean expand, final float start, final float end) { mAnimator = ValueAnimator.ofFloat(start, end); mAnimator.cancel();// w w w . ja v a 2 s . co m mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (expand) { Utils.setPaddingAll(SearchViewLayout.this, 0); showContentFragment(); ViewGroup.LayoutParams params = getLayoutParams(); params.height = mExpandedHeight; setLayoutParams(params); } else { Utils.setPaddingAll(SearchViewLayout.this, 8); } if (mOnToggleAnimationListener != null) mOnToggleAnimationListener.onFinish(expand); } @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); if (!expand) { ViewGroup.LayoutParams params = getLayoutParams(); params.height = mCollapsedHeight; setLayoutParams(params); } if (mOnToggleAnimationListener != null) mOnToggleAnimationListener.onStart(expand); } }); mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { int padding = (int) (8 * animation.getAnimatedFraction()); if (expand) padding = 8 - padding; Utils.setPaddingAll(SearchViewLayout.this, padding); } }); mAnimator.setDuration(ANIMATION_DURATION); mAnimator.start(); }
From source file:com.android.contacts.activities.PhotoSelectionActivity.java
private void closePhotoAndFinish() { mAnimationListener = new AnimatorListenerAdapter() { @Override/* w w w. jav a 2 s . c o m*/ public void onAnimationEnd(Animator animation) { // After the photo animates down, fade it away and finish. ObjectAnimator anim = ObjectAnimator.ofFloat(mPhotoView, "alpha", 0f) .setDuration(PHOTO_CONTRACT_DURATION); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { finishImmediatelyWithNoAnimation(); } }); anim.start(); } }; animatePhoto(mPhotoStartParams); animateAwayBackground(); }
From source file:com.jinzht.pro.swipelistview.SwipeListViewTouchListener.java
/** * Create choice animation/* w w w . j ava2 s . co m*/ * * @param view affected view * @param position list position */ private void generateChoiceAnimate(final View view, final int position) { view.animate().translationX(0).setDuration(animationTime).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { swipeListView.resetScrolling(); resetCell(); } }); }