List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator
public AccelerateDecelerateInterpolator()
From source file:ca.zadrox.dota2esportticker.ui.TeamDetailActivity.java
private void createCompatReveal() { mHeaderTeamLogo.setVisibility(View.VISIBLE); mHeaderTeamLogo.setImageBitmap(mTeam.logo); mHeaderTeamLogo.setTranslationY(-UIUtils.calculateActionBarSize(this) - mHeaderTeamLogo.getHeight()); mHeaderTeamLogo.animate().translationY(0).setDuration(100) .setInterpolator(new AccelerateDecelerateInterpolator()) .setListener(new Animator.AnimatorListener() { @Override/* www . j a va 2s.com*/ public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mHeaderTeamName.animate().alpha(1).setDuration(150) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), getResources().getColor(R.color.theme_primary), mTeam.palette.getDarkVibrantColor(getResources().getColor(R.color.theme_primary))); colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animator) { mHeaderBox.setBackgroundColor((Integer) animator.getAnimatedValue()); } }); colorAnimation.setDuration(150); colorAnimation.start(); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }).start(); }
From source file:com.hamzahrmalik.calculator2.Calculator.java
@Override public void onTextSizeChanged(final TextView textView, float oldSize) { if (mCurrentState != CalculatorState.INPUT) { // Only animate text changes that occur from user input. return;/* w w w . ja va 2 s . c o m*/ } // Calculate the values needed to perform the scale and translation // animations, // maintaining the same apparent baseline for the displayed text. final float textScale = oldSize / textView.getTextSize(); final float translationX = (1.0f - textScale) * (textView.getWidth() / 2.0f - textView.getPaddingEnd()); final float translationY = (1.0f - textScale) * (textView.getHeight() / 2.0f - textView.getPaddingBottom()); final AnimatorSet animatorSet = new AnimatorSet(); animatorSet.playTogether(ObjectAnimator.ofFloat(textView, View.SCALE_X, textScale, 1.0f), ObjectAnimator.ofFloat(textView, View.SCALE_Y, textScale, 1.0f), ObjectAnimator.ofFloat(textView, View.TRANSLATION_X, translationX, 0.0f), ObjectAnimator.ofFloat(textView, View.TRANSLATION_Y, translationY, 0.0f)); animatorSet.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime)); animatorSet.setInterpolator(new AccelerateDecelerateInterpolator()); animatorSet.start(); }
From source file:com.jaus.albertogiunta.justintrain_oraritreni.journeyFavourites.FavouriteJourneysActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_favourite_journeys); ButterKnife.bind(this); analyticsHelper = AnalyticsHelper.getInstance(getViewContext()); iabHelper = CustomIABHelper.getInstance(FavouriteJourneysActivity.this, this); checkIntro();//from w w w.j a v a 2 s.c om Log.d("onCreate token : " + FirebaseInstanceId.getInstance().getToken()); // MigrationHelper.migrateIfDue(getViewContext()); presenter = new FavouritesPresenter(this); checkIntent(getIntent()); new Handler().postDelayed(() -> { fetchRemoteConfigs(); }, 0); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setTitle(R.string.title_favourite_journeys); } ShortcutHelper.updateShortcuts(getViewContext()); adapter = new FavouriteJourneysAdapter(presenter.getRecyclerViewList(), getViewContext()); rvFavouriteJourneys.setAdapter(adapter); rvFavouriteJourneys.setLayoutManager(new LinearLayoutManager(this)); adapter.setSwipeEnabled(true); btnSearch.setScaleX(0); btnSearch.setScaleY(0); new Handler().postDelayed(() -> AnimationUtils.onCompare(btnSearch), 500); rvFavouriteJourneys.addOnScrollListener(new HideShowScrollListener() { @Override public void onHide() { btnSearch.animate().setInterpolator(new AccelerateDecelerateInterpolator()).translationY(600) .setDuration(150); btnIAP.animate().setInterpolator(new AccelerateDecelerateInterpolator()).translationY(600) .setDuration(150); } @Override public void onShow() { btnSearch.animate().setInterpolator(new AccelerateDecelerateInterpolator()).translationY(0) .setDuration(150); btnIAP.animate().setInterpolator(new AccelerateDecelerateInterpolator()).translationY(0) .setDuration(150); } }); messageReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { showSnackbar(intent.getExtras().getString(NotificationService.NOTIFICATION_ERROR_MESSAGE), NONE, Snackbar.LENGTH_SHORT); } }; apply(btnIAP, GONE); btnIAP.setOnClickListener(v -> { analyticsHelper.logScreenEvent(SCREEN_FAVOURITE_JOURNEYS, IAP_SEARCH); Intent i = new Intent(FavouriteJourneysActivity.this, LicenseUpgradeActivity.class); FavouriteJourneysActivity.this.startActivity(i); }); if (ignoreBeingProAndShowAds) { apply(btnIAP, VISIBLE); loadAds(); } AsyncTask task = new LoadCursorTask(this).execute(); startService(new Intent(this, NotificationService.class)); }
From source file:com.cleveroad.audiowidget.AudioWidget.java
private Configuration prepareConfiguration(@NonNull Builder builder) { /*int darkColor = builder.darkColorSet ? builder.darkColor : ContextCompat.getColor(context, R.color.colorPrimary); int lightColor = builder.lightColorSet ? builder.lightColor : ContextCompat.getColor(context, R.color.colorAccent); int progressColor = builder.progressColorSet ? builder.progressColor : ContextCompat.getColor(context, R.color.colorPrimaryDarkTheme); int expandColor = builder.expandWidgetColorSet ? builder.expandWidgetColor : ContextCompat.getColor(context, R.color.colorPrimary); int crossColor = builder.crossColorSet ? builder.crossColor : ContextCompat.getColor(context, R.color.colorAccent); int crossOverlappedColor = builder.crossOverlappedColorSet ? builder.crossOverlappedColor : ContextCompat.getColor(context, R.color.colorPrimaryLight);*/ int shadowColor = builder.shadowColorSet ? builder.shadowColor : ContextCompat.getColor(context, R.color.shadowbg); Drawable playDrawable = builder.playDrawable != null ? builder.playDrawable : ContextCompat.getDrawable(context, R.drawable.aw_ic_play); Drawable pauseDrawable = builder.pauseDrawable != null ? builder.pauseDrawable : ContextCompat.getDrawable(context, R.drawable.aw_ic_pause); Drawable prevDrawable = builder.prevDrawable != null ? builder.prevDrawable : ContextCompat.getDrawable(context, R.drawable.aw_ic_prev); Drawable nextDrawable = builder.nextDrawable != null ? builder.nextDrawable : ContextCompat.getDrawable(context, R.drawable.aw_ic_next); Drawable playlistDrawable = builder.playlistDrawable != null ? builder.playlistDrawable : ContextCompat.getDrawable(context, R.mipmap.ic_launcher); Drawable albumDrawable = builder.defaultAlbumDrawable != null ? builder.defaultAlbumDrawable : ContextCompat.getDrawable(context, R.mipmap.ic_launcher); int buttonPadding = builder.buttonPaddingSet ? builder.buttonPadding : context.getResources().getDimensionPixelSize(R.dimen.aw_button_padding); float crossStrokeWidth = builder.crossStrokeWidthSet ? builder.crossStrokeWidth : context.getResources().getDimension(R.dimen.aw_cross_stroke_width); float progressStrokeWidth = builder.progressStrokeWidthSet ? builder.progressStrokeWidth : context.getResources().getDimension(R.dimen.aw_progress_stroke_width); float shadowRadius = builder.shadowRadiusSet ? builder.shadowRadius : context.getResources().getDimension(R.dimen.aw_shadow_radius); float shadowDx = builder.shadowDxSet ? builder.shadowDx : context.getResources().getDimension(R.dimen.aw_shadow_dx); float shadowDy = builder.shadowDySet ? builder.shadowDy : context.getResources().getDimension(R.dimen.aw_shadow_dy); float bubblesMinSize = builder.bubblesMinSizeSet ? builder.bubblesMinSize : context.getResources().getDimension(R.dimen.aw_bubbles_min_size); float bubblesMaxSize = builder.bubblesMaxSizeSet ? builder.bubblesMaxSize : context.getResources().getDimension(R.dimen.aw_bubbles_max_size); int prevNextExtraPadding = context.getResources() .getDimensionPixelSize(R.dimen.aw_prev_next_button_extra_padding); widgetHeight = context.getResources().getDimensionPixelSize(R.dimen.aw_player_height); widgetWidth = context.getResources().getDimensionPixelSize(R.dimen.aw_player_width); radius = widgetHeight / 2f;// ww w .ja v a 2s. c om playbackState = new PlaybackState(); ateKey = Helper.getATEKey(context); accentColor = Config.accentColor(context, ateKey); primaryColor = Config.primaryColor(context, ateKey); return new Configuration.Builder().context(context).playbackState(playbackState).random(new Random()) .accDecInterpolator(new AccelerateDecelerateInterpolator()).darkColor(primaryColor) .playColor(primaryColor).progressColor(accentColor).expandedColor(primaryColor) .widgetWidth(widgetWidth).radius(radius).playlistDrawable(playlistDrawable) .playDrawable(playDrawable).prevDrawable(prevDrawable).nextDrawable(nextDrawable) .pauseDrawable(pauseDrawable).albumDrawable(albumDrawable).buttonPadding(buttonPadding) .prevNextExtraPadding(prevNextExtraPadding).crossStrokeWidth(crossStrokeWidth) .progressStrokeWidth(progressStrokeWidth).shadowRadius(shadowRadius).shadowDx(shadowDx) .shadowDy(shadowDy).shadowColor(shadowColor).bubblesMinSize(bubblesMinSize) .bubblesMaxSize(bubblesMaxSize).crossColor(accentColor).crossOverlappedColor(accentColor).build(); }
From source file:com.waz.zclient.pages.main.conversation.views.row.footer.FooterViewController.java
private void showLikeAnimation(boolean like) { final Interpolator interpolator = new AccelerateDecelerateInterpolator(); float startScale; float endScale; float startAlpha; float endAlpha; if (like) {/*from w ww . j ava 2 s .c o m*/ startScale = 2f; endScale = 1f; startAlpha = 0f; endAlpha = 1f; } else { startScale = 1f; endScale = 2f; startAlpha = 1f; endAlpha = 0f; } likeButtonAnimation.setScaleX(startScale); likeButtonAnimation.setScaleY(startScale); likeButtonAnimation.setAlpha(startAlpha); likeButtonAnimation.setVisibility(View.VISIBLE); likeButtonAnimation.animate().scaleX(endScale).scaleY(endScale).alpha(endAlpha).setDuration(250) .setInterpolator(interpolator).withEndAction(new Runnable() { @Override public void run() { if (likeButtonAnimation != null) { likeButtonAnimation.setVisibility(View.GONE); } } }); container.getControllerFactory().getVibratorController() .vibrate(new long[] { 10, 20, 10, 20, 10, 30, 10, 20, 10, 20, 10, 30 }); }
From source file:com.android.deskclock.AlarmClockFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { // Inflate the layout for this fragment final View v = inflater.inflate(R.layout.alarm_clock, container, false); long expandedId = INVALID_ID; long[] repeatCheckedIds = null; long[] selectedAlarms = null; Bundle previousDayMap = null;/*from w w w.ja v a 2s.c o m*/ if (savedState != null) { expandedId = savedState.getLong(KEY_EXPANDED_ID); repeatCheckedIds = savedState.getLongArray(KEY_REPEAT_CHECKED_IDS); mRingtoneTitleCache = savedState.getBundle(KEY_RINGTONE_TITLE_CACHE); mDeletedAlarm = savedState.getParcelable(KEY_DELETED_ALARM); mUndoShowing = savedState.getBoolean(KEY_UNDO_SHOWING); selectedAlarms = savedState.getLongArray(KEY_SELECTED_ALARMS); previousDayMap = savedState.getBundle(KEY_PREVIOUS_DAY_MAP); mSelectedAlarm = savedState.getParcelable(KEY_SELECTED_ALARM); } mExpandInterpolator = new DecelerateInterpolator(EXPAND_DECELERATION); mCollapseInterpolator = new DecelerateInterpolator(COLLAPSE_DECELERATION); if (USE_TRANSITION_FRAMEWORK) { mAddRemoveTransition = new AutoTransition(); mAddRemoveTransition.setDuration(ANIMATION_DURATION); /// M: Scrap the views in ListView and request layout again, then alarm item will be /// attached correctly. This is to avoid the case when some items are not correctly /// attached after animation end @{ mAddRemoveTransition.addListener(new Transition.TransitionListenerAdapter() { @Override public void onTransitionEnd(Transition transition) { mAlarmsList.clearScrapViewsIfNeeded(); } }); /// @} mRepeatTransition = new AutoTransition(); mRepeatTransition.setDuration(ANIMATION_DURATION / 2); mRepeatTransition.setInterpolator(new AccelerateDecelerateInterpolator()); mEmptyViewTransition = new TransitionSet().setOrdering(TransitionSet.ORDERING_SEQUENTIAL) .addTransition(new Fade(Fade.OUT)).addTransition(new Fade(Fade.IN)) .setDuration(ANIMATION_DURATION); } boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; View menuButton = v.findViewById(R.id.menu_button); if (menuButton != null) { if (isLandscape) { menuButton.setVisibility(View.GONE); } else { menuButton.setVisibility(View.VISIBLE); setupFakeOverflowMenuButton(menuButton); } } mEmptyView = v.findViewById(R.id.alarms_empty_view); mMainLayout = (FrameLayout) v.findViewById(R.id.main); mAlarmsList = (ListView) v.findViewById(R.id.alarms_list); mUndoBar = (ActionableToastBar) v.findViewById(R.id.undo_bar); mUndoFrame = v.findViewById(R.id.undo_frame); mUndoFrame.setOnTouchListener(this); mFooterView = v.findViewById(R.id.alarms_footer_view); mFooterView.setOnTouchListener(this); mAdapter = new AlarmItemAdapter(getActivity(), expandedId, repeatCheckedIds, selectedAlarms, previousDayMap, mAlarmsList); mAdapter.registerDataSetObserver(new DataSetObserver() { private int prevAdapterCount = -1; @Override public void onChanged() { final int count = mAdapter.getCount(); if (mDeletedAlarm != null && prevAdapterCount > count) { showUndoBar(); } if (USE_TRANSITION_FRAMEWORK && ((count == 0 && prevAdapterCount > 0) || /* should fade in */ (count > 0 && prevAdapterCount == 0) /* should fade out */)) { TransitionManager.beginDelayedTransition(mMainLayout, mEmptyViewTransition); } mEmptyView.setVisibility(count == 0 ? View.VISIBLE : View.GONE); // Cache this adapter's count for when the adapter changes. prevAdapterCount = count; super.onChanged(); } }); if (mRingtoneTitleCache == null) { mRingtoneTitleCache = new Bundle(); } mAlarmsList.setAdapter(mAdapter); mAlarmsList.setVerticalScrollBarEnabled(true); mAlarmsList.setOnCreateContextMenuListener(this); if (mUndoShowing) { showUndoBar(); } return v; }
From source file:org.namelessrom.devicecontrol.modules.cpu.CpuSettingsFragment.java
private void rotateView(View v) { if (v == null) { return;/*from w w w .j ava 2s . c o m*/ } v.clearAnimation(); ObjectAnimator animator = ObjectAnimator.ofFloat(v, "rotation", 0.0f, 360.0f); animator.setDuration(500); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.start(); }
From source file:com.fastbootmobile.encore.app.fragments.RecognitionFragment.java
public void showResultCard() { mCardResult.animate().alpha(1).translationY(-mCardResult.getMeasuredHeight()).setDuration(FADE_DURATION) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); mButtonLayout.animate().translationY(-mCardResult.getMeasuredHeight()).setDuration(FADE_DURATION) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); }
From source file:chinanurse.cn.nurse.list.WaveSwipeRefreshLayout.java
private void onDropPhase() { mWaveView.animationDropCircle();// w w w .j a v a 2 s .co m ValueAnimator animator = ValueAnimator.ofFloat(0, 0); animator.setDuration(500); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { mCircleView.setTranslationY(mWaveView.getCurrentCircleCenterY() + mCircleView.getHeight() / 2.f); } }); animator.start(); setRefreshing(true, true); mIsBeingDropped = true; setEventPhase(EVENT_PHASE.DROPPING); setEnabled(false); }
From source file:com.fastbootmobile.encore.app.fragments.RecognitionFragment.java
public void hideResultCard() { mCardResult.animate().alpha(0).translationY(mCardResult.getMeasuredHeight()).setDuration(FADE_DURATION) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); mButtonLayout.animate().translationY(0).setDuration(FADE_DURATION) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); }