Remove logic for adding a search icon to action bar.
No longer used given that we don't show the search icon on any page.
The main settings page now has the search bar.
Change-Id: I9535028298739467e7fa9c75d1a2fb2b2fa3251b
Fixes: 62230804
Bug: 37477506
Test: robotests
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index f61dfd3..805f965 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -87,8 +87,6 @@
private static final String SAVE_KEY_CATEGORIES = ":settings:categories";
@VisibleForTesting
static final String SAVE_KEY_SHOW_HOME_AS_UP = ":settings:show_home_as_up";
- @VisibleForTesting
- static final String SAVE_KEY_SHOW_SEARCH = ":settings:show_search";
/**
* When starting this activity, the invoking Intent can contain this extra
@@ -192,22 +190,18 @@
private DynamicIndexableContentMonitor mDynamicIndexableContentMonitor;
- private ActionBar mActionBar;
private SwitchBar mSwitchBar;
private Button mNextButton;
@VisibleForTesting
boolean mDisplayHomeAsUpEnabled;
- @VisibleForTesting
- boolean mDisplaySearch;
private boolean mIsShowingDashboard;
private boolean mIsShortcut;
private ViewGroup mContent;
- private SearchFeatureProvider mSearchFeatureProvider;
private MetricsFeatureProvider mMetricsFeatureProvider;
// Categories
@@ -233,15 +227,6 @@
}
@Override
- public boolean onCreateOptionsMenu(Menu menu) {
- if (!mDisplaySearch) {
- return false;
- }
- mSearchFeatureProvider.setUpSearchMenu(menu, this);
- return true;
- }
-
- @Override
public SharedPreferences getSharedPreferences(String name, int mode) {
if (name.equals(getPackageName() + "_preferences")) {
return new SharedPreferencesLogger(this, getMetricsTag());
@@ -284,7 +269,6 @@
final FeatureFactory factory = FeatureFactory.getFactory(this);
mDashboardFeatureProvider = factory.getDashboardFeatureProvider(this);
- mSearchFeatureProvider = factory.getSearchFeatureProvider();
mMetricsFeatureProvider = factory.getMetricsFeatureProvider();
// Should happen before any call to getIntent()
@@ -324,7 +308,7 @@
setContentView(mIsShowingDashboard ?
R.layout.settings_main_dashboard : R.layout.settings_main_prefs);
- mContent = (ViewGroup) findViewById(R.id.main_content);
+ mContent = findViewById(R.id.main_content);
getFragmentManager().addOnBackStackChangedListener(this);
@@ -355,12 +339,12 @@
setActionBar(toolbar);
}
- mActionBar = getActionBar();
- if (mActionBar != null) {
- mActionBar.setDisplayHomeAsUpEnabled(mDisplayHomeAsUpEnabled);
- mActionBar.setHomeButtonEnabled(mDisplayHomeAsUpEnabled);
+ ActionBar actionBar = getActionBar();
+ if (actionBar != null) {
+ actionBar.setDisplayHomeAsUpEnabled(mDisplayHomeAsUpEnabled);
+ actionBar.setHomeButtonEnabled(mDisplayHomeAsUpEnabled);
}
- mSwitchBar = (SwitchBar) findViewById(R.id.switch_bar);
+ mSwitchBar = findViewById(R.id.switch_bar);
if (mSwitchBar != null) {
mSwitchBar.setMetricsTag(getMetricsTag());
}
@@ -427,7 +411,6 @@
@VisibleForTesting
void launchSettingFragment(String initialFragmentName, boolean isSubSettings, Intent intent) {
if (!mIsShowingDashboard && initialFragmentName != null) {
- mDisplaySearch = false;
// UP will be shown only if it is a sub settings
if (mIsShortcut) {
mDisplayHomeAsUpEnabled = isSubSettings;
@@ -444,8 +427,6 @@
} else {
// Show search icon as up affordance if we are displaying the main Dashboard
mDisplayHomeAsUpEnabled = true;
- // toolbar is search affordance so don't show search
- mDisplaySearch = false;
mInitialTitleResId = R.string.dashboard_title;
switchToFragment(DashboardSummary.class.getName(), null /* args */, false, false,
@@ -453,13 +434,6 @@
}
}
- public void setDisplaySearchMenu(boolean displaySearch) {
- if (displaySearch != mDisplaySearch) {
- mDisplaySearch = displaySearch;
- invalidateOptionsMenu();
- }
- }
-
private void setTitleFromIntent(Intent intent) {
final int initialTitleResId = intent.getIntExtra(EXTRA_SHOW_FRAGMENT_TITLE_RESID, -1);
if (initialTitleResId > 0) {
@@ -540,7 +514,6 @@
}
outState.putBoolean(SAVE_KEY_SHOW_HOME_AS_UP, mDisplayHomeAsUpEnabled);
- outState.putBoolean(SAVE_KEY_SHOW_SEARCH, mDisplaySearch);
}
@Override
@@ -548,19 +521,13 @@
super.onRestoreInstanceState(savedInstanceState);
mDisplayHomeAsUpEnabled = savedInstanceState.getBoolean(SAVE_KEY_SHOW_HOME_AS_UP);
- mDisplaySearch = savedInstanceState.getBoolean(SAVE_KEY_SHOW_SEARCH);
}
@Override
protected void onResume() {
super.onResume();
- mDevelopmentPreferencesListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
- @Override
- public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
- updateTilesList();
- }
- };
+ mDevelopmentPreferencesListener = (sharedPreferences, key) -> updateTilesList();
mDevelopmentPreferences.registerOnSharedPreferenceChangeListener(
mDevelopmentPreferencesListener);