Example usage for android.view.animation DecelerateInterpolator DecelerateInterpolator

List of usage examples for android.view.animation DecelerateInterpolator DecelerateInterpolator

Introduction

In this page you can find the example usage for android.view.animation DecelerateInterpolator DecelerateInterpolator.

Prototype

public DecelerateInterpolator() 

Source Link

Usage

From source file:me.xiaopan.android.widget.PullRefreshLayout.java

public ScrollManager(Context context, Bridge bridge, ScrollListener scrollListener) {
    this.animationDuration = context.getResources().getInteger(android.R.integer.config_mediumAnimTime);
    this.bridge = bridge;
    this.scrollListener = scrollListener;
    this.scroller = new Scroller(context, new DecelerateInterpolator());
}

From source file:com.wizardsofm.deskclock.timer.TimerFragment.java

/**
 * @param timerToRemove the timer to be removed during the animation
 *//*from ww  w.j ava 2 s .c o m*/
private void animateTimerRemove(final Timer timerToRemove) {
    final long duration = UiDataModel.getUiDataModel().getShortAnimationDuration();

    final Animator fadeOut = ObjectAnimator.ofFloat(mViewPager, ALPHA, 1, 0);
    fadeOut.setDuration(duration);
    fadeOut.setInterpolator(new DecelerateInterpolator());
    fadeOut.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            DataModel.getDataModel().removeTimer(timerToRemove);
            Events.sendTimerEvent(com.wizardsofm.deskclock.R.string.action_delete,
                    com.wizardsofm.deskclock.R.string.label_deskclock);
        }
    });

    final Animator fadeIn = ObjectAnimator.ofFloat(mViewPager, ALPHA, 0, 1);
    fadeIn.setDuration(duration);
    fadeIn.setInterpolator(new AccelerateInterpolator());

    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(fadeOut).before(fadeIn);
    animatorSet.start();
}

From source file:com.projecttango.examples.java.greenscreen.GreenScreenActivity.java

/**
 * Here is where you would set up your rendering logic. We're replacing it with a minimalistic,
 * dummy example, using a standard GLSurfaceView and a basic renderer, for illustration purposes
 * only.//  w ww.  j  a  va2  s .  com
 */
