Search in sources :

Example 76 with Animation

use of android.view.animation.Animation in project weex-example by KalicyZhou.

the class SplashActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    View textView = findViewById(R.id.fullscreen_content);
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.addAnimation(scaleAnimation);
    animationSet.setDuration(1000);
    animationSet.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            startMainActivity();
            finish();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    textView.startAnimation(animationSet);
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) View(android.view.View) AnimationSet(android.view.animation.AnimationSet) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 77 with Animation

use of android.view.animation.Animation in project SectionCursorAdapter by twotoasters.

the class ToastersAdapter method switchWithoutAnimation.

private void switchWithoutAnimation(ViewSwitcher switcher) {
    if (switcher.getDisplayedChild() != 0) {
        Animation in = switcher.getInAnimation();
        Animation out = switcher.getOutAnimation();
        switcher.setInAnimation(null);
        switcher.setOutAnimation(null);
        switcher.setDisplayedChild(0);
        switcher.setInAnimation(in);
        switcher.setOutAnimation(out);
    }
    ;
}
Also used : Animation(android.view.animation.Animation)

Example 78 with Animation

use of android.view.animation.Animation in project Lightning-Browser by anthonycr.

the class BrowserActivity method hideActionBar.

/**
     * Hide the ActionBar using an animation if we are in full-screen
     * mode. This method also re-parents the ActionBar if its parent is
     * incorrect so that the animation can happen correctly.
     */
@Override
public void hideActionBar() {
    if (mFullScreen) {
        if (mToolbarLayout == null || mBrowserFrame == null)
            return;
        final int height = mToolbarLayout.getHeight();
        if (mToolbarLayout.getTranslationY() > -0.01f) {
            Animation show = new Animation() {

                @Override
                protected void applyTransformation(float interpolatedTime, Transformation t) {
                    float trans = interpolatedTime * height;
                    mToolbarLayout.setTranslationY(-trans);
                    setWebViewTranslation(height - trans);
                }
            };
            show.setDuration(250);
            show.setInterpolator(new BezierDecelerateInterpolator());
            mBrowserFrame.startAnimation(show);
        }
    }
}
Also used : Transformation(android.view.animation.Transformation) BezierDecelerateInterpolator(acr.browser.lightning.interpolator.BezierDecelerateInterpolator) Animation(android.view.animation.Animation)

Example 79 with Animation

use of android.view.animation.Animation in project Lightning-Browser by anthonycr.

the class BrowserActivity method changeToolbarBackground.

/**
     * Animates the color of the toolbar from one color to another. Optionally animates
     * the color of the tab background, for use when the tabs are displayed on the top
     * of the screen.
     *
     * @param favicon       the Bitmap to extract the color from
     * @param tabBackground the optional LinearLayout to color
     */
@Override
public void changeToolbarBackground(@NonNull Bitmap favicon, @Nullable final Drawable tabBackground) {
    final int defaultColor = ContextCompat.getColor(this, R.color.primary_color);
    if (mCurrentUiColor == Color.BLACK) {
        mCurrentUiColor = defaultColor;
    }
    Palette.from(favicon).generate(new Palette.PaletteAsyncListener() {

        @Override
        public void onGenerated(Palette palette) {
            // OR with opaque black to remove transparency glitches
            int color = 0xff000000 | palette.getVibrantColor(defaultColor);
            // Lighten up the dark color if it is
            final int finalColor;
            // too dark
            if (!mShowTabsInDrawer || Utils.isColorTooDark(color)) {
                finalColor = Utils.mixTwoColors(defaultColor, color, 0.25f);
            } else {
                finalColor = color;
            }
            final Window window = getWindow();
            if (!mShowTabsInDrawer) {
                window.setBackgroundDrawable(new ColorDrawable(Color.BLACK));
            }
            final int startSearchColor = getSearchBarColor(mCurrentUiColor, defaultColor);
            final int finalSearchColor = getSearchBarColor(finalColor, defaultColor);
            Animation animation = new Animation() {

                @Override
                protected void applyTransformation(float interpolatedTime, Transformation t) {
                    final int color = DrawableUtils.mixColor(interpolatedTime, mCurrentUiColor, finalColor);
                    if (mShowTabsInDrawer) {
                        mBackground.setColor(color);
                        Handlers.MAIN.post(new Runnable() {

                            @Override
                            public void run() {
                                window.setBackgroundDrawable(mBackground);
                            }
                        });
                    } else if (tabBackground != null) {
                        tabBackground.setColorFilter(color, PorterDuff.Mode.SRC_IN);
                    }
                    mCurrentUiColor = color;
                    mToolbarLayout.setBackgroundColor(color);
                    mSearchBackground.getBackground().setColorFilter(DrawableUtils.mixColor(interpolatedTime, startSearchColor, finalSearchColor), PorterDuff.Mode.SRC_IN);
                }
            };
            animation.setDuration(300);
            mToolbarLayout.startAnimation(animation);
        }
    });
}
Also used : Window(android.view.Window) Palette(android.support.v7.graphics.Palette) Transformation(android.view.animation.Transformation) ColorDrawable(android.graphics.drawable.ColorDrawable) Animation(android.view.animation.Animation)

