summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java17
2 files changed, 20 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index c42e227..19a38c7 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -203,8 +203,14 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
}
if (mConfig.launchedWithNoRecentTasks) {
mEmptyView.setVisibility(View.VISIBLE);
+ mRecentsView.setSearchBarVisibility(View.GONE);
} else {
mEmptyView.setVisibility(View.GONE);
+ if (mRecentsView.hasSearchBar()) {
+ mRecentsView.setSearchBarVisibility(View.VISIBLE);
+ } else {
+ addSearchBarAppWidgetView();
+ }
}
// Show the scrim if we animate into Recents without window transitions
@@ -351,13 +357,10 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
mFullscreenOverlayStub = (ViewStub) findViewById(R.id.fullscreen_overlay_stub);
mScrimViews = new SystemBarScrimViews(this, mConfig);
- // Update the recent tasks
- updateRecentsTasks(getIntent());
-
// Bind the search app widget when we first start up
bindSearchBarAppWidget();
- // Add the search bar layout
- addSearchBarAppWidgetView();
+ // Update the recent tasks
+ updateRecentsTasks(getIntent());
// Update if we are getting a configuration change
if (savedInstanceState != null) {
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 5efbb60..f203d3e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -66,8 +66,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
// The space partitioning root of this container
SpaceNode mBSP;
- // Whether there are any tasks
- boolean mHasTasks;
// Search bar view
View mSearchBar;
// Recents view callbacks
@@ -110,13 +108,11 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
}
// Create and add all the stacks for this partition of space.
- mHasTasks = false;
ArrayList<TaskStack> stacks = mBSP.getStacks();
for (TaskStack stack : stacks) {
TaskStackView stackView = new TaskStackView(getContext(), stack);
stackView.setCallbacks(this);
addView(stackView);
- mHasTasks |= (stack.getTaskCount() > 0);
}
// Enable debug mode drawing
@@ -246,7 +242,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
// Add the new search bar
if (searchBar != null) {
mSearchBar = searchBar;
- mSearchBar.setVisibility(mHasTasks ? View.VISIBLE : View.GONE);
addView(mSearchBar);
if (Console.Enabled) {
@@ -258,6 +253,18 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
}
}
+ /** Returns whether there is currently a search bar */
+ public boolean hasSearchBar() {
+ return mSearchBar != null;
+ }
+
+ /** Sets the visibility of the search bar */
+ public void setSearchBarVisibility(int visibility) {
+ if (mSearchBar != null) {
+ mSearchBar.setVisibility(visibility);
+ }
+ }
+
/**
* This is called with the full size of the window since we are handling our own insets.
*/