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:
@@ -150,7 +150,7 @@ public class DreamSettings extends SettingsPreferenceFragment {
|
||||
|
||||
// create "start" action
|
||||
MenuItem start = createMenuItem(menu, R.string.screensaver_settings_dream_start,
|
||||
MenuItem.SHOW_AS_ACTION_ALWAYS,
|
||||
MenuItem.SHOW_AS_ACTION_NEVER,
|
||||
isEnabled, new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -160,7 +160,7 @@ public class DreamSettings extends SettingsPreferenceFragment {
|
||||
// create "when to dream" overflow menu item
|
||||
MenuItem whenToDream = createMenuItem(menu,
|
||||
R.string.screensaver_settings_when_to_dream,
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM,
|
||||
MenuItem.SHOW_AS_ACTION_NEVER,
|
||||
isEnabled,
|
||||
new Runnable() {
|
||||
@Override
|
||||
|
@@ -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())) {
|
||||
|
Reference in New Issue
Block a user