Example usage for android.view View ALPHA

List of usage examples for android.view View ALPHA

Introduction

In this page you can find the example usage for android.view View ALPHA.

Prototype

Property ALPHA

To view the source code for android.view View ALPHA.

Click Source Link

Document

A Property wrapper around the alpha functionality handled by the View#setAlpha(float) and View#getAlpha() methods.

Usage

From source file:io.plaidapp.ui.DesignerNewsStory.java

private void doFabExpand() {
    // translate the chrome placeholder ui so that it is centered on the FAB
    int fabCenterX = (fab.getLeft() + fab.getRight()) / 2;
    int fabCenterY = ((fab.getTop() + fab.getBottom()) / 2) - fabExpand.getTop();
    int translateX = fabCenterX - (fabExpand.getWidth() / 2);
    int translateY = fabCenterY - (fabExpand.getHeight() / 2);
    fabExpand.setTranslationX(translateX);
    fabExpand.setTranslationY(translateY);

    // then reveal the placeholder ui, starting from the center & same dimens as fab
    fabExpand.setVisibility(View.VISIBLE);
    Animator reveal = ViewAnimationUtils
            .createCircularReveal(fabExpand, fabExpand.getWidth() / 2, fabExpand.getHeight() / 2,
                    fab.getWidth() / 2, (int) Math.hypot(fabExpand.getWidth() / 2, fabExpand.getHeight() / 2))
            .setDuration(fabExpandDuration);

    // translate the placeholder ui back into position along an arc
    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumVerticalAngle(70f);
    Path motionPath = arcMotion.getPath(translateX, translateY, 0, 0);
    Animator position = ObjectAnimator.ofFloat(fabExpand, View.TRANSLATION_X, View.TRANSLATION_Y, motionPath)
            .setDuration(fabExpandDuration);

    // animate from the FAB colour to the placeholder background color
    Animator background = ObjectAnimator
            .ofArgb(fabExpand, ViewUtils.BACKGROUND_COLOR, ContextCompat.getColor(this, R.color.designer_news),
                    ContextCompat.getColor(this, R.color.background_light))
            .setDuration(fabExpandDuration);

    // fade out the fab (rapidly)
    Animator fadeOutFab = ObjectAnimator.ofFloat(fab, View.ALPHA, 0f).setDuration(60);

    // play 'em all together with the material interpolator
    AnimatorSet show = new AnimatorSet();
    show.setInterpolator(//from   w ww .ja va2  s .c o  m
            AnimationUtils.loadInterpolator(DesignerNewsStory.this, android.R.interpolator.fast_out_slow_in));
    show.playTogether(reveal, background, position, fadeOutFab);
    show.start();
}

From source file:io.plaidapp.ui.DesignerNewsStory.java

private void doFabExpand() {
    // translate the chrome placeholder ui so that it is centered on the FAB
    int fabCenterX = (fab.getLeft() + fab.getRight()) / 2;
    int fabCenterY = ((fab.getTop() + fab.getBottom()) / 2) - fabExpand.getTop();
    int translateX = fabCenterX - (fabExpand.getWidth() / 2);
    int translateY = fabCenterY - (fabExpand.getHeight() / 2);
    fabExpand.setTranslationX(translateX);
    fabExpand.setTranslationY(translateY);

    // then reveal the placeholder ui, starting from the center & same dimens as fab
    fabExpand.setVisibility(View.VISIBLE);
    Animator reveal = ViewAnimationUtils
            .createCircularReveal(fabExpand, fabExpand.getWidth() / 2, fabExpand.getHeight() / 2,
                    fab.getWidth() / 2, (int) Math.hypot(fabExpand.getWidth() / 2, fabExpand.getHeight() / 2))
            .setDuration(fabExpandDuration);

    // translate the placeholder ui back into position along an arc
    GravityArcMotion arcMotion = new GravityArcMotion();
    arcMotion.setMinimumVerticalAngle(70f);
    Path motionPath = arcMotion.getPath(translateX, translateY, 0, 0);
    Animator position = ObjectAnimator.ofFloat(fabExpand, View.TRANSLATION_X, View.TRANSLATION_Y, motionPath)
            .setDuration(fabExpandDuration);

    // animate from the FAB colour to the placeholder background color
    Animator background = ObjectAnimator
            .ofArgb(fabExpand, ViewUtils.BACKGROUND_COLOR, ContextCompat.getColor(this, R.color.designer_news),
                    ContextCompat.getColor(this, R.color.background_light))
            .setDuration(fabExpandDuration);

    // fade out the fab (rapidly)
    Animator fadeOutFab = ObjectAnimator.ofFloat(fab, View.ALPHA, 0f).setDuration(60);

    // play 'em all together with the material interpolator
    AnimatorSet show = new AnimatorSet();
    show.setInterpolator(getFastOutSlowInInterpolator(DesignerNewsStory.this));
    show.playTogether(reveal, background, position, fadeOutFab);
    show.start();/*from   ww w.  j  av a  2s.  c  o  m*/
}