private void setupRenderer() {
    mSurfaceView.setEGLContextClientVersion(2);
    mRenderer = new GreenScreenRenderer(this, new GreenScreenRenderer.RenderCallback() {

        @Override
        public void preRender() {
            // This is the work that you would do on your main OpenGL render thread.

            // We need to be careful to not run any Tango-dependent code in the
            // OpenGL thread unless we know the Tango Service to be properly set up
            // and connected.
            if (!mIsConnected) {
                return;
            }

            // Synchronize against concurrently disconnecting the service triggered
            // from the UI thread.
            synchronized (GreenScreenActivity.this) {
                // Connect the Tango SDK to the OpenGL texture ID where we are
                // going to render the camera.
                // NOTE: This must be done after both the texture is generated
                // and the Tango Service is connected.
                if (mConnectedTextureIdGlThread != mRenderer.getTextureId()) {
                    mTango.connectTextureId(TangoCameraIntrinsics.TANGO_CAMERA_COLOR, mRenderer.getTextureId());
                    mConnectedTextureIdGlThread = mRenderer.getTextureId();
                    Log.d(TAG, "connected to texture id: " + mRenderer.getTextureId());
                    // Set up scene camera projection to match RGB camera intrinsics.
                    mRenderer.setProjectionMatrix(projectionMatrixFromCameraIntrinsics(mIntrinsics));
                    mRenderer.setCameraIntrinsics(mIntrinsics);
                }
                // If there is a new RGB camera frame available, update the texture and
                // scene camera pose.
                if (mIsFrameAvailableTangoThread.compareAndSet(true, false)) {
                    double depthTimestamp = 0;
                    TangoPointCloudData pointCloud = mPointCloudManager.getLatestPointCloud();
                    if (pointCloud != null) {
                        mRenderer.updatePointCloud(pointCloud);
                        depthTimestamp = pointCloud.timestamp;
                    }
                    try {
                        // {@code mRgbTimestampGlThread} contains the exact timestamp at
                        // which the rendered RGB frame was acquired.
                        mRgbTimestampGlThread = mTango.updateTexture(TangoCameraIntrinsics.TANGO_CAMERA_COLOR);

                        // In the following code, we define t0 as the depth timestamp
                        // and t1 as the color camera timestamp.

                        // Calculate the relative pose between color camera frame at
                        // timestamp color_timestamp t1 and depth.
                        TangoPoseData poseColort1Tdeptht0;
                        poseColort1Tdeptht0 = TangoSupport.calculateRelativePose(mRgbTimestampGlThread,
                                TangoPoseData.COORDINATE_FRAME_CAMERA_COLOR, depthTimestamp,
                                TangoPoseData.COORDINATE_FRAME_CAMERA_DEPTH);
                        if (poseColort1Tdeptht0.statusCode == TangoPoseData.POSE_VALID) {
                            float[] colort1Tdeptht0 = poseToMatrix(poseColort1Tdeptht0);
                            mRenderer.updateModelMatrix(colort1Tdeptht0);
                        } else {
                            Log.w(TAG, "Could not get relative pose from camera depth" + " " + "at "
                                    + depthTimestamp + " to camera color at " + mRgbTimestampGlThread);
                        }
                    } catch (Exception e) {
                        Log.e(TAG, "Exception on the OpenGL thread", e);
                    }
                }
            }
        }

        /**
         * This method is called by the renderer when the screenshot has been taken.
         */
        @Override
        public void onScreenshotTaken(final Bitmap screenshotBitmap) {
            // Give immediate feedback to the user.
            MediaActionSound sound = new MediaActionSound();
            sound.play(MediaActionSound.SHUTTER_CLICK);
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    mPanelFlash.setVisibility(View.VISIBLE);
                    // Run a fade in and out animation of a white screen.
                    ObjectAnimator fadeIn = ObjectAnimator.ofFloat(mPanelFlash, View.ALPHA, 0, 1);
                    fadeIn.setDuration(100);
                    fadeIn.setInterpolator(new DecelerateInterpolator());
                    ObjectAnimator fadeOut = ObjectAnimator.ofFloat(mPanelFlash, View.ALPHA, 1, 0);
                    fadeOut.setInterpolator(new AccelerateInterpolator());
                    fadeOut.setDuration(100);

                    AnimatorSet animation = new AnimatorSet();
                    animation.playSequentially(fadeIn, fadeOut);
                    animation.addListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animation) {
                            mPanelFlash.setVisibility(View.GONE);
                        }
                    });
                    animation.start();
                }
            });
            // Save bitmap to gallery in background.
            new BitmapSaverTask(screenshotBitmap).execute();
        }
    });

    mSurfaceView.setRenderer(mRenderer);
}

From source file:com.stasbar.knowyourself.timer.TimerFragment.java

/**
 * @param timerToRemove the timer to be removed during the animation
 *//*from   w w w .  j a va2 s.c  o  m*/
private void animateTimerRemove(final Timer timerToRemove) {
    final long duration = UiDataModel.getUiDataModel().getShortAnimationDuration();

    final Animator fadeOut = ObjectAnimator.ofFloat(mViewPager, ALPHA, 1, 0);
    fadeOut.setDuration(duration);
    fadeOut.setInterpolator(new DecelerateInterpolator());
    fadeOut.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            LogUtils.d("animateTimerRemove");
            DataModel.getDataModel().removeTimer(timerToRemove);

        }
    });

    final Animator fadeIn = ObjectAnimator.ofFloat(mViewPager, ALPHA, 0, 1);
    fadeIn.setDuration(duration);
    fadeIn.setInterpolator(new AccelerateInterpolator());

    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(fadeOut).before(fadeIn);
    animatorSet.start();
}

From source file:orbin.deskclock.timer.TimerFragment.java

/**
 * @param toView one of {@link #mTimersView} or {@link #mCreateTimerView}
 * @param timerToRemove the timer to be removed during the animation; {@code null} if no timer
 *      should be removed/*www  . jav a  2s.c o  m*/
 */
