Example usage for android.animation ObjectAnimator start

List of usage examples for android.animation ObjectAnimator start

Introduction

In this page you can find the example usage for android.animation ObjectAnimator start.

Prototype

@Override
    public void start() 

Source Link

Usage

From source file:org.taurusxi.taurusxicommon.view.drawer.DrawerArrowDrawable.java

public void animateToMain() {
    ObjectAnimator backAnim = ObjectAnimator.ofFloat(this, "parameter", 1f, 0f);
    backAnim.setDuration(500);/*from www .j a v a 2  s .  c  o  m*/
    backAnim.setInterpolator(LINEAR_INTERPOLATOR);
    backAnim.start();
}

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);/*  w ww. ja  v  a2  s . 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);

        }
    });

}

From source file:com.android.tabletcustomui.views.LeftCircleContainer.java

private void animateClockWise(View view) {
    ObjectAnimator animation = ObjectAnimator.ofFloat(view, "rotation", 0.0f, 360f);
    animation.setDuration(3000);/*from  w  w  w  .  j  a v a2  s  .  c  o  m*/
    animation.setInterpolator(new FastOutSlowInInterpolator());
    animation.start();
}

From source file:com.android.tabletcustomui.views.LeftCircleContainer.java

private void animateAntiClockWise(View view) {
    ObjectAnimator animation1 = ObjectAnimator.ofFloat(view, "rotation", 360f, 0.0f);
    animation1.setDuration(3000);/*from   w w  w.  java 2s  . com*/
    animation1.setInterpolator(new FastOutSlowInInterpolator());
    animation1.start();
}

From source file:cn.njmeter.njmeter.widget.spinner.NiceSpinner.java

private void animateArrow(boolean shouldRotateUp) {
    int start = shouldRotateUp ? 0 : MAX_LEVEL;
    int end = shouldRotateUp ? MAX_LEVEL : 0;
    ObjectAnimator animator = ObjectAnimator.ofInt(arrowDrawable, "level", start, end);
    animator.setInterpolator(new LinearOutSlowInInterpolator());
    animator.start();
}

From source file:comm.lib.photoview.PhotoViewActivity.java

private void toggleDownLoadToolbar(final View view) {
    // API 11/* w ww.j a  v  a2s .co  m*/
    if (Build.VERSION.SDK_INT >= 11) {
        if (view.getVisibility() == View.VISIBLE) {
            ObjectAnimator hideAnimator = ObjectAnimator.ofFloat(view, "translationY", view.getTranslationY(),
                    view.getHeight());
            hideAnimator.setDuration(400);
            hideAnimator.start();
            hideAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    view.setVisibility(View.GONE);
                }
            });
        } else {
            view.setVisibility(View.VISIBLE);
            ObjectAnimator showAnimator = ObjectAnimator.ofFloat(view, "translationY", view.getTranslationY(),
                    0);
            showAnimator.setDuration(400);
            showAnimator.start();
        }
    } else {
        if (view.getVisibility() == View.VISIBLE) {
            view.setVisibility(View.GONE);
        } else {
            view.setVisibility(View.VISIBLE);
        }
    }

}

From source file:org.taurusxi.taurusxicommon.view.drawer.DrawerArrowDrawable.java

public void animateToMain(final Animator.AnimatorListener animatorListener) {
    ObjectAnimator backAnim = ObjectAnimator.ofFloat(this, "parameter", 1f, 0f);
    backAnim.setDuration(500);//from   w w  w .  j  av a  2 s.co  m
    backAnim.setInterpolator(LINEAR_INTERPOLATOR);
    backAnim.addListener(animatorListener);
    backAnim.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 source file:ua.yyunikov.android.view.AdditionRemovalListView.java

public void removeWithAnimation(final AdditionRemovalAdapter.Item item, final View itemView) {
    final ObjectAnimator anim = ObjectAnimator.ofFloat(itemView, View.ALPHA, 0);

    anim.setDuration(ANIMATION_TIME);// w  ww.  j  ava 2  s . c o  m
    ViewCompat.setHasTransientState(itemView, true);

    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            remove(item);
            itemView.setAlpha(1);
            ViewCompat.setHasTransientState(itemView, false);
        }
    });
    anim.start();
}

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();
}