From source file:io.plaidapp.designernews.ui.story.StoryActivity.java

private void doFabExpand() {
    // translate the chrome placeholder ui so that it is centered on the FAB
    int fabCenterX = (fab.getLeft() + fab.getRight()) / 2;
    int fabCenterY = ((fab.getTop() + fab.getBottom()) / 2) - fabExpand.getTop();
    int translateX = fabCenterX - (fabExpand.getWidth() / 2);
    int translateY = fabCenterY - (fabExpand.getHeight() / 2);
    fabExpand.setTranslationX(translateX);
    fabExpand.setTranslationY(translateY);

    // then reveal the placeholder ui, starting from the center & same dimens as fab
    fabExpand.setVisibility(View.VISIBLE);
    Animator reveal = ViewAnimationUtils
            .createCircularReveal(fabExpand, fabExpand.getWidth() / 2, fabExpand.getHeight() / 2,
                    fab.getWidth() / 2, (int) Math.hypot(fabExpand.getWidth() / 2, fabExpand.getHeight() / 2))
            .setDuration(fabExpandDuration);

    // translate the placeholder ui back into position along an arc
    GravityArcMotion arcMotion = new GravityArcMotion();
    arcMotion.setMinimumVerticalAngle(70f);
    Path motionPath = arcMotion.getPath(translateX, translateY, 0, 0);
    Animator position = ObjectAnimator.ofFloat(fabExpand, View.TRANSLATION_X, View.TRANSLATION_Y, motionPath)
            .setDuration(fabExpandDuration);

    // animate from the FAB colour to the placeholder background color
    Animator background = ObjectAnimator
            .ofArgb(fabExpand, ViewUtils.BACKGROUND_COLOR,
                    ContextCompat.getColor(this, io.plaidapp.R.color.designer_news),
                    ContextCompat.getColor(this, io.plaidapp.R.color.background_light))
            .setDuration(fabExpandDuration);

    // fade out the fab (rapidly)
    Animator fadeOutFab = ObjectAnimator.ofFloat(fab, View.ALPHA, 0f).setDuration(60);

    // play 'em all together with the material interpolator
    AnimatorSet show = new AnimatorSet();
    show.setInterpolator(getFastOutSlowInInterpolator(StoryActivity.this));
    show.playTogether(reveal, background, position, fadeOutFab);
    show.start();/* ww w  .  j ava 2  s. co  m*/
}

From source file:com.pitchedapps.primenumbercalculator.Calculator.java

License:asdf

