Search in sources :

Example 1 with FadeAnimation

use of com.waz.zclient.ui.animation.fragment.FadeAnimation 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 2 with FadeAnimation

use of com.waz.zclient.ui.animation.fragment.FadeAnimation in project wire-android by wireapp.

the class SingleParticipantFragment 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
        if (goToConversationWithUser && !enter) {
            goToConversationWithUser = false;
            duration = getResources().getInteger(R.integer.framework_animation_duration_medium);
            animation = new FadeAnimation(duration, 1, 0);
        } else {
            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 : FadeAnimation(com.waz.zclient.ui.animation.fragment.FadeAnimation) Animation(android.view.animation.Animation) FadeAnimation(com.waz.zclient.ui.animation.fragment.FadeAnimation)

Aggregations

Animation (android.view.animation.Animation)2 FadeAnimation (com.waz.zclient.ui.animation.fragment.FadeAnimation)2 ProfileAnimation (com.waz.zclient.pages.main.participants.ProfileAnimation)1 ProfileSourceAnimation (com.waz.zclient.pages.main.participants.ProfileSourceAnimation)1 ProfileTabletAnimation (com.waz.zclient.pages.main.participants.ProfileTabletAnimation)1