Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c177200 authored by jovanak's avatar jovanak
Browse files

Fixing issues with alpha 0.0 on parent view.

Parent view should remain with 1.0 alpha.
Container view should fade when switching starts, and come back
to alpha of 1.0 once the switching has been completed.

Fixes: 78309123
Fixes: 78309400
Test: Visual confirmation of various flows. Switching to user with a pin. Canceling bouncer. Switching to user without a pin. Turning the screen off and back on after unlocking the user first.
Change-Id: I17946a1feea20bcb2fd2603c8cba0f2f51acd65d
parent 3f888482
Loading
Loading
Loading
Loading
+25 −24
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ public class FullscreenUserSwitcher {

    public void hide() {
        mShowing = false;
        toggleSwitchInProgress(false);
        mParent.setVisibility(View.GONE);
    }

@@ -78,6 +77,7 @@ public class FullscreenUserSwitcher {
        // reboot, system fires ACTION_USER_SWITCHED change from -1 to 0 user. This is not an actual
        // user switch. We only want to trigger keyguard dismissal when foreground user changes.
        if (foregroundUserChanged()) {
            toggleSwitchInProgress(false);
            updateCurrentForegroundUser();
            mParent.post(this::dismissKeyguard);
        }
@@ -107,32 +107,33 @@ public class FullscreenUserSwitcher {

    private void toggleSwitchInProgress(boolean inProgress) {
        if (inProgress) {
            crossFade(mParent, mContainer);
            fadeOut(mContainer);
        } else {
            crossFade(mContainer, mParent);
            fadeIn(mContainer);
        }

    }

    private void crossFade(View incoming, View outgoing) {
        incoming.animate()
            .alpha(1.0f)
    private void fadeOut(View view) {
        view.animate()
                .alpha(0.0f)
                .setDuration(mShortAnimDuration)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                public void onAnimationStart(Animator animator) {
                    incoming.setAlpha(0.0f);
                    incoming.setVisibility(View.VISIBLE);
                    public void onAnimationEnd(Animator animation) {
                        view.setVisibility(View.GONE);
                    }
                });
    }

        outgoing.animate()
            .alpha(0.0f)
    private void fadeIn(View view) {
        view.animate()
                .alpha(1.0f)
                .setDuration(mShortAnimDuration)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                public void onAnimationEnd(Animator animation) {
                    outgoing.setVisibility(View.GONE);
                    public void onAnimationStart(Animator animator) {
                        view.setAlpha(0.0f);
                        view.setVisibility(View.VISIBLE);
                    }
                });
    }