private void reveal(View sourceView, AnimatorListener listener) {
    final ViewGroupOverlay groupOverlay = (ViewGroupOverlay) getWindow().getDecorView().getOverlay();

    final Rect displayRect = new Rect();
    mDisplayView.getGlobalVisibleRect(displayRect);

    // Make reveal cover the display and status bar.
    final View revealView = new View(this);
    revealView.setBottom(displayRect.bottom);
    revealView.setLeft(displayRect.left);
    revealView.setRight(displayRect.right);
    revealView.setBackgroundColor(themeClearAccent);
    groupOverlay.add(revealView);/*from   w w w  .  j  a  va 2  s .  c o m*/

    final int[] clearLocation = new int[2];
    sourceView.getLocationInWindow(clearLocation);
    clearLocation[0] += sourceView.getWidth() / 2;
    clearLocation[1] += sourceView.getHeight() / 2;

    final int revealCenterX = clearLocation[0] - revealView.getLeft();
    final int revealCenterY = clearLocation[1] - revealView.getTop();

    final double x1_2 = Math.pow(revealView.getLeft() - revealCenterX, 2);
    final double x2_2 = Math.pow(revealView.getRight() - revealCenterX, 2);
    final double y_2 = Math.pow(revealView.getTop() - revealCenterY, 2);
    final float revealRadius = (float) Math.max(Math.sqrt(x1_2 + y_2), Math.sqrt(x2_2 + y_2));

    final Animator revealAnimator = ViewAnimationUtils.createCircularReveal(revealView, revealCenterX,
            revealCenterY, 0.0f, revealRadius);
    revealAnimator.setDuration(getResources().getInteger(android.R.integer.config_longAnimTime));

    final Animator alphaAnimator = ObjectAnimator.ofFloat(revealView, View.ALPHA, 0.0f);
    alphaAnimator.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime));
    alphaAnimator.addListener(listener);

    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(revealAnimator).before(alphaAnimator);
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animator) {
            groupOverlay.remove(revealView);
            mCurrentAnimator = null;
        }
    });

    mCurrentAnimator = animatorSet;
    animatorSet.start();
}

From source file:com.google.android.apps.muzei.MuzeiActivity.java

private void updateUiMode() {
    // TODO: this should really just use fragment transactions and transitions

    int newUiMode = UI_MODE_INTRO;
    if (mWallpaperActive) {
        newUiMode = UI_MODE_TUTORIAL;/*from w w  w. ja  va  2s . c o  m*/
        if (mSeenTutorial) {
            newUiMode = UI_MODE_ART_DETAIL;
        }
    }

    if (mUiMode == newUiMode) {
        return;
    }

    // Crossfade between main containers
    final View oldContainerView = getMainContainerForUiMode(mUiMode);
    final View newContainerView = getMainContainerForUiMode(newUiMode);

    if (oldContainerView != null) {
        oldContainerView.animate().alpha(0).setDuration(1000).withEndAction(new Runnable() {
            @Override
            public void run() {
                oldContainerView.setVisibility(View.GONE);
            }
        });
    }

    if (newContainerView != null) {
        if (newContainerView.getAlpha() == 1) {
            newContainerView.setAlpha(0);
        }
        newContainerView.setVisibility(View.VISIBLE);
        newContainerView.animate().alpha(1).setDuration(1000).withEndAction(null);
    }

    // Special work
    if (newUiMode == UI_MODE_INTRO) {
        final View activateButton = findViewById(R.id.activate_muzei_button);
        activateButton.setAlpha(0);
        final AnimatedMuzeiLogoFragment logoFragment = (AnimatedMuzeiLogoFragment) getFragmentManager()
                .findFragmentById(R.id.animated_logo_fragment);
        logoFragment.reset();
        logoFragment.setOnFillStartedCallback(new Runnable() {
            @Override
            public void run() {
                activateButton.animate().alpha(1f).setDuration(500);
            }
        });
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                logoFragment.start();
            }
        }, 1000);
    }

    if (mUiMode == UI_MODE_INTRO || newUiMode == UI_MODE_INTRO) {
        FragmentManager fm = getSupportFragmentManager();
        Fragment demoFragment = fm.findFragmentById(R.id.demo_view_container);
        if (newUiMode == UI_MODE_INTRO && demoFragment == null) {
            fm.beginTransaction()
                    .add(R.id.demo_view_container, MuzeiRendererFragment.createInstance(true, true)).commit();
        } else if (newUiMode != UI_MODE_INTRO && demoFragment != null) {
            fm.beginTransaction().remove(demoFragment).commit();
        }
    }

    if (newUiMode == UI_MODE_TUTORIAL) {
        float animateDistance = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100,
                getResources().getDisplayMetrics());
        View mainTextView = findViewById(R.id.tutorial_main_text);
        mainTextView.setAlpha(0);
        mainTextView.setTranslationY(-animateDistance / 5);

        View subTextView = findViewById(R.id.tutorial_sub_text);
        subTextView.setAlpha(0);
        subTextView.setTranslationY(-animateDistance / 5);

        final View affordanceView = findViewById(R.id.tutorial_icon_affordance);
        affordanceView.setAlpha(0);
        affordanceView.setTranslationY(animateDistance);

        View iconTextView = findViewById(R.id.tutorial_icon_text);
        iconTextView.setAlpha(0);
        iconTextView.setTranslationY(animateDistance);

        AnimatorSet set = new AnimatorSet();
        set.setStartDelay(500);
        set.setDuration(250);
        set.playTogether(ObjectAnimator.ofFloat(mainTextView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(subTextView, View.ALPHA, 1f));
        set.start();

        set = new AnimatorSet();
        set.setStartDelay(2000);

        // Bug in older versions where set.setInterpolator didn't work
        Interpolator interpolator = new OvershootInterpolator();
        ObjectAnimator a1 = ObjectAnimator.ofFloat(affordanceView, View.TRANSLATION_Y, 0);
        ObjectAnimator a2 = ObjectAnimator.ofFloat(iconTextView, View.TRANSLATION_Y, 0);
        ObjectAnimator a3 = ObjectAnimator.ofFloat(mainTextView, View.TRANSLATION_Y, 0);
        ObjectAnimator a4 = ObjectAnimator.ofFloat(subTextView, View.TRANSLATION_Y, 0);
        a1.setInterpolator(interpolator);
        a2.setInterpolator(interpolator);
        a3.setInterpolator(interpolator);
        a4.setInterpolator(interpolator);
        set.setDuration(500).playTogether(ObjectAnimator.ofFloat(affordanceView, View.ALPHA, 1f),
                ObjectAnimator.ofFloat(iconTextView, View.ALPHA, 1f), a1, a2, a3, a4);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            set.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    ImageView emanateView = (ImageView) findViewById(R.id.tutorial_icon_emanate);
                    AnimatedVectorDrawable avd = (AnimatedVectorDrawable) getResources()
                            .getDrawable(R.drawable.avd_tutorial_icon_emanate, getTheme());
                    emanateView.setImageDrawable(avd);
                    avd.start();
                }
            });
        }
        set.start();
    }

    mPanScaleProxyView.setVisibility(newUiMode == UI_MODE_ART_DETAIL ? View.VISIBLE : View.GONE);

    mUiMode = newUiMode;

    maybeUpdateArtDetailOpenedClosed();
}

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./*from   w w w .  j  a v  a 2 s.  c  o m*/
 */
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.androidinspain.deskclock.alarms.dataadapter.ExpandedAlarmViewHolder.java

