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

Commit 8ae17be8 authored by Winson Chung's avatar Winson Chung
Browse files

Piping animation signal to onboarding.

- Use the animation signal to confirm gesture completion

Bug: 70180942
Test: Manual, swipe up from Launcher

Change-Id: I423d6df4fc0e7a759d86dbc42d3423c64eae5c1a
parent caf2b811
Loading
Loading
Loading
Loading
+13 −19
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ public class SwipeUpOnboarding {
    private final RippleDrawable mLightRipple;

    private boolean mTaskListenerRegistered;
    private ComponentName mLauncherComponent;
    private boolean mLayoutAttachedToWindow;
    private boolean mBackgroundIsLight;

@@ -91,18 +90,10 @@ public class SwipeUpOnboarding {
                } else {
                    Prefs.putInt(mContext, Prefs.Key.NUM_APPS_LAUNCHED, numAppsLaunched);
                }
            } else {
                String runningPackage = info.topActivity.getPackageName();
                // TODO: use callback from the overview proxy service to handle this case
                if (runningPackage.equals(mLauncherComponent.getPackageName())
                        && activityType == ACTIVITY_TYPE_RECENTS) {
                    Prefs.putBoolean(mContext, Prefs.Key.HAS_SWIPED_UP_FOR_RECENTS, true);
                    onDisconnectedFromLauncher();
            } else {
                hide(false);
            }
        }
        }
    };

    private final View.OnAttachStateChangeListener mOnAttachStateChangeListener
@@ -127,8 +118,8 @@ public class SwipeUpOnboarding {
        final Resources res = context.getResources();
        mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
        mLayout = LayoutInflater.from(mContext).inflate(R.layout.recents_swipe_up_onboarding, null);
        mTextView = (TextView) mLayout.findViewById(R.id.onboarding_text);
        mDismissView = (ImageView) mLayout.findViewById(R.id.dismiss);
        mTextView = mLayout.findViewById(R.id.onboarding_text);
        mDismissView = mLayout.findViewById(R.id.dismiss);
        mDarkBackgroundColor = res.getColor(android.R.color.background_dark);
        mLightBackgroundColor = res.getColor(android.R.color.background_light);
        mDarkContentColor = res.getColor(R.color.primary_text_default_material_light);
@@ -149,13 +140,7 @@ public class SwipeUpOnboarding {
        }
    }

    public void onConnectedToLauncher(ComponentName launcherComponent) {
        // TODO: re-enable this once we have the proper callback for when a swipe up was performed.
        final boolean disableOnboarding = true;
        if (disableOnboarding) {
            return;
        }
        mLauncherComponent = launcherComponent;
    public void onConnectedToLauncher() {
        boolean alreadyLearnedSwipeUpForRecents = Prefs.getBoolean(mContext,
                Prefs.Key.HAS_SWIPED_UP_FOR_RECENTS, false);
        if (!mTaskListenerRegistered && !alreadyLearnedSwipeUpForRecents) {
@@ -164,6 +149,15 @@ public class SwipeUpOnboarding {
        }
    }

    public void onRecentsAnimationStarted() {
        boolean alreadyLearnedSwipeUpForRecents = Prefs.getBoolean(mContext,
                Prefs.Key.HAS_SWIPED_UP_FOR_RECENTS, false);
        if (!alreadyLearnedSwipeUpForRecents) {
            Prefs.putBoolean(mContext, Prefs.Key.HAS_SWIPED_UP_FOR_RECENTS, true);
            onDisconnectedFromLauncher();
        }
    }

    public void onDisconnectedFromLauncher() {
        if (mTaskListenerRegistered) {
            ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mTaskListener);
+4 −1
Original line number Diff line number Diff line
@@ -218,6 +218,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
        @Override
        public void onRecentsAnimationStarted() {
            mRecentsAnimationStarted = true;
            if (mSwipeUpOnboarding != null) {
                mSwipeUpOnboarding.onRecentsAnimationStarted();
            }
        }
    };

@@ -887,7 +890,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav

    private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) {
        if (connectedToOverviewProxy) {
            mSwipeUpOnboarding.onConnectedToLauncher(mOverviewProxyService.getLauncherComponent());
            mSwipeUpOnboarding.onConnectedToLauncher();
        } else {
            mSwipeUpOnboarding.onDisconnectedFromLauncher();
        }