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

Commit 9965b760 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Coordinating empty view with the history view."

parents cf598471 9a74290a
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -33,12 +33,6 @@
        android:layout_height="match_parent">
    </com.android.systemui.recents.views.RecentsView>

    <!-- Empty View -->
    <ViewStub android:id="@+id/empty_view_stub"
           android:layout="@layout/recents_empty"
           android:layout_width="match_parent"
           android:layout_height="match_parent" />

    <!-- History View -->
    <ViewStub android:id="@+id/history_view_stub"
           android:layout="@layout/recents_history"
+1 −2
Original line number Diff line number Diff line
@@ -26,5 +26,4 @@
    android:shadowDx="0"
    android:shadowDy="2"
    android:shadowRadius="5"
    android:fontFamily="sans-serif-medium"
    android:visibility="invisible" />
 No newline at end of file
    android:fontFamily="sans-serif-medium" />
 No newline at end of file
+37 −47
Original line number Diff line number Diff line
@@ -97,8 +97,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    // Top level views
    private RecentsView mRecentsView;
    private SystemBarScrimViews mScrimViews;
    private ViewStub mEmptyViewStub;
    private View mEmptyView;
    private ViewStub mHistoryViewStub;
    private RecentsHistoryView mHistoryView;

@@ -197,7 +195,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        loader.loadTasks(this, plan, loadOpts);

        TaskStack stack = plan.getTaskStack();
        launchState.launchedWithNoRecentTasks = !plan.hasTasks();
        mRecentsView.setTaskStack(stack);

        // Mark the task that is the launch target