private Animator createExpandingAnimator(AlarmItemViewHolder oldHolder, long duration) {
    final View oldView = oldHolder.itemView;
    final View newView = itemView;
    final Animator boundsAnimator = AnimatorUtils.getBoundsAnimator(newView, oldView, newView);
    boundsAnimator.setDuration(duration);
    boundsAnimator.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN);

    final Animator backgroundAnimator = ObjectAnimator.ofPropertyValuesHolder(newView,
            PropertyValuesHolder.ofInt(AnimatorUtils.BACKGROUND_ALPHA, 0, 255));
    backgroundAnimator.setDuration(duration);

    final View oldArrow = oldHolder.arrow;
    final Rect oldArrowRect = new Rect(0, 0, oldArrow.getWidth(), oldArrow.getHeight());
    final Rect newArrowRect = new Rect(0, 0, arrow.getWidth(), arrow.getHeight());
    ((ViewGroup) newView).offsetDescendantRectToMyCoords(arrow, newArrowRect);
    ((ViewGroup) oldView).offsetDescendantRectToMyCoords(oldArrow, oldArrowRect);
    final float arrowTranslationY = oldArrowRect.bottom - newArrowRect.bottom;

    arrow.setTranslationY(arrowTranslationY);
    arrow.setVisibility(View.VISIBLE);
    clock.setVisibility(View.VISIBLE);
    onOff.setVisibility(View.VISIBLE);

    final long longDuration = (long) (duration * ANIM_LONG_DURATION_MULTIPLIER);
    final Animator repeatAnimation = ObjectAnimator.ofFloat(repeat, View.ALPHA, 1f).setDuration(longDuration);
    final Animator repeatDaysAnimation = ObjectAnimator.ofFloat(repeatDays, View.ALPHA, 1f)
            .setDuration(longDuration);/*from   w w w .  j a v a2s .  com*/
    final Animator ringtoneAnimation = ObjectAnimator.ofFloat(ringtone, View.ALPHA, 1f)
            .setDuration(longDuration);
    final Animator dismissAnimation = ObjectAnimator.ofFloat(preemptiveDismissButton, View.ALPHA, 1f)
            .setDuration(longDuration);
    final Animator vibrateAnimation = ObjectAnimator.ofFloat(vibrate, View.ALPHA, 1f).setDuration(longDuration);
    final Animator editLabelAnimation = ObjectAnimator.ofFloat(editLabel, View.ALPHA, 1f)
            .setDuration(longDuration);
    final Animator hairLineAnimation = ObjectAnimator.ofFloat(hairLine, View.ALPHA, 1f)
            .setDuration(longDuration);
    final Animator deleteAnimation = ObjectAnimator.ofFloat(delete, View.ALPHA, 1f).setDuration(longDuration);
    final Animator arrowAnimation = ObjectAnimator.ofFloat(arrow, View.TRANSLATION_Y, 0f).setDuration(duration);
    arrowAnimation.setInterpolator(AnimatorUtils.INTERPOLATOR_FAST_OUT_SLOW_IN);

    // Set the stagger delays; delay the first by the amount of time it takes for the collapse
    // to complete, then stagger the expansion with the remaining time.
    long startDelay = (long) (duration * ANIM_STANDARD_DELAY_MULTIPLIER);
    final int numberOfItems = countNumberOfItems();
    final long delayIncrement = (long) (duration * ANIM_SHORT_DELAY_INCREMENT_MULTIPLIER) / (numberOfItems - 1);
    repeatAnimation.setStartDelay(startDelay);
    startDelay += delayIncrement;
    final boolean daysVisible = repeatDays.getVisibility() == View.VISIBLE;
    if (daysVisible) {
        repeatDaysAnimation.setStartDelay(startDelay);
        startDelay += delayIncrement;
    }
    ringtoneAnimation.setStartDelay(startDelay);
    vibrateAnimation.setStartDelay(startDelay);
    startDelay += delayIncrement;
    editLabelAnimation.setStartDelay(startDelay);
    startDelay += delayIncrement;
    hairLineAnimation.setStartDelay(startDelay);
    if (preemptiveDismissButton.getVisibility() == View.VISIBLE) {
        dismissAnimation.setStartDelay(startDelay);
        startDelay += delayIncrement;
    }
    deleteAnimation.setStartDelay(startDelay);

    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(backgroundAnimator, repeatAnimation, boundsAnimator, repeatDaysAnimation,
            vibrateAnimation, ringtoneAnimation, editLabelAnimation, deleteAnimation, hairLineAnimation,
            dismissAnimation, arrowAnimation);
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animator) {
            AnimatorUtils.startDrawableAnimation(arrow);
        }
    });
    return animatorSet;
}

