Make more room in the ActionBar

See bug #14898161

- allow Search Option Menu only on the Dashboard (and no more
in the Settings screens)
- push the "Start Now" Day Dream Option Menu to be a real Menu
so that we can see the "Day Dream" title

Change-Id: I4a7c21fb3599ada8efc82bd5bd8c9f5049937ceb
This commit is contained in:
Fabrice Di Meglio
2014-05-13 14:39:41 -07:00
parent 15826d4ea1
commit 35062d6983
2 changed files with 13 additions and 4 deletions

View File

@@ -304,6 +304,8 @@ public class SettingsActivity extends Activity
private ActionBar mActionBar;
private boolean mDisplayHomeAsUpEnabled;
private boolean mIsShowingDashboard;
private SearchView mSearchView;
private MenuItem mSearchMenuItem;
private boolean mSearchMenuItemExpanded = false;
@@ -387,6 +389,11 @@ public class SettingsActivity extends Activity
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Only show the Search menu on the main screen (Dashboard)
if (!mIsShowingDashboard) {
return true;
}
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.options_menu, menu);
@@ -442,7 +449,9 @@ public class SettingsActivity extends Activity
// Getting Intent properties can only be done after the super.onCreate(...)
final String initialFragmentName = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
if (initialFragmentName == null) {
mIsShowingDashboard = (initialFragmentName == null);
if (mIsShowingDashboard) {
Index.getInstance(this).update();
}
@@ -468,7 +477,7 @@ public class SettingsActivity extends Activity
// We need to build the Categories in all cases
buildDashboardCategories(mCategories);
if (initialFragmentName != null) {
if (!mIsShowingDashboard) {
final ComponentName cn = getIntent().getComponent();
// No UP is we are launched thru a Settings shortcut
if (!cn.getClassName().equals(SubSettings.class.getName())) {