private void animateToView(View toView, final Timer timerToRemove) {
    if (mCurrentView == toView) {
        throw new IllegalStateException("toView is already the current view");
    }

    final boolean toTimers = toView == mTimersView;

    // Avoid double-taps by enabling/disabling the set of buttons active on the new view.
    updateFab(DISABLE_BUTTONS);

    final long duration = UiDataModel.getUiDataModel().getShortAnimationDuration();
    final Animator rotateFrom = ObjectAnimator.ofFloat(mCurrentView, SCALE_X, 1, 0);
    rotateFrom.setDuration(duration);
    rotateFrom.setInterpolator(new DecelerateInterpolator());
    rotateFrom.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (timerToRemove != null) {
                DataModel.getDataModel().removeTimer(timerToRemove);
                Events.sendTimerEvent(R.string.action_delete, R.string.label_deskclock);
            }

            mCurrentView.setScaleX(1);
            if (toTimers) {
                showTimersView(FAB_AND_BUTTONS_SHRINK_AND_EXPAND);
            } else {
                showCreateTimerView(FAB_AND_BUTTONS_SHRINK_AND_EXPAND);
            }
        }
    });

    final Animator rotateTo = ObjectAnimator.ofFloat(toView, SCALE_X, 0, 1);
    rotateTo.setDuration(duration);
    rotateTo.setInterpolator(new AccelerateInterpolator());

    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(rotateFrom).before(rotateTo);
    animatorSet.start();
}

From source file:org.fossasia.phimpme.leafpic.activities.PlayerActivity.java

private void showSystemBars() {
    int rotation = (((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay()).getRotation();
    if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) { //Landscape
        getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        mediaController.setPaddingRelative(0, 0, 0, 0);
    } else {//  ww  w.  j  ava2  s . c om
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        mediaController.setPaddingRelative(0, 0, 0, Measure.getNavBarHeight(getApplicationContext()));
    }
    toolbar.animate().translationY(Measure.getStatusBarHeight(getResources()))
            .setInterpolator(new DecelerateInterpolator()).setDuration(240).start();
}

From source file:com.horaapps.leafpic.PlayerActivity.java

private void showControls() {
    int rotation = (((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay()).getRotation();
    if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) { //Landscape
        getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        mediaController.setPaddingRelative(0, 0, 0, 0);
    } else {/*from  w  w  w .j  a va  2 s  . c  o  m*/
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        mediaController.setPaddingRelative(0, 0, 0, Measure.getNavBarHeight(getApplicationContext()));
    }

    fullscreen = false;
    mediaController.show();
    toolbar.animate().translationY(Measure.getStatusBarHeight(getResources()))
            .setInterpolator(new DecelerateInterpolator()).setDuration(240).start();

}

From source file:com.ayuget.redface.ui.activity.ReplyActivity.java

/**
 * Smoothly shows the smiley toolbar/*from   w w w .  j  ava 2 s  .c om*/
 */
protected void showSmileysToolbar() {
    smileysToolbar.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
}

From source file:com.ffmpeger.card.ui.BaseNaviActivity.java

protected void onActionBarAutoShowOrHide(boolean shown) {
    if (mStatusBarColorAnimator != null) {
        mStatusBarColorAnimator.cancel();
    }//  w  w w  .java  2 s .  co  m
    mStatusBarColorAnimator = ObjectAnimator
            .ofInt((mDrawerLayout != null) ? mDrawerLayout : getLPreviewUtils(),
                    (mDrawerLayout != null) ? "statusBarBackgroundColor" : "statusBarColor",
                    shown ? Color.BLACK : mNormalStatusBarColor, shown ? mNormalStatusBarColor : Color.BLACK)
            .setDuration(250);
    if (mDrawerLayout != null) {
        mStatusBarColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                ViewCompat.postInvalidateOnAnimation(mDrawerLayout);
            }
        });
    }
    mStatusBarColorAnimator.setEvaluator(ARGB_EVALUATOR);
    mStatusBarColorAnimator.start();

    for (View view : mHideableHeaderViews) {
        if (shown) {
            view.animate().translationY(0).alpha(1).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator());
        } else {
            view.animate().translationY(-view.getBottom()).alpha(0).setDuration(HEADER_HIDE_ANIM_DURATION)
                    .setInterpolator(new DecelerateInterpolator());
        }
    }
}

From source file:ca.zadrox.dota2esportticker.ui.LiveContentView.java

@Override
public void setPlayerItem(int playerSlot, int itemSlot, int resId) {
    ImageView imageView = (ImageView) mPlayerLayouts[playerSlot].findViewById(itemViewIds[itemSlot]);
    switch (resId) {
    case 0:/*from w w w.  ja va 2 s.c  o m*/
        imageView.animate().setDuration(200).alpha(0).setInterpolator(new AccelerateInterpolator());
    default:
        imageView.setImageResource(resId);
        imageView.animate().setDuration(200).alpha(1).setInterpolator(new DecelerateInterpolator());
    }
}