Support highlightable Settings homepage menu for 2-pane
1. Add a preference group adapter to perform highlighting 2. Add a class for mapping highlighable menu keys and preference keys 3. Add an API to determine if the screen is in split mode Bug: 199017944 Test: manual, build Change-Id: I8e3fe5fb96480a31ee0f3b3afb6ad78999d3d2bc
This commit is contained in:
@@ -149,9 +149,13 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
public static final String META_DATA_KEY_FRAGMENT_CLASS =
|
||||
"com.android.settings.FRAGMENT_CLASS";
|
||||
|
||||
public static final String META_DATA_KEY_HIGHLIGHT_MENU_KEY =
|
||||
"com.android.settings.HIGHLIGHT_MENU_KEY";
|
||||
|
||||
private static final String EXTRA_UI_OPTIONS = "settings:ui_options";
|
||||
|
||||
private String mFragmentClass;
|
||||
private String mHighlightMenuKey;
|
||||
|
||||
private CharSequence mInitialTitle;
|
||||
private int mInitialTitleResId;
|
||||
@@ -234,21 +238,19 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
super.onCreate(savedState);
|
||||
Log.d(LOG_TAG, "Starting onCreate");
|
||||
|
||||
if (launchHomepageForTwonPaneDeepLink()) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
// Should happen before any call to getIntent()
|
||||
getMetaData();
|
||||
final Intent intent = getIntent();
|
||||
if (launchHomepageForTwoPaneDeepLink(intent)) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
final FeatureFactory factory = FeatureFactory.getFactory(this);
|
||||
|
||||
mDashboardFeatureProvider = factory.getDashboardFeatureProvider(this);
|
||||
|
||||
// Should happen before any call to getIntent()
|
||||
getMetaData();
|
||||
|
||||
final Intent intent = getIntent();
|
||||
if (intent.hasExtra(EXTRA_UI_OPTIONS)) {
|
||||
getWindow().setUiOptions(intent.getIntExtra(EXTRA_UI_OPTIONS, 0));
|
||||
}
|
||||
@@ -355,8 +357,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
}
|
||||
|
||||
/** Returns true if the Activity is started by a deep link intent for large screen devices. */
|
||||
private boolean launchHomepageForTwonPaneDeepLink() {
|
||||
final Intent intent = getIntent();
|
||||
private boolean launchHomepageForTwoPaneDeepLink(Intent intent) {
|
||||
if (!shouldShowTwoPaneDeepLink(intent)) {
|
||||
return false;
|
||||
}
|
||||
@@ -368,6 +369,9 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
trampolineIntent.putExtra(
|
||||
android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI,
|
||||
intent.toUri(Intent.URI_INTENT_SCHEME));
|
||||
trampolineIntent.putExtra(
|
||||
android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_HIGHLIGHT_MENU_KEY,
|
||||
mHighlightMenuKey);
|
||||
trampolineIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
||||
startActivity(trampolineIntent);
|
||||
|
||||
@@ -776,6 +780,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
PackageManager.GET_META_DATA);
|
||||
if (ai == null || ai.metaData == null) return;
|
||||
mFragmentClass = ai.metaData.getString(META_DATA_KEY_FRAGMENT_CLASS);
|
||||
mHighlightMenuKey = ai.metaData.getString(META_DATA_KEY_HIGHLIGHT_MENU_KEY);
|
||||
} catch (NameNotFoundException nnfe) {
|
||||
// No recovery
|
||||
Log.d(LOG_TAG, "Cannot get Metadata for: " + getComponentName().toString());
|
||||
|
||||
Reference in New Issue
Block a user