List of usage examples for android.animation Animator start
public void start()
From source file:com.eugene.fithealthmaingit.UI.ChooseAddMealTabsFragment.java
private void handleSearchFavorite() { if (card_search_fav.getVisibility() == View.VISIBLE) { searchFavorite.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final Animator animatorHide = ViewAnimationUtils.createCircularReveal(card_search_fav, card_search_fav.getWidth() - (int) convertDpToPixel(24, getActivity()), (int) convertDpToPixel(23, getActivity()), (float) Math.hypot(card_search_fav.getWidth(), card_search_fav.getHeight()), 0); animatorHide.addListener(new Animator.AnimatorListener() { @Override//w ww. j ava 2 s. c o m public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { card_search_fav.setVisibility(View.GONE); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(searchFavorite.getWindowToken(), 0); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animatorHide.setDuration(200); animatorHide.start(); } else { favSearch.requestFocus(); card_search_fav.setVisibility(View.GONE); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(searchFavorite.getWindowToken(), 0); } } else { searchFavorite.setVisibility(View.INVISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final Animator animator = ViewAnimationUtils.createCircularReveal(card_search_fav, card_search_fav.getWidth() - (int) convertDpToPixel(24, getActivity()), (int) convertDpToPixel(23, getActivity()), 0, (float) Math.hypot(card_search_fav.getWidth(), card_search_fav.getHeight())); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { favSearch.requestFocus(); } @Override public void onAnimationEnd(Animator animation) { favSearch.requestFocus(); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); card_search_fav.setVisibility(View.VISIBLE); if (card_search_fav.getVisibility() == View.VISIBLE) { animator.setDuration(300); animator.start(); } } else { favSearch.requestFocus(); card_search_fav.setVisibility(View.VISIBLE); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } } }
From source file:com.eugene.fithealthmaingit.UI.ChooseAddMealTabsFragment.java
private void handleSearchManual() { if (card_search_manual.getVisibility() == View.VISIBLE) { searchManual.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final Animator animatorHide = ViewAnimationUtils.createCircularReveal(card_search_manual, card_search_manual.getWidth() - (int) convertDpToPixel(24, getActivity()), (int) convertDpToPixel(23, getActivity()), (float) Math.hypot(card_search_manual.getWidth(), card_search_manual.getHeight()), 0); animatorHide.addListener(new Animator.AnimatorListener() { @Override// w w w. jav a 2 s . c om public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { card_search_manual.setVisibility(View.GONE); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(searchManual.getWindowToken(), 0); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animatorHide.setDuration(200); animatorHide.start(); } else { card_search_manual.setVisibility(View.GONE); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(searchManual.getWindowToken(), 0); } } else { searchManual.setVisibility(View.INVISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final Animator animator = ViewAnimationUtils.createCircularReveal(card_search_manual, card_search_manual.getWidth() - (int) convertDpToPixel(24, getActivity()), (int) convertDpToPixel(23, getActivity()), 0, (float) Math.hypot(card_search_manual.getWidth(), card_search_manual.getHeight())); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { manualSearch.requestFocus(); } @Override public void onAnimationEnd(Animator animation) { ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); card_search_manual.setVisibility(View.VISIBLE); if (card_search_manual.getVisibility() == View.VISIBLE) { animator.setDuration(300); animator.start(); card_search_manual.setEnabled(true); } } else { manualSearch.requestFocus(); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); card_search_manual.setVisibility(View.VISIBLE); } } }
From source file:android.support.transition.TransitionPort.java
/** * This is a utility method used by subclasses to handle standard parts of * setting up and running an Animator: it sets the {@link #getDuration() * duration} and the {@link #getStartDelay() startDelay}, starts the * animation, and, when the animator ends, calls {@link #end()}. * * @param animator The Animator to be run during this transition. * @hide/*ww w . java2s. c om*/ */ @RestrictTo(GROUP_ID) protected void animate(Animator animator) { // TODO: maybe pass auto-end as a boolean parameter? if (animator == null) { end(); } else { if (getDuration() >= 0) { animator.setDuration(getDuration()); } if (getStartDelay() >= 0) { animator.setStartDelay(getStartDelay()); } if (getInterpolator() != null) { animator.setInterpolator(getInterpolator()); } animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { end(); animation.removeListener(this); } }); animator.start(); } }
From source file:com.android.incallui.CallCardFragment.java
@Override public void animateForNewOutgoingCall() { final ViewGroup parent = (ViewGroup) mPrimaryCallCardContainer.getParent(); final ViewTreeObserver observer = getView().getViewTreeObserver(); mIsAnimating = true;// w ww .j a va 2 s . c o m observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { final ViewTreeObserver observer = getView().getViewTreeObserver(); if (!observer.isAlive()) { return; } observer.removeOnGlobalLayoutListener(this); final LayoutIgnoringListener listener = new LayoutIgnoringListener(); mPrimaryCallCardContainer.addOnLayoutChangeListener(listener); // Prepare the state of views before the slide animation final int originalHeight = mPrimaryCallCardContainer.getHeight(); mPrimaryCallCardContainer.setTag(R.id.view_tag_callcard_actual_height, originalHeight); mPrimaryCallCardContainer.setBottom(parent.getHeight()); // Set up FAB. mFloatingActionButtonContainer.setVisibility(View.GONE); mFloatingActionButtonController.setScreenWidth(parent.getWidth()); mCallButtonsContainer.setAlpha(0); mCallStateLabel.setAlpha(0); mPrimaryName.setAlpha(0); mCallTypeLabel.setAlpha(0); mCallNumberAndLabel.setAlpha(0); assignTranslateAnimation(mCallStateLabel, 1); assignTranslateAnimation(mCallStateIcon, 1); assignTranslateAnimation(mPrimaryName, 2); assignTranslateAnimation(mCallNumberAndLabel, 3); assignTranslateAnimation(mCallTypeLabel, 4); assignTranslateAnimation(mCallButtonsContainer, 5); final Animator animator = getShrinkAnimator(parent.getHeight(), originalHeight); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mPrimaryCallCardContainer.setTag(R.id.view_tag_callcard_actual_height, null); setViewStatePostAnimation(listener); mIsAnimating = false; InCallPresenter.getInstance().onShrinkAnimationComplete(); } }); animator.start(); } }); }
From source file:com.songcode.materialnotes.ui.NoteEditActivity.java
private void animateRevealShow(View targetview, View startView) { if (isActionInsertOrEdit()) { final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); int cx = startView.getLeft() + (startView.getWidth() / 2); //middle of button int cy = startView.getTop() + (startView.getHeight() / 2); //middle of button int radius = (int) Math.sqrt(Math.pow(cx, 2) + Math.pow(cy, 2)); //hypotenuse to top left Animator anim = ViewAnimationUtils.createCircularReveal(targetview, cx, cy, 0, radius); targetview.setVisibility(View.VISIBLE); anim.setInterpolator(new DecelerateInterpolator()); anim.addListener(new Animator.AnimatorListener() { @Override/*from www .j a v a2s .c om*/ public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mNoteEditor.requestFocus(); imm.showSoftInput(mNoteEditor, 0); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); anim.setDuration(ANIM_DURATION); anim.start(); } else if (isActionActionView()) { mAnimBackGroudView.animate().scaleX(.92f).scaleY(.92f).alpha(.6f).setDuration(ANIM_DURATION) .setInterpolator(new AccelerateInterpolator()).start(); mNoteEditor.animate().alpha(1).setStartDelay(400).setDuration(ANIM_DURATION); ViewCompat.setTransitionName(mAnimTargetView, "target_anim_view"); } }
From source file:com.stanleyidesis.quotograph.ui.activity.LWQSettingsActivity.java
void animateAction(final View button) { runOnUiThread(new Runnable() { @Override/*w w w . j a v a2 s .c o m*/ public void run() { final Animator animator = AnimatorInflater.loadAnimator(LWQSettingsActivity.this, R.animator.progress_rotation); animator.setTarget(button); button.setTag(R.id.view_tag_animator, animator); animator.start(); } }); }
From source file:br.liveo.searchliveo.SearchCardLiveo.java
private SearchCardLiveo hideAnimation() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (getStatusBarHideColor() != -1) { mContext.getWindow().setStatusBarColor(getStatusBarHideColor()); } else {/*from ww w. j a v a2 s . c o m*/ mContext.getWindow().setStatusBarColor(getColorPrimaryDark()); } final Animator animatorHide = ViewAnimationUtils.createCircularReveal(mCardSearch, mCardSearch.getWidth() - (int) dpToPixel(24, mContext), (int) dpToPixel(23, mContext), (float) Math.hypot(mCardSearch.getWidth(), mCardSearch.getHeight()), 0); animatorHide.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(mRecyclerView.getWindowToken(), 0); } }); } @Override public void onAnimationEnd(Animator animation) { mCardSearch.setVisibility(View.GONE); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animatorHide.setDuration(200); animatorHide.start(); } else { mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(mRecyclerView.getWindowToken(), 0); } }); Animation mFadeOut = AnimationUtils.loadAnimation(mContext.getApplicationContext(), android.R.anim.fade_out); mCardSearch.setAnimation(mFadeOut); mCardSearch.setVisibility(View.INVISIBLE); } mEdtSearch.setText(""); mCardSearch.setEnabled(false); return this; }
From source file:br.liveo.searchliveo.SearchLiveo.java
private SearchLiveo hideAnimation() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (getStatusBarHideColor() != -1) { mContext.getWindow().setStatusBarColor(getStatusBarHideColor()); } else {//from ww w .j a va2s . co m mContext.getWindow().setStatusBarColor(getColorPrimaryDark()); } final Animator animatorHide = ViewAnimationUtils.createCircularReveal(mViewSearch, mViewSearch.getWidth() - (int) dpToPixel(24, mContext), (int) dpToPixel(23, mContext), (float) Math.hypot(mViewSearch.getWidth(), mViewSearch.getHeight()), 0); animatorHide.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(mRecyclerView.getWindowToken(), 0); } }); } @Override public void onAnimationEnd(Animator animation) { mViewSearch.setVisibility(View.GONE); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animatorHide.setDuration(200); animatorHide.start(); } else { mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(mRecyclerView.getWindowToken(), 0); } }); Animation mFadeOut = AnimationUtils.loadAnimation(mContext.getApplicationContext(), android.R.anim.fade_out); mViewSearch.setAnimation(mFadeOut); mViewSearch.setVisibility(View.INVISIBLE); } mEdtSearch.setText(""); mViewSearch.setEnabled(false); return this; }
From source file:br.liveo.searchliveo.SearchCardLiveo.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void showAnimation() { try {/*from www . j a v a2 s. c om*/ if (getStatusBarShowColor() != -1) { mContext.getWindow().setStatusBarColor(getStatusBarShowColor()); } else { mContext.getWindow() .setStatusBarColor(ContextCompat.getColor(mContext, R.color.search_liveo_primary_dark)); } final Animator animator = ViewAnimationUtils.createCircularReveal(mCardSearch, mCardSearch.getWidth() - (int) dpToPixel(24, this.mContext), (int) dpToPixel(23, this.mContext), 0, (float) Math.hypot(mCardSearch.getWidth(), mCardSearch.getHeight())); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.setDuration(300); animator.start(); } catch (Exception e) { e.getStackTrace(); mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } mCardSearch.setVisibility(View.VISIBLE); }
From source file:br.liveo.searchliveo.SearchLiveo.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void showAnimation() { try {/*from w w w. j a v a2 s. co m*/ if (getStatusBarShowColor() != -1) { mContext.getWindow().setStatusBarColor(getStatusBarShowColor()); } else { mContext.getWindow() .setStatusBarColor(ContextCompat.getColor(mContext, R.color.search_liveo_primary_dark)); } final Animator animator = ViewAnimationUtils.createCircularReveal(mViewSearch, mViewSearch.getWidth() - (int) dpToPixel(24, this.mContext), (int) dpToPixel(23, this.mContext), 0, (float) Math.hypot(mViewSearch.getWidth(), mViewSearch.getHeight())); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.setDuration(300); animator.start(); } catch (Exception e) { e.getStackTrace(); mContext.runOnUiThread(new Runnable() { @Override public void run() { ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } }); } mViewSearch.setVisibility(View.VISIBLE); }