summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings
diff options
context:
space:
mode:
authorMaurice Lam <yukl@google.com>2015-03-03 18:27:48 -0800
committerMaurice Lam <yukl@google.com>2015-04-17 04:46:09 +0000
commitbddc56648569ed21b696ca5451cd1fc82009bb43 (patch)
treed8b008b2dde31b0e91422f659aee5e6ea0253033 /src/com/android/settings
parenta928ff4a67756341a972569a1029c0e981c9bb8d (diff)
downloadpackages_apps_Settings-bddc56648569ed21b696ca5451cd1fc82009bb43.tar.gz
packages_apps_Settings-bddc56648569ed21b696ca5451cd1fc82009bb43.tar.bz2
packages_apps_Settings-bddc56648569ed21b696ca5451cd1fc82009bb43.zip
Use SetupWizardLib helpers
Use SystemBarHelper, WizardManagerHelper and themes from Setup Wizard Library. Bug: 19594252 Change-Id: I60b6ab4f086a170ac270fb08325fc42010293523
Diffstat (limited to 'src/com/android/settings')
-rw-r--r--src/com/android/settings/SetupChooseLockGeneric.java2
-rw-r--r--src/com/android/settings/SetupChooseLockPassword.java24
-rw-r--r--src/com/android/settings/SetupChooseLockPattern.java2
-rw-r--r--src/com/android/settings/SetupEncryptionInterstitial.java2
-rw-r--r--src/com/android/settings/SetupRedactionInterstitial.java2
-rw-r--r--src/com/android/settings/SetupWizardUtils.java65
-rw-r--r--src/com/android/settings/wifi/WifiSetupActivity.java2
7 files changed, 24 insertions, 75 deletions
diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java
index a69ae380f..7a4c60c5b 100644
--- a/src/com/android/settings/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/SetupChooseLockGeneric.java
@@ -58,7 +58,7 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric
@Override
public void onNavigationBarCreated(SetupWizardNavBar bar) {
- SetupWizardUtils.setImmersiveMode(this, bar);
+ SetupWizardUtils.setImmersiveMode(this);
bar.getNextButton().setEnabled(false);
}
diff --git a/src/com/android/settings/SetupChooseLockPassword.java b/src/com/android/settings/SetupChooseLockPassword.java
index 75a4b7674..bb8d73787 100644
--- a/src/com/android/settings/SetupChooseLockPassword.java
+++ b/src/com/android/settings/SetupChooseLockPassword.java
@@ -17,6 +17,7 @@
package com.android.settings;
import com.android.setupwizard.navigationbar.SetupWizardNavBar;
+import com.android.setupwizardlib.util.SystemBarHelper;
import android.app.Fragment;
import android.content.Context;
@@ -26,7 +27,6 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.view.WindowInsets;
/**
* Setup Wizard's version of ChooseLockPassword screen. It inherits the logic and basic structure
@@ -70,7 +70,7 @@ public class SetupChooseLockPassword extends ChooseLockPassword
@Override
public void onNavigationBarCreated(SetupWizardNavBar bar) {
mNavigationBar = bar;
- SetupWizardUtils.setImmersiveMode(this, bar);
+ SetupWizardUtils.setImmersiveMode(this);
}
@Override
@@ -93,15 +93,14 @@ public class SetupChooseLockPassword extends ChooseLockPassword
}
}
- public static class SetupChooseLockPasswordFragment extends ChooseLockPasswordFragment
- implements View.OnApplyWindowInsetsListener {
+ public static class SetupChooseLockPasswordFragment extends ChooseLockPasswordFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.setup_template, container, false);
View scrollView = view.findViewById(R.id.bottom_scroll_view);
- scrollView.setOnApplyWindowInsetsListener(this);
+ SystemBarHelper.setImeInsetView(scrollView);
ViewGroup setupContent = (ViewGroup) view.findViewById(R.id.setup_content);
inflater.inflate(R.layout.setup_choose_lock_password, setupContent, true);
return view;
@@ -133,20 +132,5 @@ public class SetupChooseLockPassword extends ChooseLockPassword
SetupChooseLockPassword activity = (SetupChooseLockPassword) getActivity();
activity.mNavigationBar.getNextButton().setText(text);
}
-
- @Override
- public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
- SetupChooseLockPassword activity = (SetupChooseLockPassword) getActivity();
- final int bottomMargin = Math.max(insets.getSystemWindowInsetBottom()
- - activity.mNavigationBar.getView().getHeight(), 0);
- ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
- lp.setMargins(lp.leftMargin, lp.topMargin, lp.rightMargin, bottomMargin);
- view.setLayoutParams(lp);
- return insets.replaceSystemWindowInsets(
- insets.getSystemWindowInsetLeft(),
- insets.getSystemWindowInsetTop(),
- insets.getSystemWindowInsetRight(),
- 0 /* bottom */);
- }
}
}
diff --git a/src/com/android/settings/SetupChooseLockPattern.java b/src/com/android/settings/SetupChooseLockPattern.java
index ed5b61a72..ecf94de76 100644
--- a/src/com/android/settings/SetupChooseLockPattern.java
+++ b/src/com/android/settings/SetupChooseLockPattern.java
@@ -68,7 +68,7 @@ public class SetupChooseLockPattern extends ChooseLockPattern
@Override
public void onNavigationBarCreated(SetupWizardNavBar bar) {
mNavigationBar = bar;
- SetupWizardUtils.setImmersiveMode(this, bar);
+ SetupWizardUtils.setImmersiveMode(this);
}
@Override
diff --git a/src/com/android/settings/SetupEncryptionInterstitial.java b/src/com/android/settings/SetupEncryptionInterstitial.java
index 09c3bfc3b..8d5f613a3 100644
--- a/src/com/android/settings/SetupEncryptionInterstitial.java
+++ b/src/com/android/settings/SetupEncryptionInterstitial.java
@@ -68,7 +68,7 @@ public class SetupEncryptionInterstitial extends EncryptionInterstitial
@Override
public void onNavigationBarCreated(SetupWizardNavBar bar) {
- SetupWizardUtils.setImmersiveMode(this, bar);
+ SetupWizardUtils.setImmersiveMode(this);
}
@Override
diff --git a/src/com/android/settings/SetupRedactionInterstitial.java b/src/com/android/settings/SetupRedactionInterstitial.java
index 410804e91..266a0490c 100644
--- a/src/com/android/settings/SetupRedactionInterstitial.java
+++ b/src/com/android/settings/SetupRedactionInterstitial.java
@@ -66,7 +66,7 @@ public class SetupRedactionInterstitial extends RedactionInterstitial
@Override
public void onNavigationBarCreated(SetupWizardNavBar bar) {
- SetupWizardUtils.setImmersiveMode(this, bar);
+ SetupWizardUtils.setImmersiveMode(this);
bar.getBackButton().setEnabled(false);
}
diff --git a/src/com/android/settings/SetupWizardUtils.java b/src/com/android/settings/SetupWizardUtils.java
index 6762bfe23..d91ba13f5 100644
--- a/src/com/android/settings/SetupWizardUtils.java
+++ b/src/com/android/settings/SetupWizardUtils.java
@@ -17,43 +17,22 @@
package com.android.settings;
import com.android.settings.widget.SetupWizardIllustration;
-import com.android.setupwizard.navigationbar.SetupWizardNavBar;
-
+import com.android.setupwizardlib.util.SystemBarHelper;
+import com.android.setupwizardlib.util.WizardManagerHelper;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
-import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
-import android.view.View;
-import android.view.Window;
-import android.view.WindowManager;
import android.widget.TextView;
public class SetupWizardUtils {
private static final String TAG = "SetupWizardUtils";
- public static final int DIALOG_IMMERSIVE_FLAGS = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
-
- // Extra containing the resource name of the theme to be used
- public static final String EXTRA_THEME = "theme";
- 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";
-
- public static final String EXTRA_USE_IMMERSIVE_MODE = "useImmersiveMode";
-
// From WizardManager (must match constants maintained there)
- public static final String ACTION_NEXT = "com.android.wizard.NEXT";
public static final String EXTRA_SCRIPT_URI = "scriptUri";
- public static final String EXTRA_ACTION_ID = "actionId";
- public static final String EXTRA_RESULT_CODE = "com.android.setupwizard.ResultCode";
public static final int NEXT_REQUEST = 10000;
public static boolean isUsingWizardManager(Activity activity) {
@@ -68,21 +47,15 @@ public class SetupWizardUtils {
*/
public static void sendResultsToSetupWizard(Activity activity, int resultCode) {
final Intent intent = activity.getIntent();
- final Intent nextIntent = new Intent(ACTION_NEXT);
- nextIntent.putExtra(EXTRA_SCRIPT_URI, intent.getStringExtra(EXTRA_SCRIPT_URI));
- nextIntent.putExtra(EXTRA_ACTION_ID, intent.getStringExtra(EXTRA_ACTION_ID));
- nextIntent.putExtra(EXTRA_THEME, intent.getStringExtra(EXTRA_THEME));
- nextIntent.putExtra(EXTRA_RESULT_CODE, resultCode);
+ final Intent nextIntent = WizardManagerHelper.getNextIntent(intent, resultCode);
activity.startActivityForResult(nextIntent, NEXT_REQUEST);
}
public static int getTheme(Intent intent) {
- final String themeName = intent.getStringExtra(EXTRA_THEME);
- if (THEME_HOLO.equalsIgnoreCase(themeName) || THEME_MATERIAL.equalsIgnoreCase(themeName)
- || THEME_MATERIAL_BLUE.equalsIgnoreCase(themeName)) {
- return R.style.SetupWizardTheme;
- } else {
+ if (WizardManagerHelper.isLightTheme(intent, true)) {
return R.style.SetupWizardTheme_Light;
+ } else {
+ return R.style.SetupWizardTheme;
}
}
@@ -90,25 +63,16 @@ public class SetupWizardUtils {
* Sets the immersive mode related flags based on the extra in the intent which started the
* activity.
*/
- public static void setImmersiveMode(Activity activity, SetupWizardNavBar navBar) {
- final boolean useImmersiveMode =
- activity.getIntent().getBooleanExtra(EXTRA_USE_IMMERSIVE_MODE, false);
- navBar.setUseImmersiveMode(useImmersiveMode);
+ public static void setImmersiveMode(Activity activity) {
+ final boolean useImmersiveMode = activity.getIntent().getBooleanExtra(
+ WizardManagerHelper.EXTRA_USE_IMMERSIVE_MODE, false);
if (useImmersiveMode) {
- final Window window = activity.getWindow();
- window.setNavigationBarColor(Color.TRANSPARENT);
- window.setStatusBarColor(Color.TRANSPARENT);
+ SystemBarHelper.hideSystemBars(activity.getWindow());
}
}
public static void applyImmersiveFlags(final Dialog dialog) {
- applyImmersiveFlags(dialog.getWindow(), DIALOG_IMMERSIVE_FLAGS);
- }
-
- private static void applyImmersiveFlags(final Window window, final int vis) {
- WindowManager.LayoutParams attrs = window.getAttributes();
- attrs.systemUiVisibility |= vis;
- window.setAttributes(attrs);
+ SystemBarHelper.hideSystemBars(dialog);
}
public static TextView getHeader(Activity activity) {
@@ -124,9 +88,10 @@ public class SetupWizardUtils {
}
public static void copySetupExtras(Intent fromIntent, Intent toIntent) {
- toIntent.putExtra(EXTRA_THEME, fromIntent.getStringExtra(EXTRA_THEME));
- toIntent.putExtra(EXTRA_USE_IMMERSIVE_MODE,
- fromIntent.getBooleanExtra(EXTRA_USE_IMMERSIVE_MODE, false));
+ toIntent.putExtra(WizardManagerHelper.EXTRA_THEME,
+ fromIntent.getStringExtra(WizardManagerHelper.EXTRA_THEME));
+ toIntent.putExtra(WizardManagerHelper.EXTRA_USE_IMMERSIVE_MODE,
+ fromIntent.getBooleanExtra(WizardManagerHelper.EXTRA_USE_IMMERSIVE_MODE, false));
}
public static void setIllustration(Activity activity, int asset) {
diff --git a/src/com/android/settings/wifi/WifiSetupActivity.java b/src/com/android/settings/wifi/WifiSetupActivity.java
index d9974b43e..7d7fe3bec 100644
--- a/src/com/android/settings/wifi/WifiSetupActivity.java
+++ b/src/com/android/settings/wifi/WifiSetupActivity.java
@@ -212,7 +212,7 @@ public class WifiSetupActivity extends WifiPickerActivity
@Override
public void onNavigationBarCreated(final SetupWizardNavBar bar) {
mNavigationBar = bar;
- SetupWizardUtils.setImmersiveMode(this, bar);
+ SetupWizardUtils.setImmersiveMode(this);
}
@Override