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.bwgz.quotation.activity.LaunchActivity.java

@Override
protected void onResume() {
    super.onResume();
    Log.d(TAG, String.format("onResume"));

    LinearLayout layout = (LinearLayout) findViewById(R.id.quotation_layout);
    ObjectAnimator animator = ObjectAnimator.ofFloat(layout, "alpha", 0f, 1f);
    animator.setDuration(TimeUnit.SECONDS.toMillis(6));
    animator.start();

    Toast toast = Toast.makeText(this, R.string.launch_message, (int) TimeUnit.SECONDS.toMillis(6));
    toast.show();/*from  ww w .  ja  va 2s  .  c  om*/
}

From source file:com.softminds.matrixcalculator.base_activities.faqs.java

@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
    switch (motionEvent.getAction()) {
    case MotionEvent.ACTION_DOWN:
        ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationZ", 20);
        animator.setDuration(200);//from   w w  w. j a va2  s.  c  o  m
        animator.setInterpolator(new DecelerateInterpolator());
        animator.start();
        view.performClick();
        return true;
    case MotionEvent.ACTION_CANCEL:
    case MotionEvent.ACTION_UP:
        ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationZ", 0);
        animator2.setDuration(200);
        animator2.setInterpolator(new AccelerateInterpolator());
        animator2.start();
        return true;
    default:
        return false;
    }
}

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 .  j av a  2s.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.karthikb351.vitinfo2.fragment.courses.CourseListAdapter.java

public void setAttendance(CourseViewHolder courseViewHolder, int attendance) {
    ObjectAnimator animation = ObjectAnimator.ofInt(courseViewHolder.numberProgressBar, "progress", attendance);
    animation.setDuration(1500);// w ww  .  j a  v  a2s  . co m
    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:com.srinath.hcfab.under25hack.media.MediaFragment.java

public void onFabPressed(View view) {
    final float startX = mFab.getX();

    AnimatorPath path = new AnimatorPath();
    path.moveTo(0, 0);//from w w  w.  jav  a  2 s. c om
    path.curveTo(-200, 200, -400, 100, -600, 50);

    final ObjectAnimator anim = ObjectAnimator.ofObject(this, "fabLoc", new PathEvaluator(),
            path.getPoints().toArray());

    anim.setInterpolator(new AccelerateInterpolator());
    anim.setDuration(ANIMATION_DURATION);
    anim.start();

    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            if (Math.abs(startX - mFab.getX()) > MINIMUN_X_DISTANCE) {
                if (!mRevealFlag) {
                    mFabContainer.setY(mFabContainer.getY() + mFabSize / 2);

                    mFab.animate().scaleXBy(SCALE_FACTOR).scaleYBy(SCALE_FACTOR).setListener(mEndRevealListener)
                            .setDuration(ANIMATION_DURATION);

                    mRevealFlag = true;
                }
            }
        }
    });
}

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 {/*from w  w  w .j  ava2  s .  c o 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:com.mac.SafeWalk.WelcomeActivity.java

public void animate(ImageView dot) {
    if (dot != null) {
        Log.w("WelcomeActivity", "setting up animation");
        ObjectAnimator appear = ObjectAnimator.ofFloat(dot, "alpha", 0f, 1f);
        appear.setRepeatCount(2);//ww  w.j ava  2  s .  c  o  m
        appear.setDuration(2000);
        appear.start();
        ObjectAnimator translation = ObjectAnimator.ofFloat(dot, "translationX", 0, -400f);
        translation.setDuration(2000);
        translation.setRepeatCount(2);
        translation.start();
        Log.w("WelcomeActivity", "starting animation");
    }
}

From source file:com.amaze.filemanager.utils.files.FileUtils.java

public static void revealShow(final View view, boolean reveal) {
    if (reveal) {
        ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 0f, 1f);
        animator.setDuration(300); //ms
        animator.addListener(new AnimatorListenerAdapter() {
            @Override//from w  w w .j a  va  2 s . c o m
            public void onAnimationStart(Animator animation) {
                view.setVisibility(View.VISIBLE);
            }
        });
        animator.start();
    } else {

        ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 1f, 0f);
        animator.setDuration(300); //ms
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.GONE);
            }
        });
        animator.start();
    }
}

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  . ja va2  s .  co  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);
        }
    };
}

From source file:com.h6ah4i.android.example.materialshadowninepatch.ZPositionAnimationDemoFragment.java

@Override
public void onClick(View v) {
    if (v == mCompatShadowItem) {
        ObjectAnimator animator = ObjectAnimator.ofFloat(mCompatShadowItemContainer,
                MaterialShadowContainerViewProperties.SHADOW_TRANSLATION_Z, mDisplayDensity * 0.0f,
                mDisplayDensity * 8.0f);
        animator.setDuration(500);/*  w ww . j av  a2  s.  co  m*/
        animator.setInterpolator(new CycleInterpolator(0.5f));
        animator.start();
    }
}