diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 666a02437f094..9b74a807f56f5 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -713,8 +713,8 @@
Could not start %s.
More
-
- History
+
+ %d More
Split Horizontal
diff --git a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
index 538ec93efeb63..1163f143432e3 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/history/RecentsHistoryView.java
@@ -101,7 +101,7 @@ public class RecentsHistoryView extends LinearLayout {
.start();
}
});
- mAdapter.updateTasks(getContext(), stack.computeAllTasksList());
+ mAdapter.updateTasks(getContext(), stack.getHistoricalTasks());
mIsVisible = true;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
index 05573326bcea1..addcc85d7f154 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -32,8 +32,8 @@ import android.view.WindowInsets;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
-
import com.android.internal.logging.MetricsLogger;
+import android.widget.TextView;
import com.android.systemui.R;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsActivity;
@@ -81,7 +81,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
private TaskStack mStack;
private TaskStackView mTaskStackView;
private RecentsAppWidgetHostView mSearchBar;
- private View mHistoryButton;
+ private TextView mHistoryButton;
private View mEmptyView;
private boolean mAwaitingFirstLayout = true;
private boolean mLastTaskLaunchedWasFreeform;
@@ -126,7 +126,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
mFlingAnimationUtils = new FlingAnimationUtils(context, 0.3f);
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() {
@Override
public void onClick(View v) {
@@ -609,6 +609,8 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
if (!debugFlags.isHistoryEnabled()) {
hideHistoryButton(100);
+ } else {
+ showHistoryButton(100);
}
}
@@ -631,6 +633,8 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
mHistoryButton.setVisibility(View.VISIBLE);
mHistoryButton.setAlpha(0f);
+ mHistoryButton.setText(getContext().getString(R.string.recents_history_label_format,
+ mStack.getHistoricalTasks().size()));
postHideHistoryAnimationTrigger.addLastDecrementRunnable(new Runnable() {
@Override
public void run() {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 9d7a927f4423a..404ac47deab98 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -1065,8 +1065,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
// 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());
+ } else {
+ EventBus.getDefault().send(new HideHistoryButtonEvent());
}
// Start dozing
@@ -1395,7 +1398,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
requestSynchronizeStackViewsWithModel();
postInvalidateOnAnimation();
- if (prevScroll > SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD &&
+ if (shouldShowHistoryButton() &&
+ prevScroll > SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD &&
curScroll <= SHOW_HISTORY_BUTTON_SCROLL_THRESHOLD) {
EventBus.getDefault().send(new ShowHistoryButtonEvent());
} else if (prevScroll < HIDE_HISTORY_BUTTON_SCROLL_THRESHOLD &&
@@ -1666,4 +1670,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
return -1;
}
+
+ /**
+ * @return whether the history button should be visible
+ */
+ private boolean shouldShowHistoryButton() {
+ return !mStack.getHistoricalTasks().isEmpty();
+ }
}