Example 80 with Animation

use of android.view.animation.Animation in project wire-android by wireapp.

the class PendingConnectRequestFragment method onCreateAnimation.

//////////////////////////////////////////////////////////////////////////////////////////
//
//  Lifecycle
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
    Animation animation = super.onCreateAnimation(transit, enter, nextAnim);
    if (getControllerFactory().getConversationScreenController().getPopoverLaunchMode() != DialogLaunchMode.AVATAR && getControllerFactory().getConversationScreenController().getPopoverLaunchMode() != DialogLaunchMode.COMMON_USER) {
        // No animation when request is shown in conversation list
        IConnectStore.UserRequester userRequester = IConnectStore.UserRequester.valueOf(getArguments().getString(ARGUMENT_USER_REQUESTER));
        if (userRequester != IConnectStore.UserRequester.CONVERSATION || isBelowUserProfile) {
            int centerX = ViewUtils.getOrientationIndependentDisplayWidth(getActivity()) / 2;
            int centerY = ViewUtils.getOrientationIndependentDisplayHeight(getActivity()) / 2;
            int duration;
            int delay = 0;
            if (isBelowUserProfile) {
                if (LayoutSpec.isTablet(getActivity())) {
                    animation = new ProfileTabletAnimation(enter, getResources().getInteger(R.integer.framework_animation_duration_long), -getResources().getDimensionPixelSize(R.dimen.participant_dialog__initial_width));
                } else {
                    if (enter) {
                        isBelowUserProfile = false;
                        duration = getResources().getInteger(R.integer.reopen_profile_source__animation_duration);
                        delay = getResources().getInteger(R.integer.reopen_profile_source__delay);
                    } else {
                        duration = getResources().getInteger(R.integer.reopen_profile_source__animation_duration);
                    }
                    animation = new ProfileSourceAnimation(enter, duration, delay, centerX, centerY);
                }
            } else if (nextAnim != 0) {
                if (LayoutSpec.isTablet(getActivity())) {
                    animation = new ProfileTabletAnimation(enter, getResources().getInteger(R.integer.framework_animation_duration_long), getResources().getDimensionPixelSize(R.dimen.participant_dialog__initial_width));
                } else {
                    if (enter) {
                        duration = getResources().getInteger(R.integer.open_profile__animation_duration);
                        delay = getResources().getInteger(R.integer.open_profile__delay);
                    } else {
                        duration = getResources().getInteger(R.integer.close_profile__animation_duration);
                    }
                    animation = new ProfileAnimation(enter, duration, delay, centerX, centerY);
                }
            }
        }
    }
    return animation;
}
Also used : ProfileTabletAnimation(com.waz.zclient.pages.main.participants.ProfileTabletAnimation) ProfileAnimation(com.waz.zclient.pages.main.participants.ProfileAnimation) IConnectStore(com.waz.zclient.core.stores.connect.IConnectStore) ProfileSourceAnimation(com.waz.zclient.pages.main.participants.ProfileSourceAnimation) ProfileSourceAnimation(com.waz.zclient.pages.main.participants.ProfileSourceAnimation) ProfileTabletAnimation(com.waz.zclient.pages.main.participants.ProfileTabletAnimation) Animation(android.view.animation.Animation) ProfileAnimation(com.waz.zclient.pages.main.participants.ProfileAnimation)

Aggregations

Animation (android.view.animation.Animation)943 AlphaAnimation (android.view.animation.AlphaAnimation)241 TranslateAnimation (android.view.animation.TranslateAnimation)190 ScaleAnimation (android.view.animation.ScaleAnimation)146 Transformation (android.view.animation.Transformation)114 View (android.view.View)104 AnimationListener (android.view.animation.Animation.AnimationListener)98 AnimationSet (android.view.animation.AnimationSet)94 RotateAnimation (android.view.animation.RotateAnimation)63 ImageView (android.widget.ImageView)48 TextView (android.widget.TextView)47 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)43 Point (android.graphics.Point)40 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)35 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)35 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)35 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)35 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)35 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)35 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)35