Search in sources :

Example 81 with Animation

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

the class SendConnectRequestFragment 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) {
        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) 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)

Example 82 with Animation

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

the class BlockedUserProfileFragment 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) {
        int centerX = ViewUtils.getOrientationIndependentDisplayWidth(getActivity()) / 2;
        int centerY = ViewUtils.getOrientationIndependentDisplayHeight(getActivity()) / 2;
        int duration;
        int delay = 0;
        // Fade out animation when starting conversation directly with this user when unblocking
        if (!goToConversationWithUser || enter) {
            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);
                }
            }
        } else {
            goToConversationWithUser = false;
            duration = getResources().getInteger(R.integer.framework_animation_duration_medium);
            animation = new FadeAnimation(duration, 1, 0);
        }
    }
    return animation;
}
Also used : ProfileTabletAnimation(com.waz.zclient.pages.main.participants.ProfileTabletAnimation) ProfileAnimation(com.waz.zclient.pages.main.participants.ProfileAnimation) ProfileSourceAnimation(com.waz.zclient.pages.main.participants.ProfileSourceAnimation) FadeAnimation(com.waz.zclient.ui.animation.fragment.FadeAnimation) ProfileSourceAnimation(com.waz.zclient.pages.main.participants.ProfileSourceAnimation) ProfileTabletAnimation(com.waz.zclient.pages.main.participants.ProfileTabletAnimation) Animation(android.view.animation.Animation) FadeAnimation(com.waz.zclient.ui.animation.fragment.FadeAnimation) ProfileAnimation(com.waz.zclient.pages.main.participants.ProfileAnimation)

Example 83 with Animation

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

the class TabbedParticipantBodyFragment method onCreateAnimation.

@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
    final Fragment parent = getParentFragment();
    // is being removed.
    if (!enter && parent != null && parent.isRemoving()) {
        // This is a workaround for the bug where child fragments disappear when
        // the parent is removed (as all children are first removed from the parent)
        // See https://code.google.com/p/android/issues/detail?id=55228
        Animation doNothingAnim = new AlphaAnimation(1, 1);
        doNothingAnim.setDuration(ViewUtils.getNextAnimationDuration(parent));
        return doNothingAnim;
    } else {
        return super.onCreateAnimation(transit, enter, nextAnim);
    }
}
Also used : Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) Fragment(android.support.v4.app.Fragment) BaseFragment(com.waz.zclient.pages.BaseFragment) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 84 with Animation

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

the class ParticipantsDialogFragment method setVisible.

@SuppressLint("RtlHardcoded")
private void setVisible(final boolean show) {
    if (getView() == null || isInConfigurationChange) {
        removeFragment();
        return;
    }
    Animation animation;
    if (show) {
        switch(selfGravity) {
            case Gravity.TOP:
                animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_show_gravity_top);
                break;
            case Gravity.RIGHT:
                animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_show_gravity_right);
                break;
            case Gravity.LEFT:
                animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_show_gravity_left);
                break;
            case Gravity.BOTTOM:
            default:
                animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_show_gravity_bottom);
        }
    } else {
        switch(selfGravity) {
            case Gravity.TOP:
                animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_hide_gravity_top);
                break;
            case Gravity.RIGHT:
                animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_hide_gravity_right);
                break;
            case Gravity.LEFT:
                animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_hide_gravity_left);
                break;
            case Gravity.BOTTOM:
            default:
                animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_hide_gravity_bottom);
        }
    }
    animation.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            if (show) {
                return;
            }
            removeFragment();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    getView().startAnimation(animation);
}
Also used : Animation(android.view.animation.Animation) SuppressLint(android.annotation.SuppressLint)

Example 85 with Animation

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

the class ParticipantHeaderFragment method onCreateAnimation.

@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
    final Fragment parent = getParentFragment();
    // is being removed.
    if (!enter && parent != null && parent.isRemoving()) {
        // This is a workaround for the bug where child fragments disappear when
        // the parent is removed (as all children are first removed from the parent)
        // See https://code.google.com/p/android/issues/detail?id=55228
        Animation doNothingAnim = new AlphaAnimation(1, 1);
        doNothingAnim.setDuration(ViewUtils.getNextAnimationDuration(parent));
        return doNothingAnim;
    } else {
        return super.onCreateAnimation(transit, enter, nextAnim);
    }
}
Also used : Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) Fragment(android.support.v4.app.Fragment) BaseFragment(com.waz.zclient.pages.BaseFragment) AlphaAnimation(android.view.animation.AlphaAnimation)

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