Example usage for android.animation ObjectAnimator ofInt

List of usage examples for android.animation ObjectAnimator ofInt

Introduction

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

Prototype

public static <T> ObjectAnimator ofInt(T target, Property<T, Integer> property, int... values) 

Source Link

Document

Constructs and returns an ObjectAnimator that animates between int values.

Usage

From source file:Main.java

public static void scale(Object v, int scale) {
    ObjectAnimator.ofInt(v, "width", scale).setDuration(duration).start();
}

From source file:Main.java

public static void showBackgroundColorAnimation(View view, int preColor, int currColor, int duration) {
    ObjectAnimator animator = ObjectAnimator.ofInt(view, "backgroundColor", new int[] { preColor, currColor });
    animator.setDuration(duration);/*  w w w .ja  v a2s.co m*/
    animator.setEvaluator(new ArgbEvaluator());
    animator.start();
}

From source file:Main.java

public static void showCardBackgroundColorAnimation(View view, int preColor, int currColor, int duration) {
    ObjectAnimator animator = ObjectAnimator.ofInt(view, "cardBackgroundColor",
            new int[] { preColor, currColor });
    animator.setDuration(duration);//w  ww  .j  a  va  2  s.com
    animator.setEvaluator(new ArgbEvaluator());
    animator.start();
}

From source file:Main.java

public static void showBackgroundColorAnimation(View view, int preColor, int currColor, int duration) {
    ObjectAnimator localObjectAnimator = ObjectAnimator.ofInt(view, "backgroundColor",
            new int[] { preColor, currColor });
    localObjectAnimator.setDuration(duration);
    localObjectAnimator.setEvaluator(new ArgbEvaluator());
    localObjectAnimator.start();//from w  w  w. j a  v a2 s . c  o  m
}

From source file:Main.java

public static Animator moveScrollViewToX(View view, int toX, int time, int delayTime, boolean isStart) {
    ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view, "scrollX", new int[] { toX });
    objectAnimator.setDuration(time);/*from   w ww . j  a  v  a2  s .c  om*/
    objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    objectAnimator.setStartDelay(delayTime);
    if (isStart)
        objectAnimator.start();
    return objectAnimator;
}

From source file:Main.java

public static <T> ObjectAnimator ofArgb(T target, Property<T, Integer> property, int... values) {
    ObjectAnimator animator = ObjectAnimator.ofInt(target, property, values);
    animator.setEvaluator(ARGB_EVALUATOR);
    return animator;
}

From source file:com.karthikb351.vitinfo2.customwidget.ScheduleView.java

public void setAttendance(int attendance) {
    ObjectAnimator animation = ObjectAnimator.ofInt(progressAttendance, "progress", attendance);
    animation.setDuration(1500);/*from  w ww.java2  s.  c om*/
    animation.setInterpolator(new DecelerateInterpolator());
    animation.start();

    if (attendance >= 80) {
        progressAttendance.setReachedBarColor(ContextCompat.getColor(getContext(), R.color.text_secondary));
        progressAttendance.setProgressTextColor(ContextCompat.getColor(getContext(), R.color.text_secondary));
    } else if (attendance < 75) {
        progressAttendance
                .setReachedBarColor(ContextCompat.getColor(getContext(), android.R.color.holo_red_light));
        progressAttendance
                .setProgressTextColor(ContextCompat.getColor(getContext(), android.R.color.holo_red_light));
    } else {
        progressAttendance.setReachedBarColor(ContextCompat.getColor(getContext(), R.color.midAttend));
        progressAttendance.setProgressTextColor(ContextCompat.getColor(getContext(), R.color.midAttend));
    }
}

From source file:com.hannesdorfmann.home.filter.FilterAdapter.java

@Override
public FilterViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
    final FilterViewHolder holder = new FilterViewHolder(
            LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.filter_item, viewGroup, false));

    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override/*w  w w  .j av  a  2s . c om*/
        public void onClick(View v) {
            final int position = holder.getAdapterPosition();
            if (position == RecyclerView.NO_POSITION)
                return;

            final SourceFilterPresentationModel filter = filters.get(position);
            holder.itemView.setHasTransientState(true);
            ObjectAnimator fade = ObjectAnimator.ofInt(holder.filterIcon, ViewUtils.IMAGE_ALPHA,
                    filter.getEnabled() ? FILTER_ICON_DISABLED_ALPHA : FILTER_ICON_ENABLED_ALPHA);
            fade.setDuration(300);
            fade.setInterpolator(AnimationUtils.loadInterpolator(holder.itemView.getContext(),
                    android.R.interpolator.fast_out_slow_in));
            fade.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    holder.itemView.setHasTransientState(false);
                    clickedListener.onSourceFilterClicked(filter);
                }
            });
            fade.start();
        }
    });
    return holder;
}

From source file:com.karthikb351.vitinfo2.fragment.courses.CourseListAdapter.java

public void setAttendance(CourseViewHolder courseViewHolder, int attendance) {
    ObjectAnimator animation = ObjectAnimator.ofInt(courseViewHolder.numberProgressBar, "progress", attendance);
    animation.setDuration(1500);//from  ww  w. j av a 2s.  c  om
    animation.setInterpolator(new DecelerateInterpolator());
    animation.start();

    if (attendance >= 80) {
        courseViewHolder.numberProgressBar
                .setReachedBarColor(ContextCompat.getColor(this.context, R.color.text_secondary));
        courseViewHolder.numberProgressBar
                .setProgressTextColor(ContextCompat.getColor(this.context, R.color.text_secondary));
    } else if (attendance < 75) {
        courseViewHolder.numberProgressBar
                .setReachedBarColor(ContextCompat.getColor(this.context, android.R.color.holo_red_light));
        courseViewHolder.numberProgressBar
                .setProgressTextColor(ContextCompat.getColor(this.context, android.R.color.holo_red_light));
    } else {
        courseViewHolder.numberProgressBar
                .setReachedBarColor(ContextCompat.getColor(this.context, R.color.midAttend));
        courseViewHolder.numberProgressBar
                .setProgressTextColor(ContextCompat.getColor(this.context, R.color.midAttend));
    }
}

From source file:es.wolfi.app.passman.CredentialDisplay.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
        Vault v = (Vault) SingleTon.getTon().getExtra(SettingValues.ACTIVE_VAULT.toString());
        credential = v.findCredentialByGUID(getArguments().getString(CREDENTIAL));
    }/*w w  w  . j ava  2  s .  c  o  m*/

    handler = new Handler();
    otp_refresh = new Runnable() {
        @Override
        public void run() {
            int progress = (int) (System.currentTimeMillis() / 1000) % 30;
            otp_progress.setProgress(progress * 100);

            ObjectAnimator animation = ObjectAnimator.ofInt(otp_progress, "progress", (progress + 1) * 100);
            animation.setDuration(1000);
            animation.setInterpolator(new LinearInterpolator());
            animation.start();

            otp.setText(TOTPHelper.generate(new Base32().decode(credential.getOtp())));
            handler.postDelayed(this, 1000);
        }
    };
}