List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator
public AccelerateDecelerateInterpolator()
From source file:com.cloverstudio.spika.SpikaApp.java
@Override public void onCreate() { super.onCreate(); sInstance = this; mPreferences = new Preferences(this); mPreferences.clearFlagsForTutorialEachBoot(getApplicationContext().getPackageName()); gOpenFromBackground = true;/*from w w w.ja v a 2 s . c om*/ mFileDir = new FileDir(this); ImageLoader.initImageLoaderInstance(this); mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); // Create typefaces mTfMyriadPro = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf"); mTfMyriadProBold = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Bold.ttf"); setTransportBasedOnScreenDensity(42); // Example interpolator; could use linear or accelerate interpolator // instead final AccelerateDecelerateInterpolator accDecInterpolator = new AccelerateDecelerateInterpolator(); final LinearInterpolator linearInterpolator = new LinearInterpolator(); final int slidingDuration = getResources().getInteger(R.integer.sliding_duration); // Set up animations mSlideInLeft = new TranslateAnimation(-mTransport, 0, 0, 0); mSlideInLeft.setDuration(slidingDuration); // mSlideInLeft.setFillAfter(true); // hmm not sure mSlideInLeft.setFillEnabled(false); mSlideInLeft.setInterpolator(linearInterpolator); mSlideOutRight = new TranslateAnimation(0, mTransport, 0, 0); mSlideOutRight.setDuration(slidingDuration); mSlideOutRight.setFillAfter(true); mSlideOutRight.setFillEnabled(true); mSlideOutRight.setInterpolator(linearInterpolator); mSlideOutLeft = new TranslateAnimation(0, -mTransport, 0, 0); mSlideOutLeft.setDuration(slidingDuration); mSlideOutLeft.setInterpolator(linearInterpolator); mSlideInRight = new TranslateAnimation(mTransport, 0, 0, 0); mSlideInRight.setDuration(slidingDuration); mSlideInRight.setFillAfter(true); mSlideInRight.setFillEnabled(true); mSlideInRight.setInterpolator(linearInterpolator); mSlideFromTop.setFillAfter(true); mSlideFromTop.setFillEnabled(true); mSlideFromTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime)); mSlideFromTop.setInterpolator(linearInterpolator); mSlideOutTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime)); mSlideOutTop.setInterpolator(linearInterpolator); String strUUID = UUID.randomUUID().toString(); Logger.debug("uuid", strUUID); mBaseUrl = mPreferences.getUserServerURL(); }
From source file:com.cloverstudio.spikademo.SpikaApp.java
@Override public void onCreate() { super.onCreate(); sInstance = this; mPreferences = new Preferences(this); mPreferences.clearFlagsForTutorialEachBoot(getApplicationContext().getPackageName()); gOpenFromBackground = true;/* ww w .j ava 2s .c o m*/ mFileDir = new FileDir(this); ImageLoader.initImageLoaderInstance(this); mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); // Create typefaces mTfMyriadPro = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf"); mTfMyriadProBold = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Bold.ttf"); setTransportBasedOnScreenDensity(42); // Example interpolator; could use linear or accelerate interpolator // instead final AccelerateDecelerateInterpolator accDecInterpolator = new AccelerateDecelerateInterpolator(); final LinearInterpolator linearInterpolator = new LinearInterpolator(); final int slidingDuration = getResources().getInteger(R.integer.sliding_duration); // Set up animations mSlideInLeft = new TranslateAnimation(-mTransport, 0, 0, 0); mSlideInLeft.setDuration(slidingDuration); // mSlideInLeft.setFillAfter(true); // hmm not sure mSlideInLeft.setFillEnabled(false); mSlideInLeft.setInterpolator(linearInterpolator); mSlideOutRight = new TranslateAnimation(0, mTransport, 0, 0); mSlideOutRight.setDuration(slidingDuration); mSlideOutRight.setFillAfter(true); mSlideOutRight.setFillEnabled(true); mSlideOutRight.setInterpolator(linearInterpolator); mSlideOutLeft = new TranslateAnimation(0, -mTransport, 0, 0); mSlideOutLeft.setDuration(slidingDuration); mSlideOutLeft.setInterpolator(linearInterpolator); mSlideInRight = new TranslateAnimation(mTransport, 0, 0, 0); mSlideInRight.setDuration(slidingDuration); mSlideInRight.setFillAfter(true); mSlideInRight.setFillEnabled(true); mSlideInRight.setInterpolator(linearInterpolator); mSlideFromTop.setFillAfter(true); mSlideFromTop.setFillEnabled(true); mSlideFromTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime)); mSlideFromTop.setInterpolator(linearInterpolator); mSlideOutTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime)); mSlideOutTop.setInterpolator(linearInterpolator); String strUUID = UUID.randomUUID().toString(); Logger.debug("uuid", strUUID); }
From source file:com.fastbootmobile.encore.app.fragments.MaterialReelBaseFragment.java
protected void showMaterialReelBar(final FloatingActionButton playFab) { if (mMaterialBarVisible) { return;//from w ww. j a va 2 s. c o m } mMaterialBarVisible = true; mBarLayout.setVisibility(View.VISIBLE); mBarLayout.setAlpha(0); mHandler.post(new Runnable() { @Override public void run() { final int DP = getResources().getDimensionPixelSize(R.dimen.one_dp); mSourceDeltaX = ((mBarLayout.getMeasuredWidth() / 2) - playFab.getLeft()) - playFab.getMeasuredWidth() / 2; CircularPathAnimation anim = new CircularPathAnimation(0, mSourceDeltaX, 0, 125 * DP); anim.setDuration(400); anim.setInterpolator(new AccelerateDecelerateInterpolator()); anim.setFillAfter(true); mHandler.postDelayed(new Runnable() { @Override public void run() { if (isDetached() || getActivity() == null) { return; } try { mBarLayout.setAlpha(1.0f); mBarLayout.setBackgroundColor(playFab.getNormalColor()); Utils.animateHeadingReveal(mBarLayout, mBarLayout.getMeasuredWidth() / 2, (int) (mBarLayout.getMeasuredHeight() / 1.25f), ArtistActivity.BACK_DELAY); playFab.animate().setStartDelay(80).alpha(0).scaleX(0.5f).scaleY(0.5f).setDuration(150) .start(); mBarPlay.setAlpha(0f); mBarNext.setAlpha(0f); mBarNext.setTranslationX(-16 * DP); mBarNext.setScaleX(0); mBarNext.setScaleY(0); mBarPrevious.setAlpha(0f); mBarPrevious.setTranslationX(16 * DP); mBarPrevious.setScaleX(0); mBarPrevious.setScaleY(0); mBarRepeat.setAlpha(0f); mBarRepeat.setTranslationX(-16 * DP); mBarRepeat.setScaleX(0); mBarRepeat.setScaleY(0); mBarShuffle.setAlpha(0f); mBarShuffle.setTranslationX(16 * DP); mBarShuffle.setScaleX(0); mBarShuffle.setScaleY(0); mBarPlay.animate().alpha(1).setDuration(100).start(); mBarNext.animate().alpha(1).scaleX(1).scaleY(1).translationX(0).setDuration(250) .start(); mBarRepeat.animate().alpha(PlaybackProxy.isRepeatMode() ? 1 : DISABLED_OPACITY) .scaleX(1).scaleY(1).translationX(0).setDuration(250).start(); mBarPrevious.animate().alpha(1).translationX(0).scaleX(1).scaleY(1).setDuration(250) .start(); mBarShuffle.animate().alpha(PlaybackProxy.isShuffleMode() ? 1 : DISABLED_OPACITY) .translationX(0).scaleX(1).scaleY(1).setDuration(250).start(); } catch (IllegalStateException ignore) { } } }, 300); playFab.startAnimation(anim); } }); }
From source file:com.codefororlando.transport.MapsActivity.java
private void removeSelectableItemFragment() { final Fragment selectableItemFragment = getFragmentManager().findFragmentByTag(ISelectableItemFragment.TAG); if (selectableItemFragment != null) { final View view = selectableItemFragment.getView(); if (view == null) { return; }/*w ww .j a v a 2 s. co m*/ final int animationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime); { final Animation animation = new TranslateAnimation(0, 0, 0, view.getHeight()); animation.setDuration(animationDuration); animation.setInterpolator(new AccelerateDecelerateInterpolator()); filterView.startAnimation(animation); } { final FragmentManager fragmentManager = getFragmentManager(); final Animation animation = new TranslateAnimation(0, 0, 0, view.getHeight()); animation.setDuration(animationDuration); animation.setAnimationListener(new EmptyAnimationListener() { @Override public void onAnimationEnd(Animation animation) { try { fragmentManager.beginTransaction().remove(selectableItemFragment) .commitAllowingStateLoss(); } catch (Exception e) { e.printStackTrace(); } } }); view.startAnimation(animation); } } }
From source file:com.grottworkshop.gwscirclereveal.animation.ViewAnimationUtils.java
/** * Lifting view//from w ww .j ava 2s . c om * * @param view The animation target * @param baseRotation initial Rotation X in 3D space * @param duration aniamtion duration */ @Deprecated public static void liftingFromBottom(View view, float baseRotation, int duration) { view.setRotationX(baseRotation); view.setTranslationY(view.getHeight() / 3); animate(view).setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(duration).rotationX(0) .translationY(0).start(); }
From source file:com.snappy.SpikaApp.java
@Override public void onCreate() { super.onCreate(); sInstance = this; /*For test purposes, we change this method*/ mPreferences = new Preferences(this); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); /*end of new method*/ gOpenFromBackground = true;// ww w .ja v a 2s. c om mFileDir = new FileDir(this); ImageLoader.initImageLoaderInstance(this); mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); // Create typefaces mTfMyriadPro = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf"); mTfMyriadProBold = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Bold.ttf"); setTransportBasedOnScreenDensity(42); // Example interpolator; could use linear or accelerate interpolator // instead final AccelerateDecelerateInterpolator accDecInterpolator = new AccelerateDecelerateInterpolator(); final LinearInterpolator linearInterpolator = new LinearInterpolator(); final int slidingDuration = getResources().getInteger(R.integer.sliding_duration); // Set up animations mSlideInLeft = new TranslateAnimation(-mTransport, 0, 0, 0); mSlideInLeft.setDuration(slidingDuration); // mSlideInLeft.setFillAfter(true); // hmm not sure mSlideInLeft.setFillEnabled(false); mSlideInLeft.setInterpolator(linearInterpolator); mSlideOutRight = new TranslateAnimation(0, mTransport, 0, 0); mSlideOutRight.setDuration(slidingDuration); mSlideOutRight.setFillAfter(true); mSlideOutRight.setFillEnabled(true); mSlideOutRight.setInterpolator(linearInterpolator); mSlideOutLeft = new TranslateAnimation(0, -mTransport, 0, 0); mSlideOutLeft.setDuration(slidingDuration); mSlideOutLeft.setInterpolator(linearInterpolator); mSlideInRight = new TranslateAnimation(mTransport, 0, 0, 0); mSlideInRight.setDuration(slidingDuration); mSlideInRight.setFillAfter(true); mSlideInRight.setFillEnabled(true); mSlideInRight.setInterpolator(linearInterpolator); mSlideFromTop.setFillAfter(true); mSlideFromTop.setFillEnabled(true); mSlideFromTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime)); mSlideFromTop.setInterpolator(linearInterpolator); mSlideOutTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime)); mSlideOutTop.setInterpolator(linearInterpolator); String strUUID = UUID.randomUUID().toString(); Logger.debug("uuid", strUUID); mBaseUrl = mPreferences.getUserServerURL(); sContext = getApplicationContext(); }
From source file:me.xiaopan.android.viewplayer.ViewPlayer.java
/** * ??/*w ww . j a va 2 s . co m*/ * @param duration */ public void setAnimationDuration(int duration) { if (duration > 0) { try { Field field = ViewPager.class.getDeclaredField("mScroller"); field.setAccessible(true); FixedSpeedScroller scroller = new FixedSpeedScroller(this.getContext(), new AccelerateDecelerateInterpolator()); field.set(this, scroller); scroller.setAnimationDuration(duration); } catch (Exception e) { e.printStackTrace(); } } }
From source file:ru.yandex.metricaworkshop.receiver.BarFragment.java
private void updateBarGraph(Map<String, Float> data) { if (!data.isEmpty()) { resetBarGraph();//from w w w . j ava 2 s .c om int i = 0; for (String key : data.keySet()) { Bar bar = mBarMap.get(key); float value = data.get(key); if (bar == null) { bar = createBar(key, value, Consts.COLORS[(mBarMap.keySet().size() + 1) % Consts.COLORS.length]); mBarMap.put(key, bar); mBarGraph.getBars().add(bar); } else { bar.setGoalValue(value); } i++; } //List<Bar> barsToRemove = new ArrayList<Bar>(); for (Bar bar : mBarGraph.getBars()) { if (bar.getGoalValue() == 0) { bar.mAnimateSpecial = HoloGraphAnimate.ANIMATE_DELETE; } } mBarGraph.setInterpolator(new AccelerateDecelerateInterpolator()); mBarGraph.setDuration(1000); mBarGraph.animateToGoalValues(); // mBarGraph.getBars().removeAll(barsToRemove); } }
From source file:pl.mg6.android.maps.extensions.demo.AnimateMarkersActivity.java
private Interpolator randomInterpolator() { int val = random.nextInt(14); switch (val) { case 0://from w w w . j av a 2s .c o m return new LinearInterpolator(); case 1: return new AccelerateDecelerateInterpolator(); case 2: return new AccelerateInterpolator(); case 3: return new AccelerateInterpolator(6.0f); case 4: return new DecelerateInterpolator(); case 5: return new DecelerateInterpolator(6.0f); case 6: return new BounceInterpolator(); case 7: return new AnticipateOvershootInterpolator(); case 8: return new AnticipateOvershootInterpolator(6.0f); case 9: return new AnticipateInterpolator(); case 10: return new AnticipateInterpolator(6.0f); case 11: return new OvershootInterpolator(); case 12: return new OvershootInterpolator(6.0f); case 13: return new CycleInterpolator(1.25f); } throw new RuntimeException(); }
From source file:com.uf.togathor.Togathor.java
@Override public void onCreate() { super.onCreate(); sInstance = this; mPreferences = new Preferences(this); mPreferences.clearFlagsForTutorialEachBoot(getApplicationContext().getPackageName()); gOpenFromBackground = true;//www . j av a 2 s . c o m mFileDir = new FileDir(this); mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); googleAPIService = new GoogleAPIService(this); messagesDataSource = new MessagesDataSource(this); eventMessagesDataSource = new EventMessagesDataSource(this); contactsDataSource = new ContactsDataSource(this); startEventService(); Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("s3lab", "S3LAB!!".toCharArray()); } }); // Create typefaces mTfMyriadPro = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Regular.ttf"); mTfMyriadProBold = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Bold.ttf"); setTransportBasedOnScreenDensity(42); // Example interpolator; could use linear or accelerate interpolator // instead final AccelerateDecelerateInterpolator accDecInterpolator = new AccelerateDecelerateInterpolator(); final LinearInterpolator linearInterpolator = new LinearInterpolator(); final int slidingDuration = getResources().getInteger(R.integer.sliding_duration); // Set up animations mSlideInLeft = new TranslateAnimation(-mTransport, 0, 0, 0); mSlideInLeft.setDuration(slidingDuration); // mSlideInLeft.setFillAfter(true); // hmm not sure mSlideInLeft.setFillEnabled(false); mSlideInLeft.setInterpolator(linearInterpolator); mSlideOutRight = new TranslateAnimation(0, mTransport, 0, 0); mSlideOutRight.setDuration(slidingDuration); mSlideOutRight.setFillAfter(true); mSlideOutRight.setFillEnabled(true); mSlideOutRight.setInterpolator(linearInterpolator); mSlideOutLeft = new TranslateAnimation(0, -mTransport, 0, 0); mSlideOutLeft.setDuration(slidingDuration); mSlideOutLeft.setInterpolator(linearInterpolator); mSlideInRight = new TranslateAnimation(mTransport, 0, 0, 0); mSlideInRight.setDuration(slidingDuration); mSlideInRight.setFillAfter(true); mSlideInRight.setFillEnabled(true); mSlideInRight.setInterpolator(linearInterpolator); mSlideFromTop.setFillAfter(true); mSlideFromTop.setFillEnabled(true); mSlideFromTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime)); mSlideFromTop.setInterpolator(linearInterpolator); mSlideOutTop.setDuration(this.getResources().getInteger(android.R.integer.config_mediumAnimTime)); mSlideOutTop.setInterpolator(linearInterpolator); String strUUID = UUID.randomUUID().toString(); Logger.debug("uuid", strUUID); mBaseUrl = mPreferences.getUserServerURL(); }