List of usage examples for android.view.animation AccelerateInterpolator AccelerateInterpolator
public AccelerateInterpolator()
From source file:com.gudong.appkit.ui.helper.AppItemAnimator.java
private void animateAddImpl(final RecyclerView.ViewHolder viewHolder) { final View target = viewHolder.itemView; mAddAnimations.add(viewHolder);/*from w w w . j a va2s .c o m*/ final AnimatorSet animator = new AnimatorSet(); animator.playTogether(ObjectAnimator.ofFloat(target, "translationX", -target.getMeasuredWidth(), 0, 0f), ObjectAnimator.ofFloat(target, "alpha", 0.5f, 1.0f)); animator.setTarget(target); animator.setDuration(KEY_DURATION_TIME); animator.setInterpolator(new AccelerateInterpolator()); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); dispatchAddStarting(viewHolder); } @Override public void onAnimationCancel(Animator animation) { super.onAnimationCancel(animation); ViewCompat.setAlpha(target, 1); } @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); animator.removeAllListeners(); dispatchAddFinished(viewHolder); mAddAnimations.remove(viewHolder); dispatchFinishedWhenDone(); } }); animator.start(); }
From source file:com.geecko.QuickLyric.utils.ScreenSlidePagerAdapter.java
public void exitAction() { Animation slideOut = new TranslateAnimation(0f, -2000f, 0f, 0f); slideOut.setInterpolator(new AccelerateInterpolator()); slideOut.setDuration(700);//from w w w . j a v a2 s . c om slideOut.setAnimationListener(new Animation.AnimationListener() { public void onAnimationEnd(Animation animation) { ((RelativeLayout) mPager.getParent()).setVisibility(View.GONE); ((MainActivity) mActivity).focusOnFragment = true; if (((MainActivity) mActivity).mDrawerToggle != null) { ((MainActivity) mActivity).getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((MainActivity) mActivity).mDrawerToggle.setDrawerIndicatorEnabled(true); } mActivity.invalidateOptionsMenu(); SharedPreferences.Editor editor = mActivity.getSharedPreferences("tutorial", Context.MODE_PRIVATE) .edit(); editor.putBoolean("seen", true); editor.apply(); } public void onAnimationRepeat(Animation animation) { } public void onAnimationStart(Animation animation) { } }); ((MainActivity) mActivity).setStatusBarColor(null); ((MainActivity) mActivity).setNavBarColor(null); ((RelativeLayout) mPager.getParent()).startAnimation(slideOut); }
From source file:io.vit.vitio.StartScreens.DetailFragment.java
public void animate() { ObjectAnimator animatorY = ObjectAnimator.ofFloat(displayImage, "translationY", 200, 0); ObjectAnimator animatorA = ObjectAnimator.ofFloat(displayImage, "alpha", 0, 1); animatorY.setDuration(200);/*from w w w. j ava 2s .co m*/ animatorA.setDuration(200); animatorY.setInterpolator(new AccelerateInterpolator()); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(animatorY, animatorA); animatorSet.start(); }
From source file:MainActivity.java
private void zoomFromThumbnail(final ImageView imageViewThumb) { if (mCurrentAnimator != null) { mCurrentAnimator.cancel();/*from w ww .ja v a2 s .c om*/ } final Rect startBounds = new Rect(); final Rect finalBounds = new Rect(); final Point globalOffset = new Point(); imageViewThumb.getGlobalVisibleRect(startBounds); findViewById(R.id.frameLayout).getGlobalVisibleRect(finalBounds, globalOffset); mImageViewExpanded .setImageBitmap(loadSampledResource(R.drawable.image, finalBounds.height(), finalBounds.width())); startBounds.offset(-globalOffset.x, -globalOffset.y); finalBounds.offset(-globalOffset.x, -globalOffset.y); float startScale; if ((float) finalBounds.width() / finalBounds.height() > (float) startBounds.width() / startBounds.height()) { startScale = (float) startBounds.height() / finalBounds.height(); float startWidth = startScale * finalBounds.width(); float deltaWidth = (startWidth - startBounds.width()) / 2; startBounds.left -= deltaWidth; startBounds.right += deltaWidth; } else { startScale = (float) startBounds.width() / finalBounds.width(); float startHeight = startScale * finalBounds.height(); float deltaHeight = (startHeight - startBounds.height()) / 2; startBounds.top -= deltaHeight; startBounds.bottom += deltaHeight; } imageViewThumb.setVisibility(View.GONE); mImageViewExpanded.setVisibility(View.VISIBLE); mImageViewExpanded.setPivotX(0f); mImageViewExpanded.setPivotY(0f); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(ObjectAnimator.ofFloat(mImageViewExpanded, View.X, startBounds.left, finalBounds.left)) .with(ObjectAnimator.ofFloat(mImageViewExpanded, View.Y, startBounds.top, finalBounds.top)) .with(ObjectAnimator.ofFloat(mImageViewExpanded, View.SCALE_X, startScale, 1f)) .with(ObjectAnimator.ofFloat(mImageViewExpanded, View.SCALE_Y, startScale, 1f)); animatorSet.setDuration(1000); animatorSet.setInterpolator(new AccelerateInterpolator()); animatorSet.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mCurrentAnimator = null; } @Override public void onAnimationCancel(Animator animation) { mCurrentAnimator = null; } }); animatorSet.start(); mCurrentAnimator = animatorSet; }
From source file:com.example.google.maps.folding_map.MainActivity.java
public void animateFold() { ObjectAnimator animator = ObjectAnimator.ofFloat(mFoldingLayout, "foldFactor", mFoldingLayout.getFoldFactor(), 1); animator.setRepeatMode(ValueAnimator.REVERSE); animator.setRepeatCount(1);/*from w ww. j av a2 s . c o m*/ animator.setDuration(FOLD_ANIMATION_DURATION); animator.setInterpolator(new AccelerateInterpolator()); animator.start(); }
From source file:com.huzefagadi.brownbear.fragments.ImagePagerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { imageAdapter = new ImageAdapter(); View rootView = inflater.inflate(R.layout.fr_image_pager, container, false); viewPager = (ViewPager) rootView.findViewById(R.id.pager); viewPager.setAdapter(imageAdapter);/*from w ww . j a v a 2s .c o m*/ viewPager.setCurrentItem(0); try { Field mScroller; mScroller = ViewPager.class.getDeclaredField("mScroller"); mScroller.setAccessible(true); Interpolator sInterpolator = new AccelerateInterpolator(); FixedSpeedScroller scroller = new FixedSpeedScroller(viewPager.getContext(), sInterpolator); // scroller.setFixedDuration(5000); // mScroller.set(pager, scroller); } catch (NoSuchFieldException e) { } catch (IllegalArgumentException e) { } slideshow(); return rootView; }
From source file:com.jaspervanriet.huntingthatproduct.Activities.CollectionActivity.java
private void startIntroAnimation() { mCollectionLayout.setScaleY(0.1f);//from w ww. j a v a 2s . c om mCollectionLayout.setPivotY(mDrawingStartLocation); mCollectionLayout.animate().scaleY(1).setDuration(ANIM_LAYOUT_INTRO_DURATION) .setInterpolator(new AccelerateInterpolator()).start(); }
From source file:com.jaspervanriet.huntingthatproduct.Views.FeedContextMenuManager.java
private void performDismissAnimation() { contextMenuView.setPivotX(contextMenuView.getWidth() / 2); contextMenuView.setPivotY(contextMenuView.getHeight()); contextMenuView.animate().scaleX(0.1f).scaleY(0.1f).setDuration(150) .setInterpolator(new AccelerateInterpolator()).setStartDelay(100) .setListener(new AnimatorListenerAdapter() { @Override//from www. j a va 2 s . c om public void onAnimationEnd(Animator animation) { if (contextMenuView != null) { contextMenuView.dismiss(); } isContextMenuDismissing = false; } }); }
From source file:com.softminds.matrixcalculator.base_activities.faqs.java
@Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationZ", 20); animator.setDuration(200);//from www.jav a 2 s . co m animator.setInterpolator(new DecelerateInterpolator()); animator.start(); view.performClick(); return true; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationZ", 0); animator2.setDuration(200); animator2.setInterpolator(new AccelerateInterpolator()); animator2.start(); return true; default: return false; } }
From source file:org.fedorahosted.freeotp.main.ScanDialogFragment.java
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { for (int i = 0; i < permissions.length; i++) { if (!permissions[i].equals(Manifest.permission.CAMERA)) continue; switch (grantResults[i]) { case PackageManager.PERMISSION_GRANTED: mFotoapparat.start();/*from ww w. ja va 2 s . com*/ mCamera.animate().setInterpolator(new AccelerateInterpolator()).setDuration(2000).alpha(1.0f) .start(); break; default: dismiss(); break; } } }