List of usage examples for android.animation ObjectAnimator ofFloat
public static <T> ObjectAnimator ofFloat(T target, Property<T, Float> xProperty, Property<T, Float> yProperty, Path path)
Path
using two properties. From source file:com.flexible.flexibleadapter.helpers.AnimatorHelper.java
/** * Item will slide from Top of the screen to its natural position. * * @param animators user defined list of animators * @param view itemView to animate/*from ww w . j a va 2s . co m*/ * @since 5.0.0-b7 */ public static void slideInFromTopAnimator(@NonNull List<Animator> animators, @NonNull View view, RecyclerView recyclerView) { alphaAnimator(animators, view, 0f); animators.add(ObjectAnimator.ofFloat(view, "translationY", -recyclerView.getMeasuredHeight() >> 1, 0)); if (FlexibleAdapter.DEBUG) Log.v(TAG, " Added TOP Animator"); }
From source file:eu.davidea.flexibleadapter.helpers.AnimatorHelper.java
/** * Item will slide from Top of the screen to its natural position. * * @param animators user defined list//from ww w . j ava 2 s .c o m * @param view itemView to animate * @since 5.0.0-b7 */ public static void slideInFromTopAnimator(@NonNull List<Animator> animators, @NonNull View view, RecyclerView recyclerView) { alphaAnimator(animators, view, 0f); animators.add(ObjectAnimator.ofFloat(view, "translationY", -recyclerView.getMeasuredHeight() >> 1, 0)); if (FlexibleAdapter.DEBUG) Log.v(TAG, "Added TOP Animator"); }
From source file:com.grottworkshop.gwscirclereveal.animation.ViewAnimationUtils.java
/** * Returns an Animator which can animate a clipping circle. * <p>/*from w w w . j a v a2 s . c om*/ * Any shadow cast by the View will respect the circular clip from this animator. * <p> * Only a single non-rectangular clip can be applied on a View at any time. * Views clipped by a circular reveal animation take priority over * {@link android.view.View#setClipToOutline(boolean) View Outline clipping}. * <p> * Note that the animation returned here is a one-shot animation. It cannot * be re-used, and once started it cannot be paused or resumed. * * @param view The View will be clipped to the animating circle. * @param centerX The x coordinate of the center of the animating circle. * @param centerY The y coordinate of the center of the animating circle. * @param startRadius The starting radius of the animating circle. * @param endRadius The ending radius of the animating circle. */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) public static SupportAnimator createCircularReveal(View view, int centerX, int centerY, float startRadius, float endRadius) { if (!(view.getParent() instanceof RevealAnimator)) { throw new IllegalArgumentException("View must be inside RevealFrameLayout or RevealLinearLayout."); } RevealAnimator revealLayout = (RevealAnimator) view.getParent(); revealLayout.attachRevealInfo( new RevealAnimator.RevealInfo(centerX, centerY, startRadius, endRadius, new WeakReference<>(view))); if (LOLLIPOP_PLUS) { return new SupportAnimatorLollipop(android.view.ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius), revealLayout); } ObjectAnimator reveal = ObjectAnimator.ofFloat(revealLayout, CLIP_RADIUS, startRadius, endRadius); reveal.addListener(getRevealFinishListener(revealLayout)); return new SupportAnimatorPreL(reveal, revealLayout); }
From source file:cn.hjl.newspush.mvp.ui.activities.NewsPhotoDetailActivity.java
private void startAnimation(final int endState, float startValue, float endValue) { ObjectAnimator animator = ObjectAnimator.ofFloat(mPhotoDetailTitleTv, "alpha", startValue, endValue) .setDuration(200);/*from w w w .j a va 2s . c o m*/ animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { mPhotoDetailTitleTv.setVisibility(endState); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.start(); }
From source file:com.google.cloud.android.dialogflow.ui.AudioIndicatorView.java
private void startAnimating() { mAnimator = ObjectAnimator.ofFloat(this, View.ALPHA, 1.f, 0.3f); mAnimator.setRepeatCount(ObjectAnimator.INFINITE); mAnimator.setRepeatMode(ObjectAnimator.REVERSE); mAnimator.setDuration(1000);//from w w w.ja v a 2 s . c o m mAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); mAnimator.start(); }
From source file:com.willowtreeapps.spurceexampleapp.fragments.RecyclerFragment.java
@Nullable @Override//from w w w .j av a 2s . co m public View onCreateView(LayoutInflater inflater, ViewGroup container, @Nullable Bundle savedInstanceState) { recyclerView = (RecyclerView) container.findViewById(R.id.recycler); recyclerView.setHasFixedSize(true); RelativeLayout placeholder = (RelativeLayout) container.findViewById(R.id.placeholder_view); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()) { @Override public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { super.onLayoutChildren(recycler, state); // Animate in the visible children spruceAnimator = new Spruce.SpruceBuilder(recyclerView).sortWith(new DefaultSort(100)) .animateWith(DefaultAnimations.shrinkAnimator(recyclerView, 800), ObjectAnimator.ofFloat(recyclerView, "translationX", -recyclerView.getWidth(), 0f) .setDuration(800)) .start(); } }; List<RelativeLayout> placeHolderList = new ArrayList<>(); for (int i = 0; i < 10; i++) { placeHolderList.add(placeholder); } recyclerView.setAdapter(new RecyclerAdapter(placeHolderList)); recyclerView.setLayoutManager(linearLayoutManager); return inflater.inflate(R.layout.recycler_fragment, container, false); }
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; }// w ww . j a va2s . c om 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:eu.davidea.flexibleadapter.helpers.AnimatorHelper.java
/** * Item will slide from Bottom of the screen to its natural position. * * @param animators user defined list//from w w w. jav a 2 s .c om * @param view itemView to animate * @since 5.0.0-b1 */ public static void slideInFromBottomAnimator(@NonNull List<Animator> animators, @NonNull View view, RecyclerView recyclerView) { alphaAnimator(animators, view, 0f); animators.add(ObjectAnimator.ofFloat(view, "translationY", recyclerView.getMeasuredHeight() >> 1, 0)); if (FlexibleAdapter.DEBUG) Log.v(TAG, "Added BOTTOM Animator"); }
From source file:com.flexible.flexibleadapter.helpers.AnimatorHelper.java
/** * Item will slide from Bottom of the screen to its natural position. * * @param animators user defined list of animators * @param view itemView to animate/*from www.ja v a 2 s. c om*/ * @since 5.0.0-b1 */ public static void slideInFromBottomAnimator(@NonNull List<Animator> animators, @NonNull View view, RecyclerView recyclerView) { alphaAnimator(animators, view, 0f); animators.add(ObjectAnimator.ofFloat(view, "translationY", recyclerView.getMeasuredHeight() >> 1, 0)); if (FlexibleAdapter.DEBUG) Log.v(TAG, " Added BOTTOM Animator"); }
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 w w w . ja va 2s . c om 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); } }); }