@@ -215,30 +212,13 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
            }
        }

        // Update the top level view's visibilities
        if (launchState.launchedWithNoRecentTasks) {
            if (mEmptyView == null) {
                mEmptyView = mEmptyViewStub.inflate();
            }
            mEmptyView.setVisibility(View.VISIBLE);
            if (!RecentsDebugFlags.Static.DisableSearchBar) {
                mRecentsView.setSearchBarVisibility(View.GONE);
            }
        } else {
            if (mEmptyView != null) {
                mEmptyView.setVisibility(View.GONE);
            }
            if (!RecentsDebugFlags.Static.DisableSearchBar) {
                if (mRecentsView.hasValidSearchBar()) {
                    mRecentsView.setSearchBarVisibility(View.VISIBLE);
                } else {
                    refreshSearchWidgetView();
                }
            }
        }

        // Animate the SystemUI scrims into view
        mScrimViews.prepareEnterRecentsAnimation();
        boolean hasStatusBarScrim = stack.getStackTaskCount() > 0;
        boolean animateStatusBarScrim = launchState.launchedFromHome;
        boolean hasNavBarScrim = (stack.getStackTaskCount() > 0) && !config.hasTransposedNavBar;
        boolean animateNavBarScrim = true;
        mScrimViews.prepareEnterRecentsAnimation(hasStatusBarScrim, animateStatusBarScrim, hasNavBarScrim,
                animateNavBarScrim);

        // Keep track of whether we launched from the nav bar button or via alt-tab
        if (launchState.launchedWithAltTab) {
@@ -265,7 +245,10 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    boolean dismissHistory() {
        // Try and hide the history view first
        if (mHistoryView != null && mHistoryView.isVisible()) {
            EventBus.getDefault().send(new HideHistoryEvent(true /* animate */));
            ReferenceCountedTrigger t = new ReferenceCountedTrigger(this);
            t.increment();
            EventBus.getDefault().send(new HideHistoryEvent(true /* animate */, t));
            t.decrement();
            return true;
        }
        return false;
@@ -374,7 +357,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
                View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
        mEmptyViewStub = (ViewStub) findViewById(R.id.empty_view_stub);
        mHistoryViewStub = (ViewStub) findViewById(R.id.history_view_stub);
        mScrimViews = new SystemBarScrimViews(this);
        getWindow().getAttributes().privateFlags |=
@@ -456,7 +438,10 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        // Reset some states
        mIgnoreAltTabRelease = false;
        if (mHistoryView != null) {
            EventBus.getDefault().send(new HideHistoryEvent(false /* animate */));
            ReferenceCountedTrigger t = new ReferenceCountedTrigger(this);
            t.increment();
            EventBus.getDefault().send(new HideHistoryEvent(false /* animate */, t));
            t.decrement();
        }

        // Notify that recents is now hidden
@@ -603,6 +588,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    }

    public final void onBusEvent(IterateRecentsEvent event) {
        if (!dismissHistory()) {
            // Focus the next task
            EventBus.getDefault().send(new FocusNextTaskViewEvent());

@@ -616,6 +602,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
                }
            }
        }
    }

    public final void onBusEvent(UserInteractionEvent event) {
        mIterateTrigger.stopDozing();
@@ -630,7 +617,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        } else if (event.triggeredFromHomeKey) {
            // Otherwise, dismiss Recents to Home
            if (mHistoryView != null && mHistoryView.isVisible()) {
                ReferenceCountedTrigger t = new ReferenceCountedTrigger(this, null, null, null);
                ReferenceCountedTrigger t = new ReferenceCountedTrigger(this);
                t.increment();
                t.addLastDecrementRunnable(new Runnable() {
                    @Override
@@ -651,7 +638,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD

    public final void onBusEvent(EnterRecentsWindowAnimationCompletedEvent event) {
        // Try and start the enter animation (or restart it on configuration changed)
        ReferenceCountedTrigger t = new ReferenceCountedTrigger(this, null, null, null);
        ReferenceCountedTrigger t = new ReferenceCountedTrigger(this);
        ViewAnimation.TaskViewEnterContext ctx = new ViewAnimation.TaskViewEnterContext(t);
        ctx.postAnimationTrigger.increment();
        if (mSearchWidgetInfo != null) {
@@ -724,8 +711,13 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    }

    public final void onBusEvent(AllTaskViewsDismissedEvent event) {
        SystemServicesProxy ssp = Recents.getSystemServices();
        if (ssp.hasDockedTask()) {
            mRecentsView.showEmptyView();
        } else {
            // Just go straight home (no animation necessary because there are no more task views)
            dismissRecentsToHome(false /* animated */);
        }

        // Keep track of all-deletions
        MetricsLogger.count(this, "overview_task_all_dismissed", 1);
@@ -769,13 +761,11 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
            // provided.
            mHistoryView.setSystemInsets(mRecentsView.getSystemInsets());
        }
        mHistoryView.show(mRecentsView.getTaskStack());
        mHistoryView.show(mRecentsView.getTaskStack(), event.postHideStackAnimationTrigger);
    }

    public final void onBusEvent(HideHistoryEvent event) {
        if (mHistoryView != null) {
            mHistoryView.hide(event.animate, event.postAnimationTrigger);
        }
        mHistoryView.hide(event.animate, event.postHideHistoryAnimationTrigger);
    }

    private void refreshSearchWidgetView() {
+0 −32
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ package com.android.systemui.recents;
public class RecentsActivityLaunchState {

    public boolean launchedWithAltTab;
    public boolean launchedWithNoRecentTasks;
    public boolean launchedFromAppWithThumbnail;
    public boolean launchedFromHome;
    public boolean launchedFromSearchHome;
@@ -49,28 +48,6 @@ public class RecentsActivityLaunchState {
        launchedViaDragGesture = false;
    }

    /** Returns whether the status bar scrim should be animated when shown for the first time. */
    public boolean shouldAnimateStatusBarScrim() {
        return true;
    }

    /** Returns whether the status bar scrim should be visible. */
    public boolean hasStatusBarScrim() {
        return !launchedWithNoRecentTasks;
    }

    /** Returns whether the nav bar scrim should be animated when shown for the first time. */
    public boolean shouldAnimateNavBarScrim() {
        return true;
    }

    /** Returns whether the nav bar scrim should be visible. */
    public boolean hasNavBarScrim() {
        // Only show the scrim if we have recent tasks, and if the nav bar is not transposed
        RecentsConfiguration config = Recents.getConfiguration();
        return !launchedWithNoRecentTasks && !config.hasTransposedNavBar;
    }

    /**
     * Returns the task to focus given the current launch state.
     */
@@ -103,13 +80,4 @@ public class RecentsActivityLaunchState {
            return -1;
        }
    }

    @Override
    public String toString() {
        return "RecentsActivityLaunchState altTab: " + launchedWithAltTab +
                ", noTasks: " + launchedWithNoRecentTasks +
                ", fromHome: " + launchedFromHome +
                ", fromSearchHome: " + launchedFromSearchHome +
                ", reuse: " + launchedReuseTaskStackViews;
    }
}
+7 −7
Original line number Diff line number Diff line
@@ -25,14 +25,14 @@ import com.android.systemui.recents.misc.ReferenceCountedTrigger;
public class HideHistoryEvent extends EventBus.Event {

    public final boolean animate;
    public final ReferenceCountedTrigger postAnimationTrigger;
    public final ReferenceCountedTrigger postHideHistoryAnimationTrigger;

    public HideHistoryEvent(boolean animate) {
        this(animate, null);
    }

    public HideHistoryEvent(boolean animate, ReferenceCountedTrigger postAnimationTrigger) {
    /**
     * @param postHideHistoryAnimationTrigger the trigger that gets called when all the history animations are finished
     *                                        when transitioning from the history view
     */
    public HideHistoryEvent(boolean animate, ReferenceCountedTrigger postHideHistoryAnimationTrigger) {
        this.animate = animate;
        this.postAnimationTrigger = postAnimationTrigger;
        this.postHideHistoryAnimationTrigger = postHideHistoryAnimationTrigger;
    }
}
Loading