Example usage for android.view ViewGroup animate

List of usage examples for android.view ViewGroup animate

Introduction

In this page you can find the example usage for android.view ViewGroup animate.

Prototype

public ViewPropertyAnimator animate() 

Source Link

Document

This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View.

Usage

From source file:io.digibyte.tools.animation.BRAnimator.java

public static void animateSignalSlide(ViewGroup signalLayout, final boolean reverse,
        final OnSlideAnimationEnd listener) {
    float translationY = signalLayout.getTranslationY();
    float signalHeight = signalLayout.getHeight();
    signalLayout.setTranslationY(reverse ? translationY : translationY + signalHeight);

    signalLayout.animate().translationY(reverse ? BreadActivity.screenParametersPoint.y : translationY)
            .setDuration(SLIDE_ANIMATION_DURATION)
            .setInterpolator(reverse ? new DecelerateInterpolator() : new OvershootInterpolator(0.7f))
            .setListener(new AnimatorListenerAdapter() {
                @Override//from   w w w  .  j av  a  2s  .  c o  m
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    if (listener != null)
                        listener.onAnimationEnd();
                }
            });

}

From source file:android.support.wear.widget.drawer.WearableDrawerLayout.java

private static void animatePeekVisibleAfterBeingClosed(WearableDrawerView drawer) {
    final View content = drawer.getDrawerContent();
    if (content != null) {
        content.animate().setDuration(PEEK_FADE_DURATION_MS).alpha(0).withEndAction(new Runnable() {
            @Override// ww w .  j av a  2  s . c  o m
            public void run() {
                content.setVisibility(GONE);
            }
        }).start();
    }

    ViewGroup peek = drawer.getPeekContainer();
    peek.setVisibility(VISIBLE);
    peek.animate().setStartDelay(PEEK_FADE_DURATION_MS).setDuration(PEEK_FADE_DURATION_MS).alpha(1).scaleX(1)
            .scaleY(1).start();

    drawer.setIsPeeking(true);
}

From source file:com.google.android.apps.muzei.settings.SettingsActivity.java

private void updateRenderLocally(boolean renderLocally) {
    if (mRenderLocally == renderLocally) {
        return;//from w  w w .j a v  a 2 s  .  c o m
    }

    mRenderLocally = renderLocally;

    final View uiContainer = findViewById(R.id.container);
    final ViewGroup localRenderContainer = (ViewGroup) findViewById(R.id.local_render_container);

    FragmentManager fm = getSupportFragmentManager();
    Fragment localRenderFragment = fm.findFragmentById(R.id.local_render_container);
    if (mRenderLocally) {
        if (localRenderFragment == null) {
            fm.beginTransaction()
                    .add(R.id.local_render_container, MuzeiRendererFragment.createInstance(false, false))
                    .commit();
        }
        if (localRenderContainer.getAlpha() == 1) {
            localRenderContainer.setAlpha(0);
        }
        localRenderContainer.setVisibility(View.VISIBLE);
        localRenderContainer.animate().alpha(1).setDuration(2000).withEndAction(null);
        uiContainer.setBackgroundColor(0x00000000); // for ripple touch feedback
    } else {
        if (localRenderFragment != null) {
            fm.beginTransaction().remove(localRenderFragment).commit();
        }
        localRenderContainer.animate().alpha(0).setDuration(1000).withEndAction(new Runnable() {
            @Override
            public void run() {
                localRenderContainer.setVisibility(View.GONE);
            }
        });
        uiContainer.setBackground(null);
    }
}