List of usage examples for android.animation ObjectAnimator setStartDelay
@Override public void setStartDelay(long startDelay)
From source file:com.ae.apps.messagecounter.fragments.SentCountFragment.java
/** * Sets the progress value to a progressbar, with animation if the OS supports it * /*from w w w . j a v a 2 s . c o m*/ * @param progressBar * @param progress */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) private static void setProgressWithAnimation(ProgressBar progressBar, int progress, long animDelay) { // We try to add animation for newer APIs here if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.HONEYCOMB) { android.animation.ObjectAnimator animation = android.animation.ObjectAnimator.ofInt(progressBar, PROGRESS_VALUE, 0, progress); animation.setDuration(100); animation.setStartDelay(animDelay); animation.setInterpolator(new AccelerateDecelerateInterpolator()); animation.start(); } else { progressBar.setProgress(progress); } }
From source file:com.fa.imaged.activity.DetailActivityV2.java
private static void animatePhotoLike() { detailvBgLike.setVisibility(View.VISIBLE); detailivLike.setVisibility(View.VISIBLE); detailvBgLike.setScaleY(0.1f);/* w ww.j ava2 s . c om*/ detailvBgLike.setScaleX(0.1f); detailvBgLike.setAlpha(1f); detailivLike.setScaleY(0.1f); detailivLike.setScaleX(0.1f); AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator bgScaleYAnim = ObjectAnimator.ofFloat(detailvBgLike, "scaleY", 0.1f, 1f); bgScaleYAnim.setDuration(200); bgScaleYAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator bgScaleXAnim = ObjectAnimator.ofFloat(detailvBgLike, "scaleX", 0.1f, 1f); bgScaleXAnim.setDuration(200); bgScaleXAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator bgAlphaAnim = ObjectAnimator.ofFloat(detailvBgLike, "alpha", 1f, 0f); bgAlphaAnim.setDuration(200); bgAlphaAnim.setStartDelay(150); bgAlphaAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator imgScaleUpYAnim = ObjectAnimator.ofFloat(detailivLike, "scaleY", 0.1f, 1f); imgScaleUpYAnim.setDuration(300); imgScaleUpYAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator imgScaleUpXAnim = ObjectAnimator.ofFloat(detailivLike, "scaleX", 0.1f, 1f); imgScaleUpXAnim.setDuration(300); imgScaleUpXAnim.setInterpolator(DECCELERATE_INTERPOLATOR); ObjectAnimator imgScaleDownYAnim = ObjectAnimator.ofFloat(detailivLike, "scaleY", 1f, 0f); imgScaleDownYAnim.setDuration(300); imgScaleDownYAnim.setInterpolator(ACCELERATE_INTERPOLATOR); ObjectAnimator imgScaleDownXAnim = ObjectAnimator.ofFloat(detailivLike, "scaleX", 1f, 0f); imgScaleDownXAnim.setDuration(300); imgScaleDownXAnim.setInterpolator(ACCELERATE_INTERPOLATOR); animatorSet.playTogether(bgScaleYAnim, bgScaleXAnim, bgAlphaAnim, imgScaleUpYAnim, imgScaleUpXAnim); animatorSet.play(imgScaleDownYAnim).with(imgScaleDownXAnim).after(imgScaleUpYAnim); animatorSet.start(); }
From source file:by.gdgminsk.animationguide.util.AnimUtils.java
public static void scaleOut(final View view, int delay) { PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.0f); PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0.4f); ObjectAnimator scaleOutAnimation = ObjectAnimator.ofPropertyValuesHolder(view, alpha, scaleX, scaleY); scaleOutAnimation.setInterpolator(EASE_OUT_INTERPOLATOR); scaleOutAnimation.addListener(new AnimatorListenerAdapter() { @Override/*from w ww . j a v a 2 s. co m*/ public void onAnimationEnd(Animator animation) { view.setVisibility(View.GONE); } @Override public void onAnimationStart(Animator animation) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationCancel(Animator animation) { view.setScaleX(0.0f); view.setScaleY(0.0f); view.setVisibility(View.GONE); } }); scaleOutAnimation.setDuration(view.getResources().getInteger(R.integer.duration_fab_scale_out)); scaleOutAnimation.setStartDelay(delay); scaleOutAnimation.start(); }
From source file:com.github.rubensousa.floatingtoolbar.FloatingAnimatorImpl.java
@Override public void show() { super.show(); int rootWidth = getRootView().getWidth(); float endFabX; if (getFab().getLeft() > rootWidth / 2f) { endFabX = getFab().getLeft() - getFab().getWidth(); } else {// w w w . ja v a 2s . co m endFabX = getFab().getLeft() + getFab().getWidth(); } PropertyValuesHolder xProperty = PropertyValuesHolder.ofFloat(View.X, endFabX); PropertyValuesHolder yProperty = PropertyValuesHolder.ofFloat(View.Y, getFloatingToolbar().getY() * 0.95f); PropertyValuesHolder scaleXProperty = PropertyValuesHolder.ofFloat(View.SCALE_X, 0); PropertyValuesHolder scaleYProperty = PropertyValuesHolder.ofFloat(View.SCALE_Y, 0); ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(getFab(), xProperty, yProperty, scaleXProperty, scaleYProperty); animator.setDuration(FAB_MORPH_DURATION); animator.setInterpolator(new AccelerateInterpolator()); animator.start(); ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(getFloatingToolbar(), "scaleX", 1f); objectAnimator.setDuration(CIRCULAR_REVEAL_DURATION); objectAnimator.setStartDelay(CIRCULAR_REVEAL_DELAY); objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); objectAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { getFloatingToolbar().setVisibility(View.VISIBLE); getFab().setVisibility(View.INVISIBLE); } }); objectAnimator.start(); }
From source file:la.marsave.fullscreentest.MainActivity.java
/** * This method animates the image fragment into the background by both * scaling and rotating the fragment's view, as well as adding a * translucent dark hover view to inform the user that it is inactive. *//*from w w w . j a va 2s . c o m*/ public void slideBack(Animator.AnimatorListener listener) { View movingFragmentView = mInfiniteViewPager; PropertyValuesHolder rotateX = PropertyValuesHolder.ofFloat("rotationY", 40f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 0.8f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 0.8f); ObjectAnimator movingFragmentAnimator = ObjectAnimator.ofPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY); ObjectAnimator darkHoverViewAnimator = ObjectAnimator.ofFloat(mDarkHoverView, "alpha", 0.0f, 0.5f); ObjectAnimator movingFragmentRotator = ObjectAnimator.ofFloat(movingFragmentView, "rotationY", 0); movingFragmentRotator.setStartDelay(getResources().getInteger(R.integer.half_slide_up_down_duration)); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, darkHoverViewAnimator, movingFragmentRotator); s.addListener(listener); s.start(); }
From source file:la.marsave.fullscreentest.MainActivity.java
/** * This method animates the image fragment into the foreground by both * scaling and rotating the fragment's view, while also removing the * previously added translucent dark hover view. Upon the completion of * this animation, the image fragment regains focus since this method is * called from the onBackStackChanged method. *///from w w w. j a v a2 s . c o m public void slideForward() { View movingFragmentView = mInfiniteViewPager; PropertyValuesHolder rotateX = PropertyValuesHolder.ofFloat("rotationX", 40f); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f); ObjectAnimator movingFragmentAnimator = ObjectAnimator.ofPropertyValuesHolder(movingFragmentView, rotateX, scaleX, scaleY); ObjectAnimator darkHoverViewAnimator = ObjectAnimator.ofFloat(mDarkHoverView, "alpha", 0.5f, 0.0f); ObjectAnimator movingFragmentRotator = ObjectAnimator.ofFloat(movingFragmentView, "rotationX", 0); movingFragmentRotator.setStartDelay(getResources().getInteger(R.integer.half_slide_up_down_duration)); AnimatorSet s = new AnimatorSet(); s.playTogether(movingFragmentAnimator, movingFragmentRotator, darkHoverViewAnimator); s.setStartDelay(getResources().getInteger(R.integer.slide_up_down_duration)); s.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mIsAnimating = false; } }); s.start(); }
From source file:com.google.samples.apps.topeka.widget.quiz.AbsQuizView.java
private void resizeViewProperty(Property<View, Float> property, float targetScale, int durationOffset) { ObjectAnimator animator = ObjectAnimator.ofFloat(this, property, 1f, targetScale); animator.setInterpolator(mLinearOutSlowInInterpolator); animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY + durationOffset); animator.start();/*from w w w .j av a 2 s . c om*/ }
From source file:sg.fxl.topeka.widget.quiz.AbsQuizView.java
private void resizeViewProperty(Property<View, Float> property, float targetScale, int durationOffset) { ObjectAnimator animator = ObjectAnimator.ofFloat(this, property, 1f, targetScale); animator.setInterpolator(linearOutSlowInInterpolator); animator.setStartDelay(FOREGROUND_COLOR_CHANGE_DELAY + durationOffset); animator.start();/* ww w. j av a 2s . c om*/ }
From source file:com.stanzione.licensesmanagement.ui.CompanyRecyclerAdapter.java
@Override public void onBindViewHolder(final ViewHolder holder, int position) { final Company currentCompany = values.get(position); final int companyPosition = position; if (isFirstLoad) { originalEditIconPosition = holder.companyListItemEditIcon.getX(); originalRemoveIconPosition = holder.companyListItemRemoveIcon.getX(); //isFirstLoad = false; }/*from w ww. j a v a2s . c o m*/ holder.companyListItemName.setText(currentCompany.getName()); holder.companyListItemAddress.setText(currentCompany.getAddress()); if (showEdit) { holder.companyListItemRemoveIcon.setVisibility(View.VISIBLE); holder.companyListItemEditIcon.setVisibility(View.VISIBLE); ObjectAnimator animEditIcon = ObjectAnimator.ofFloat(holder.companyListItemEditIcon, "translationX", holder.companyListItemEditIcon.getX(), originalEditIconPosition); animEditIcon.setDuration(500); animEditIcon.start(); ObjectAnimator animRemoveIcon = ObjectAnimator.ofFloat(holder.companyListItemRemoveIcon, "translationX", holder.companyListItemRemoveIcon.getX(), originalRemoveIconPosition); animRemoveIcon.setDuration(500); animRemoveIcon.setStartDelay(100); animRemoveIcon.start(); } else { if (isFirstLoad) { holder.companyListItemEditIcon.setVisibility(View.INVISIBLE); holder.companyListItemRemoveIcon.setVisibility(View.INVISIBLE); } else { holder.companyListItemEditIcon.setVisibility(View.VISIBLE); holder.companyListItemRemoveIcon.setVisibility(View.VISIBLE); } ObjectAnimator animEditIcon = ObjectAnimator.ofFloat(holder.companyListItemEditIcon, "translationX", originalEditIconPosition, originalEditIconPosition + 300); animEditIcon.setDuration(500); animEditIcon.setStartDelay(100); animEditIcon.start(); ObjectAnimator animRemoveIcon = ObjectAnimator.ofFloat(holder.companyListItemRemoveIcon, "translationX", originalRemoveIconPosition, originalRemoveIconPosition + 300); animRemoveIcon.setDuration(500); animRemoveIcon.start(); } holder.companyListItemRemoveIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Remove Company").setMessage( "Removing this company, any related Project and its Licenses will be removed as well. Do you want to continue?") .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton("Remove", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Log.d(TAG, "Removing company: " + currentCompany.getId() + " - " + currentCompany.getName()); removeCompany(companyPosition); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); builder.create().show(); } }); holder.companyListItemEditIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "selectedCompany ID: " + currentCompany.getId()); activity.get().onCompanyToEdit(companyPosition); } }); holder.companyListRelativeLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "selectedCompany ID: " + currentCompany.getId()); activity.get().onCompanySelected(companyPosition); } }); }
From source file:com.stanzione.licensesmanagement.ui.ContactRecyclerAdapter.java
@Override public void onBindViewHolder(final ViewHolder holder, int position) { final Contact currentContact = values.get(position); final int contactPosition = position; holder.contactListItemName.setText(currentContact.getFirstName() + " " + currentContact.getLastName()); holder.contactListItemTitle.setText(currentContact.getTitle()); holder.contactListItemCompanyName.setText(currentContact.getCompanyName()); holder.contactListItemEmail.setText(currentContact.getEmail()); holder.contactListItemTelNumber.setText(currentContact.getTelNumber()); if (showEdit) { holder.contactListItemRemoveIcon.setVisibility(View.VISIBLE); holder.contactListItemEditIcon.setVisibility(View.VISIBLE); //ObjectAnimator anim = ObjectAnimator.ofFloat(holder.companyListItemAddress, "alpha", 0f, 1f); //anim.setDuration(1000); //anim.start(); ObjectAnimator animEditIcon = ObjectAnimator.ofFloat(holder.contactListItemEditIcon, "translationX", holder.contactListItemEditIcon.getX(), originalEditIconPosition); animEditIcon.setDuration(500);//from ww w .j a v a2 s .co m animEditIcon.start(); ObjectAnimator animRemoveIcon = ObjectAnimator.ofFloat(holder.contactListItemRemoveIcon, "translationX", holder.contactListItemRemoveIcon.getX(), originalRemoveIconPosition); animRemoveIcon.setDuration(500); animRemoveIcon.setStartDelay(100); animRemoveIcon.start(); } else { if (isFirstLoad) { holder.contactListItemEditIcon.setVisibility(View.INVISIBLE); holder.contactListItemRemoveIcon.setVisibility(View.INVISIBLE); } else { holder.contactListItemEditIcon.setVisibility(View.VISIBLE); holder.contactListItemRemoveIcon.setVisibility(View.VISIBLE); } ObjectAnimator animEditIcon = ObjectAnimator.ofFloat(holder.contactListItemEditIcon, "translationX", originalEditIconPosition, originalEditIconPosition + 300); animEditIcon.setDuration(500); animEditIcon.setStartDelay(100); animEditIcon.start(); ObjectAnimator animRemoveIcon = ObjectAnimator.ofFloat(holder.contactListItemRemoveIcon, "translationX", originalRemoveIconPosition, originalRemoveIconPosition + 300); animRemoveIcon.setDuration(500); animRemoveIcon.start(); } holder.contactListItemEditIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "selectedContact ID: " + currentContact.getId()); activity.get().onContactToEdit(contactPosition); } }); holder.contactListItemRemoveIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Remove Contact").setMessage("Are you sure you want to remove this Contact?") .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton("Remove", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Log.d(TAG, "Removing contact: " + currentContact.getId() + " - " + currentContact.getFirstName()); removeContact(contactPosition); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); builder.create().show(); } }); holder.contactListRelativeLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "selectedContact ID: " + currentContact.getId()); activity.get().onContactSelected(contactPosition); } }); }