From source file:org.chromium.chrome.browser.payments.ui.EditorView.java

@Override
public void onShow(DialogInterface dialog) {
    assert mDialogInOutAnimator == null;

    // Hide keyboard and disable EditText views for animation efficiency.
    if (getCurrentFocus() != null)
        UiUtils.hideKeyboard(getCurrentFocus());
    for (int i = 0; i < mEditableTextFields.size(); i++) {
        mEditableTextFields.get(i).setEnabled(false);
    }/*w  w  w.j  a  v  a 2 s .c o  m*/

    mLayout.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    mLayout.buildLayer();
    Animator popUp = ObjectAnimator.ofFloat(mLayout, View.TRANSLATION_Y, mLayout.getHeight(), 0f);
    Animator fadeIn = ObjectAnimator.ofFloat(mLayout, View.ALPHA, 0f, 1f);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(popUp, fadeIn);

    mDialogInOutAnimator = animatorSet;
    mDialogInOutAnimator.setDuration(DIALOG_ENTER_ANIMATION_MS);
    mDialogInOutAnimator.setInterpolator(new LinearOutSlowInInterpolator());
    mDialogInOutAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mLayout.setLayerType(View.LAYER_TYPE_NONE, null);
            for (int i = 0; i < mEditableTextFields.size(); i++) {
                mEditableTextFields.get(i).setEnabled(true);
            }
            // Note that keyboard will not show for dropdown field since it's not necessary.
            if (getCurrentFocus() != null)
                UiUtils.showKeyboard(getCurrentFocus());
            mDialogInOutAnimator = null;
            initFocus();
        }
    });

    mDialogInOutAnimator.start();
}

