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

Commit de750de5 authored by Winson Chung's avatar Winson Chung
Browse files

Only show historical tasks in history.

- Also only show the history button if there are
  historical tasks (and reflect that in the 
  button text)

Change-Id: I7b9dcf79e2feef61f96b720f586144de4c5033e3
parent a8a43dbd
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -713,8 +713,8 @@
    <string name="recents_launch_error_message">Could not start <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
    <string name="recents_launch_error_message">Could not start <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>
    <!-- Recents: Show history string. [CHAR LIMIT=NONE] -->
    <!-- Recents: Show history string. [CHAR LIMIT=NONE] -->
    <string name="recents_show_history_button_label">More</string>
    <string name="recents_show_history_button_label">More</string>
    <!-- Recents: The history of recents. [CHAR LIMIT=NONE] -->
    <!-- Recents: A format string to set the number of availabe historical tasks in recents. [CHAR LIMIT=NONE] -->
    <string name="recents_history_label">History</string>
    <string name="recents_history_label_format"><xliff:g id="number">%d</xliff:g> More</string>


    <!-- Recents: MultiStack add stack split horizontal radio button. [CHAR LIMIT=NONE] -->
    <!-- Recents: MultiStack add stack split horizontal radio button. [CHAR LIMIT=NONE] -->
    <string name="recents_multistack_add_stack_dialog_split_horizontal">Split Horizontal</string>
    <string name="recents_multistack_add_stack_dialog_split_horizontal">Split Horizontal</string>
+1 −1
Original line number Original line Diff line number Diff line
@@ -101,7 +101,7 @@ public class RecentsHistoryView extends LinearLayout {
                        .start();
                        .start();
            }
            }
        });
        });
        mAdapter.updateTasks(getContext(), stack.computeAllTasksList());
        mAdapter.updateTasks(getContext(), stack.getHistoricalTasks());
        mIsVisible = true;
        mIsVisible = true;
    }
    }


+7 −3
Original line number Original line Diff line number Diff line
@@ -32,8 +32,8 @@ import android.view.WindowInsets;
import android.view.animation.AnimationUtils;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
import android.widget.FrameLayout;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsLogger;
import android.widget.TextView;
import com.android.systemui.R;
import com.android.systemui.R;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsActivity;
import com.android.systemui.recents.RecentsActivity;
@@ -81,7 +81,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
    private TaskStack mStack;
    private TaskStack mStack;
    private TaskStackView mTaskStackView;
    private TaskStackView mTaskStackView;
    private RecentsAppWidgetHostView mSearchBar;
    private RecentsAppWidgetHostView mSearchBar;
    private View mHistoryButton;
    private TextView mHistoryButton;
    private View mEmptyView;
    private View mEmptyView;
    private boolean mAwaitingFirstLayout = true;
    private boolean mAwaitingFirstLayout = true;
    private boolean mLastTaskLaunchedWasFreeform;
    private boolean mLastTaskLaunchedWasFreeform;
@@ -126,7 +126,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
        mFlingAnimationUtils = new FlingAnimationUtils(context, 0.3f);
        mFlingAnimationUtils = new FlingAnimationUtils(context, 0.3f);


        LayoutInflater inflater = LayoutInflater.from(context);
        LayoutInflater inflater = LayoutInflater.from(context);
        mHistoryButton = inflater.inflate(R.layout.recents_history_button, this, false);
        mHistoryButton = (TextView) inflater.inflate(R.layout.recents_history_button, this, false);
        mHistoryButton.setOnClickListener(new View.OnClickListener() {
        mHistoryButton.setOnClickListener(new View.OnClickListener() {
            @Override
            @Override
            public void onClick(View v) {
            public void onClick(View v) {
@@ -609,6 +609,8 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
        RecentsDebugFlags debugFlags = Recents.getDebugFlags();
        RecentsDebugFlags debugFlags = Recents.getDebugFlags();
        if (!debugFlags.isHistoryEnabled()) {
        if (!debugFlags.isHistoryEnabled()) {
            hideHistoryButton(100);
            hideHistoryButton(100);
        } else {
            showHistoryButton(100);
        }
        }
    }
    }


@@ -631,6 +633,8 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV


        mHistoryButton.setVisibility(View.VISIBLE);
        mHistoryButton.setVisibility(View.VISIBLE);
        mHistoryButton.setAlpha(0f);
        mHistoryButton.setAlpha(0f);
        mHistoryButton.setText(getContext().getString(R.string.recents_history_label_format,
                mStack.getHistoricalTasks().size()));
        postHideHistoryAnimationTrigger.addLastDecrementRunnable(new Runnable() {
        postHideHistoryAnimationTrigger.addLastDecrementRunnable(new Runnable() {
            @Override
            @Override
            public void run() {
            public void run() {
+13 −2
Original line number Original line Diff line number Diff line
@@ -1065,8 +1065,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        }
        }


        // Update the history button visibility
        // Update the history button visibility
        if (mStackScroller.getStackScroll() < SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD) {
        if (shouldShowHistoryButton() &&
                mStackScroller.getStackScroll() < SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD) {
            EventBus.getDefault().send(new ShowHistoryButtonEvent());
            EventBus.getDefault().send(new ShowHistoryButtonEvent());
        } else {
            EventBus.getDefault().send(new HideHistoryButtonEvent());
        }
        }


        // Start dozing
        // Start dozing
@@ -1395,7 +1398,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        requestSynchronizeStackViewsWithModel();
        requestSynchronizeStackViewsWithModel();
        postInvalidateOnAnimation();
        postInvalidateOnAnimation();


        if (prevScroll > SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD &&
        if (shouldShowHistoryButton() &&
                prevScroll > SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD &&
                curScroll <= SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD) {
                curScroll <= SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD) {
            EventBus.getDefault().send(new ShowHistoryButtonEvent());
            EventBus.getDefault().send(new ShowHistoryButtonEvent());
        } else if (prevScroll < HIDE_HISTORY_BUTTON_SCROLL_THRESHOLD &&
        } else if (prevScroll < HIDE_HISTORY_BUTTON_SCROLL_THRESHOLD &&
@@ -1666,4 +1670,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        }
        }
        return -1;
        return -1;
    }
    }

    /**
     * @return whether the history button should be visible
     */
    private boolean shouldShowHistoryButton() {
        return !mStack.getHistoricalTasks().isEmpty();
    }
}
}