List of usage examples for android.animation Animator start
public void start()
From source file:liam.franco.selene.activities.MainActivity.java
private void animateCloseBottomFabSheet() { if (bottomFabBar != null && bottomFabBar.getVisibility() == View.VISIBLE) { final int[] xy = ViewUtils.viewCoordinates(fab); Animator animator = ViewAnimationUtils.createCircularReveal(bottomFabBar, (xy[0] + (fab.getMeasuredWidth() >> 1)), -bottomFabBar.getHeight(), Math.max(bottomFabBar.getWidth(), bottomFabBar.getHeight()), 0); animator.setDuration(500);// www . j a v a 2 s. c o m animator.setStartDelay(500); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (fab != null) { fab.setVisibility(View.VISIBLE); } if (bottomFabBar != null) { bottomFabBar.setVisibility(View.INVISIBLE); } } }); animator.start(); } }
From source file:de.janniskilian.xkcdreader.presentation.components.showcomics.ShowComicsActivity.java
@Override public void startSearchMode(boolean animate) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (animate) { final View actionMenuView = toolbar.getChildAt(1); final ViewGroup actionMenuViewGroup = (ViewGroup) actionMenuView; final View addButton = actionMenuViewGroup.getChildAt(0); searchButtonCenter = new Point( (int) (addButton.getX() + actionMenuView.getX() + addButton.getWidth() / 2), (int) (addButton.getY() + actionMenuView.getY() + addButton.getHeight() / 2)); final Animator animator = ViewAnimationUtils.createCircularReveal(searchToolbar, searchButtonCenter.x, searchButtonCenter.y, 0, searchToolbar.getWidth()); animator.setDuration(revealStatusBarDuration); animator.addListener(new StartSearchModeAnimationListener(toolbar)); searchToolbar.setVisibility(View.VISIBLE); animator.start(); } else {//from w w w . j a v a 2 s .co m searchToolbar.setVisibility(View.VISIBLE); } setSupportActionBar(searchToolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(tintedBackArrow); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(R.layout.toolbar_search); } } else { toolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.background)); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeAsUpIndicator(tintedBackArrow); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(R.layout.toolbar_search); } invalidateOptionsMenu(); } searchInput = (EditText) findViewById(R.id.search_input); searchInput.requestFocus(); searchInputSub = RxTextView.textChangeEvents(searchInput) .debounce(searchInputDebounceDuration, TimeUnit.MILLISECONDS) .observeOn(AndroidSchedulers.mainThread()).subscribe(textViewTextChangeEvent -> { presenter.onSearchInputChanged(textViewTextChangeEvent.text().toString()); }); searchInputLengthSub = RxTextView.textChangeEvents(searchInput).observeOn(AndroidSchedulers.mainThread()) .subscribe(textViewTextChangeEvent -> { presenter.onSearchInputLengthChanged(textViewTextChangeEvent.text().toString(), textViewTextChangeEvent.count()); }); searchInput.setOnEditorActionListener((textView, actionId, keyEvent) -> { if (actionId == EditorInfo.IME_ACTION_SEARCH) { Utils.hideKeyboard(ShowComicsActivity.this); return true; } return false; }); Utils.showKeyboard(this); searchResults.setVisibility(View.VISIBLE); if (animate) { searchResults.animate().alpha(1).setDuration(crossfadeViewPagerSearchDuration).setListener(null); viewPager.animate().alpha(0).setDuration(crossfadeViewPagerSearchDuration) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { viewPager.setVisibility(View.GONE); } }); } else { searchResults.setAlpha(1); viewPager.setAlpha(0); viewPager.setVisibility(View.GONE); } }
From source file:org.cyanogenmod.designertools.ui.CreditsActivity.java
private void circularRevealActivity(View v) { int cx = v.getWidth() / 2; int cy = v.getHeight() / 2; float finalRadius = Math.max(v.getWidth(), v.getHeight()); // create the animator for this view (the start radius is zero) Animator circularReveal = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, finalRadius); circularReveal.setDuration(getResources().getInteger(R.integer.credits_circular_reveal_duration)); // make the view visible and start the animation v.setVisibility(View.VISIBLE); circularReveal.setInterpolator(new AccelerateDecelerateInterpolator()); circularReveal.addListener(new Animator.AnimatorListener() { @Override//from w w w .j a v a2s . c o m public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { animateContent(); } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); circularReveal.start(); }
From source file:com.pitchedapps.primenumbercalculator.Calculator.java
License:asdf
void enterReveal(View view) { // previously invisible view final View myView = view; // get the final radius for the clipping circle int finalRadius = Math.max(myView.getWidth(), myView.getHeight()); // create the animator for this view (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(myView, x, y, 0, finalRadius).setDuration(600); // make the view visible and start the animation myView.setVisibility(View.VISIBLE); anim.start(); }
From source file:io.plaidapp.ui.HomeActivity.java
void revealPostingProgress() { Animator reveal = ViewAnimationUtils.createCircularReveal(fabPosting, (int) fabPosting.getPivotX(), (int) fabPosting.getPivotY(), 0f, fabPosting.getWidth() / 2).setDuration(600L); reveal.setInterpolator(AnimUtils.getFastOutLinearInInterpolator(this)); reveal.start(); AnimatedVectorDrawable uploading = (AnimatedVectorDrawable) getDrawable(R.drawable.avd_uploading); if (uploading != null) { fabPosting.setImageDrawable(uploading); uploading.start();/*www . j a va 2 s. co m*/ } }
From source file:com.example.jonas.materialmockups.activities.ExhibitDetailsActivity.java
/** * Hides the audio toolbar./* www. java 2 s . c om*/ * @return true if the audio toolbar was hidden, false otherwise */ private boolean hideAudioToolbar() { if (mRevealView != null) { int cx = (mRevealView.getLeft() + mRevealView.getRight()); int cy = mRevealView.getTop(); int radius = Math.max(mRevealView.getWidth(), mRevealView.getHeight()); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRevealView, cx, cy, 0, radius); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(800); SupportAnimator animator_reverse = animator.reverse(); animator_reverse.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { } @Override public void onAnimationEnd() { mRevealView.setVisibility(View.INVISIBLE); isAudioToolbarHidden = true; } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); animator_reverse.start(); } else { Animator anim = android.view.ViewAnimationUtils.createCircularReveal(mRevealView, cx, cy, radius, 0); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mRevealView.setVisibility(View.INVISIBLE); isAudioToolbarHidden = true; } }); anim.start(); } return true; } return false; }
From source file:im.ene.lab.attiq.ui.activities.SearchActivity.java
@OnClick({ R.id.scrim, R.id.searchback }) protected void dismiss() { // if we're showing search mRecyclerView, circular hide them if (mResultsContainer.getHeight() > 0) { ViewCompat.animate(mResultsContainer).alpha(0.f).setDuration(400L).setInterpolator(LINEAR_OUT_SLOW_INT) .start();//from ww w. j a va 2 s.com Animator closeResults = ViewAnimationUtils.createCircularReveal(mResultsContainer, mSearchIconCenterX, 0, (float) Math.hypot(mSearchIconCenterX, mResultsContainer.getHeight()), 0f); closeResults.setDuration(500L); closeResults.setInterpolator(LINEAR_OUT_SLOW_INT); closeResults.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mResultsContainer.setVisibility(View.INVISIBLE); } }); closeResults.start(); } // translate the icon to match position in the launching activity ViewCompat.animate(mSearchNavButtonContainer).translationX(mSearchBackDistanceX).alpha(0.f) .setDuration(600L).setInterpolator(LINEAR_OUT_SLOW_INT) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { ActivityCompat.finishAfterTransition(SearchActivity.this); } }).start(); // transform from back icon to search icon mSearchNavButton.setImageResource(R.drawable.ic_search_24dp_black); // clear the background else the touch ripple moves with the translation which looks bad mSearchNavButton.setBackground(null); // fade out the other search chrome ViewCompat.animate(mSearchView).alpha(0f).setStartDelay(0L).setDuration(120L) .setInterpolator(LINEAR_OUT_SLOW_INT).setListener(null).start(); ViewCompat.animate(mSearchBackground).alpha(0f).setStartDelay(300L).setDuration(160L) .setInterpolator(LINEAR_OUT_SLOW_INT).setListener(null).start(); if (ViewCompat.getZ(mSearchToolbar) != 0f) { ViewCompat.animate(mSearchToolbar).z(0f).setDuration(600L).setInterpolator(LINEAR_OUT_SLOW_INT).start(); } // fade out the mScrim ViewCompat.animate(mScrim).alpha(0f).setDuration(400L).setInterpolator(LINEAR_OUT_SLOW_INT) .setListener(null).start(); }
From source file:liam.franco.selene.activities.MainActivity.java
private void animateOpenBottomFabSheet() { if (bottomFabBar != null && bottomFabBar.getVisibility() == View.INVISIBLE) { final int[] xy = ViewUtils.viewCoordinates(fab); Animator animator = ViewAnimationUtils.createCircularReveal(bottomFabBar, (xy[0] + (fab.getMeasuredWidth() >> 1)), -bottomFabBar.getHeight(), UIUtils.convertDpToPixel(56f, App.CONTEXT), Math.max(bottomFabBar.getWidth(), bottomFabBar.getHeight())); animator.setDuration(500);/*from ww w . j a v a2 s . c o m*/ animator.setStartDelay(7000); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { if (fab != null) { fab.setVisibility(View.GONE); } if (bottomFabBar != null) { bottomFabBar.setVisibility(View.VISIBLE); } } }); animator.start(); } }
From source file:com.hannesdorfmann.search.SearchActivity.java
@OnClick(R.id.fab) protected void save() { // show the save confirmation bubble fab.setVisibility(View.INVISIBLE); confirmSaveContainer.setVisibility(View.VISIBLE); resultsScrim.setVisibility(View.VISIBLE); // expand it once it's been measured and show a scrim over the search results confirmSaveContainer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override/*from w ww .j a va 2 s.c om*/ public boolean onPreDraw() { // expand the confirmation confirmSaveContainer.getViewTreeObserver().removeOnPreDrawListener(this); Animator reveal = ViewAnimationUtils.createCircularReveal(confirmSaveContainer, confirmSaveContainer.getWidth() / 2, confirmSaveContainer.getHeight() / 2, fab.getWidth() / 2, confirmSaveContainer.getWidth() / 2); reveal.setDuration(250L); reveal.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.fast_out_slow_in)); reveal.start(); // show the scrim int centerX = (fab.getLeft() + fab.getRight()) / 2; int centerY = (fab.getTop() + fab.getBottom()) / 2; Animator revealScrim = ViewAnimationUtils.createCircularReveal(resultsScrim, centerX, centerY, 0, (float) Math.hypot(centerX, centerY)); revealScrim.setDuration(400L); revealScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.linear_out_slow_in)); revealScrim.start(); ObjectAnimator fadeInScrim = ObjectAnimator.ofArgb(resultsScrim, ViewUtils.BACKGROUND_COLOR, Color.TRANSPARENT, ContextCompat.getColor(SearchActivity.this, R.color.scrim)); fadeInScrim.setDuration(800L); fadeInScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.linear_out_slow_in)); fadeInScrim.start(); // ease in the checkboxes saveDribbble.setAlpha(0.6f); saveDribbble.setTranslationY(saveDribbble.getHeight() * 0.4f); saveDribbble.animate().alpha(1f).translationY(0f).setDuration(200L).setInterpolator(AnimationUtils .loadInterpolator(SearchActivity.this, android.R.interpolator.linear_out_slow_in)); saveDesignerNews.setAlpha(0.6f); saveDesignerNews.setTranslationY(saveDesignerNews.getHeight() * 0.5f); saveDesignerNews.animate().alpha(1f).translationY(0f).setDuration(200L) .setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.linear_out_slow_in)); return false; } }); }
From source file:despotoski.nikola.github.com.bottomnavigationlayout.BottomTabLayout.java
/** * @param position Position of the bottom tab to be removed (0 based) * @param removeAnimation Animation to be perfomed before tab being removed from its container *//*from w w w . ja v a 2 s . c o m*/ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void removeTabAt(final int position, @NonNull Animator removeAnimation) { ensureListenersList(); final View removedTab = mBottomTabViews.remove(position); if (removedTab != null) { removeAnimation.setTarget(removedTab); removeAnimation.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { removeTabInternal(removedTab, position); } }); removeAnimation.start(); } }