From source file:com.android.deskclock.timer.TimerFullScreenFragment.java

private Animator getRevealAnimator(View source, int revealColor) {
    final ViewGroup containerView = (ViewGroup) source.getRootView().findViewById(android.R.id.content);

    final Rect sourceBounds = new Rect(0, 0, source.getHeight(), source.getWidth());
    containerView.offsetDescendantRectToMyCoords(source, sourceBounds);

    final int centerX = sourceBounds.centerX();
    final int centerY = sourceBounds.centerY();

    final int xMax = Math.max(centerX, containerView.getWidth() - centerX);
    final int yMax = Math.max(centerY, containerView.getHeight() - centerY);

    final float startRadius = Math.max(sourceBounds.width(), sourceBounds.height()) / 2.0f;
    final float endRadius = (float) Math.sqrt(xMax * xMax + yMax * yMax);

    final CircleView revealView = new CircleView(source.getContext()).setCenterX(centerX).setCenterY(centerY)
            .setFillColor(revealColor);//  ww w. j  ava 2 s.c  om
    containerView.addView(revealView);

    final Animator revealAnimator = ObjectAnimator.ofFloat(revealView, CircleView.RADIUS, startRadius,
            endRadius);
    revealAnimator.setInterpolator(PathInterpolatorCompat.create(0.0f, 0.0f, 0.2f, 1.0f));

    final ValueAnimator fadeAnimator = ObjectAnimator.ofFloat(revealView, View.ALPHA, 0.0f);
    fadeAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            containerView.removeView(revealView);
        }
    });

    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(TimerFragment.ANIMATION_TIME_MILLIS);
    animatorSet.playSequentially(revealAnimator, fadeAnimator);

    return revealAnimator;
}

From source file:com.mishiranu.dashchan.ui.navigator.NavigatorActivity.java

private void performNavigation(final PageHolder.Content content, final String chanName, final String boardName,
        final String threadNumber, final String postNumber, final String threadTitle, final String searchQuery,
        final boolean fromCache, boolean animated, final boolean returnable) {
    PageHolder pageHolder = pageManager.getCurrentPage();
    if (pageHolder != null && pageHolder.is(chanName, boardName, threadNumber, content)
            && searchQuery == null) {
        // Page could be deleted from stack during clearStack (when home button pressed, for example)
        pageHolder.returnable &= returnable;
        pageManager.moveCurrentPageTop();
        page.updatePageConfiguration(postNumber, threadTitle);
        drawerForm.invalidateItems(true, false);
        invalidateHomeUpState();/*from   ww w .ja v a  2 s  .c  o m*/
        return;
    }
    switchView(ListPage.ViewType.LIST, null);
    listView.getWrapper().cancelBusyState();
    listView.getWrapper().setPullSides(PullableWrapper.Side.NONE);
    ClickableToast.cancel(this);
    requestStoreExtraAndPosition();
    cleanupPage();
    handler.removeCallbacks(queuedHandler);
    setActionBarLocked(LOCKER_HANDLE, true);
    if (animated) {
        queuedHandler = () -> {
            queuedHandler = null;
            if (listView.getAnimation() != null) {
                listView.getAnimation().cancel();
            }
            listView.setAlpha(1f);
            handleDataAfterAnimation(content, chanName, boardName, threadNumber, postNumber, threadTitle,
                    searchQuery, fromCache, true, returnable);
        };
        handler.postDelayed(queuedHandler, 300);
        ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(listView, View.ALPHA, 1f, 0f);
        alphaAnimator.setupStartValues();
        alphaAnimator.setStartDelay(150);
        alphaAnimator.setDuration(150);
        startListAnimator(alphaAnimator);
    } else {
        handleDataAfterAnimation(content, chanName, boardName, threadNumber, postNumber, threadTitle,
                searchQuery, fromCache, false, returnable);
    }
}