diff options
author | Maurice Lam <yukl@google.com> | 2015-04-07 16:55:39 -0700 |
---|---|---|
committer | Maurice Lam <yukl@google.com> | 2015-04-07 18:34:59 -0700 |
commit | 56a19113d248d9ffdb462a0af6ba8a967635be66 (patch) | |
tree | fde43cfa47d68af788a7bc2c7120a02c32996140 /library/main/src/com/android/setupwizardlib/util | |
parent | 0d6c44afe2731446e2b96c17ae0fd52e62ea1e54 (diff) | |
download | setupwizard-56a19113d248d9ffdb462a0af6ba8a967635be66.tar.gz |
[SetupWizardLib] Add isLightTheme method
Add WizardManagerHelper.isLightTheme method to tell whether an
activity should use light theme or not.
Bug: 20110002
Change-Id: I41fc142489c9f1c1b9b91cd825f54447b856f58b
Diffstat (limited to 'library/main/src/com/android/setupwizardlib/util')
-rw-r--r-- | library/main/src/com/android/setupwizardlib/util/WizardManagerHelper.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/library/main/src/com/android/setupwizardlib/util/WizardManagerHelper.java b/library/main/src/com/android/setupwizardlib/util/WizardManagerHelper.java index 69d3848..3f336e0 100644 --- a/library/main/src/com/android/setupwizardlib/util/WizardManagerHelper.java +++ b/library/main/src/com/android/setupwizardlib/util/WizardManagerHelper.java @@ -37,8 +37,12 @@ public class WizardManagerHelper { public static final String SETTINGS_GLOBAL_DEVICE_PROVISIONED = "device_provisioned"; public static final String SETTINGS_SECURE_USER_SETUP_COMPLETE = "user_setup_complete"; + public static final String THEME_HOLO = "holo"; + public static final String THEME_HOLO_LIGHT = "holo_light"; public static final String THEME_MATERIAL = "material"; public static final String THEME_MATERIAL_LIGHT = "material_light"; + public static final String THEME_MATERIAL_BLUE = "material_blue"; + public static final String THEME_MATERIAL_BLUE_LIGHT = "material_blue_light"; /** * Get an intent that will invoke the next step of setup wizard. @@ -124,4 +128,26 @@ public class WizardManagerHelper { SETTINGS_GLOBAL_DEVICE_PROVISIONED, 0) == 1; } } + + /** + * Checks the intent whether the extra indicates that the light theme should be used or not. If + * the theme is not specified in the intent, or the theme specified is unknown, the value def + * will be returned. + * + * @param intent The intent used to start the activity, which the theme extra will be read from. + * @param def The default value if the theme is not specified. + * @return True if the activity started by the given intent should use light theme. + */ + public static boolean isLightTheme(Intent intent, boolean def) { + final String theme = intent.getStringExtra(EXTRA_THEME); + if (THEME_HOLO_LIGHT.equals(theme) || THEME_MATERIAL_LIGHT.equals(theme) + || THEME_MATERIAL_BLUE_LIGHT.equals(theme)) { + return true; + } else if (THEME_HOLO.equals(theme) || THEME_MATERIAL.equals(theme) + || THEME_MATERIAL_BLUE.equals(theme)) { + return false; + } else { + return def; + } + } } |