diff options
author | Maurice Lam <yukl@google.com> | 2015-03-03 18:27:48 -0800 |
---|---|---|
committer | Maurice Lam <yukl@google.com> | 2015-04-17 04:46:09 +0000 |
commit | bddc56648569ed21b696ca5451cd1fc82009bb43 (patch) | |
tree | d8b008b2dde31b0e91422f659aee5e6ea0253033 | |
parent | a928ff4a67756341a972569a1029c0e981c9bb8d (diff) | |
download | packages_apps_Settings-bddc56648569ed21b696ca5451cd1fc82009bb43.zip packages_apps_Settings-bddc56648569ed21b696ca5451cd1fc82009bb43.tar.gz packages_apps_Settings-bddc56648569ed21b696ca5451cd1fc82009bb43.tar.bz2 |
Use SetupWizardLib helpers
Use SystemBarHelper, WizardManagerHelper and themes from Setup Wizard
Library.
Bug: 19594252
Change-Id: I60b6ab4f086a170ac270fb08325fc42010293523
-rw-r--r-- | res/anim-ldrtl/slide_back_in.xml | 22 | ||||
-rw-r--r-- | res/anim-ldrtl/slide_back_out.xml | 22 | ||||
-rw-r--r-- | res/anim-ldrtl/slide_next_in.xml | 22 | ||||
-rw-r--r-- | res/anim-ldrtl/slide_next_out.xml | 22 | ||||
-rw-r--r-- | res/anim/slide_back_in.xml | 22 | ||||
-rw-r--r-- | res/anim/slide_back_out.xml | 22 | ||||
-rw-r--r-- | res/anim/slide_next_in.xml | 22 | ||||
-rw-r--r-- | res/anim/slide_next_out.xml | 22 | ||||
-rw-r--r-- | res/values/colors.xml | 4 | ||||
-rw-r--r-- | res/values/themes.xml | 17 | ||||
-rw-r--r-- | src/com/android/settings/SetupChooseLockGeneric.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/SetupChooseLockPassword.java | 24 | ||||
-rw-r--r-- | src/com/android/settings/SetupChooseLockPattern.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/SetupEncryptionInterstitial.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/SetupRedactionInterstitial.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/SetupWizardUtils.java | 65 | ||||
-rw-r--r-- | src/com/android/settings/wifi/WifiSetupActivity.java | 2 |
17 files changed, 27 insertions, 269 deletions
diff --git a/res/anim-ldrtl/slide_back_in.xml b/res/anim-ldrtl/slide_back_in.xml deleted file mode 100644 index e5ab3e5..0000000 --- a/res/anim-ldrtl/slide_back_in.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<translate xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="@integer/setup_wizard_transition_duration" - android:fromXDelta="100%" - android:toXDelta="0%" - android:interpolator="@android:anim/decelerate_interpolator"/> diff --git a/res/anim-ldrtl/slide_back_out.xml b/res/anim-ldrtl/slide_back_out.xml deleted file mode 100644 index 8717f6a..0000000 --- a/res/anim-ldrtl/slide_back_out.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<translate xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="@integer/setup_wizard_transition_duration" - android:fromXDelta="0%" - android:toXDelta="-100%" - android:interpolator="@android:anim/decelerate_interpolator"/> diff --git a/res/anim-ldrtl/slide_next_in.xml b/res/anim-ldrtl/slide_next_in.xml deleted file mode 100644 index 009ea9f..0000000 --- a/res/anim-ldrtl/slide_next_in.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<translate xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="@integer/setup_wizard_transition_duration" - android:fromXDelta="-100%" - android:toXDelta="0%" - android:interpolator="@android:anim/decelerate_interpolator"/> diff --git a/res/anim-ldrtl/slide_next_out.xml b/res/anim-ldrtl/slide_next_out.xml deleted file mode 100644 index b7ab2b6..0000000 --- a/res/anim-ldrtl/slide_next_out.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<translate xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="@integer/setup_wizard_transition_duration" - android:fromXDelta="0%" - android:toXDelta="100%" - android:interpolator="@android:anim/decelerate_interpolator"/> diff --git a/res/anim/slide_back_in.xml b/res/anim/slide_back_in.xml deleted file mode 100644 index 009ea9f..0000000 --- a/res/anim/slide_back_in.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<translate xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="@integer/setup_wizard_transition_duration" - android:fromXDelta="-100%" - android:toXDelta="0%" - android:interpolator="@android:anim/decelerate_interpolator"/> diff --git a/res/anim/slide_back_out.xml b/res/anim/slide_back_out.xml deleted file mode 100644 index b7ab2b6..0000000 --- a/res/anim/slide_back_out.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<translate xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="@integer/setup_wizard_transition_duration" - android:fromXDelta="0%" - android:toXDelta="100%" - android:interpolator="@android:anim/decelerate_interpolator"/> diff --git a/res/anim/slide_next_in.xml b/res/anim/slide_next_in.xml deleted file mode 100644 index e5ab3e5..0000000 --- a/res/anim/slide_next_in.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<translate xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="@integer/setup_wizard_transition_duration" - android:fromXDelta="100%" - android:toXDelta="0%" - android:interpolator="@android:anim/decelerate_interpolator"/> diff --git a/res/anim/slide_next_out.xml b/res/anim/slide_next_out.xml deleted file mode 100644 index 8717f6a..0000000 --- a/res/anim/slide_next_out.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2014 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<translate xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="@integer/setup_wizard_transition_duration" - android:fromXDelta="0%" - android:toXDelta="-100%" - android:interpolator="@android:anim/decelerate_interpolator"/> diff --git a/res/values/colors.xml b/res/values/colors.xml index 88cd3cb..dd7382f 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -44,11 +44,9 @@ <color name="setup_lock_pattern_view_regular_color_dark">#ffbdbdbd</color> <color name="setup_lock_pattern_view_regular_color_light">@color/lock_pattern_view_regular_color</color> <color name="setup_lock_pattern_view_success_color_dark">#ff84ffff</color> - <color name="setup_lock_pattern_view_success_color_light">@color/setup_wizard_color_accent_light</color> + <color name="setup_lock_pattern_view_success_color_light">@color/suw_color_accent_light</color> <color name="setup_lock_pattern_view_error_color_dark">#fff44336</color> <color name="setup_lock_pattern_view_error_color_light">@color/lock_pattern_view_error_color</color> - <color name="setup_wizard_color_accent_dark">#ff00e4ff</color> - <color name="setup_wizard_color_accent_light">#ff00828e</color> <color name="setup_wizard_wifi_color_dark">#ff00e4ff</color> <color name="setup_wizard_wifi_color_light">#ff0096a6</color> diff --git a/res/values/themes.xml b/res/values/themes.xml index 379c36a..0d28126 100644 --- a/res/values/themes.xml +++ b/res/values/themes.xml @@ -29,14 +29,11 @@ <item name="android:windowBackground">@null</item> </style> - <style name="SetupWizardTheme" parent="android:Theme.Material.NoActionBar"> + <style name="SetupWizardTheme" parent="SuwThemeMaterial"> <item name="android:alertDialogTheme">@style/Theme.WifiDialog</item> - <item name="android:colorAccent">@color/setup_wizard_color_accent_dark</item> <item name="android:listPreferredItemPaddingEnd">@dimen/setup_wizard_margin_sides</item> <item name="android:listPreferredItemPaddingStart">@dimen/setup_wizard_margin_sides</item> - <item name="android:windowAnimationStyle">@style/Animation.SetupWizard</item> <item name="android:windowBackground">?android:attr/colorBackground</item> - <item name="android:windowSoftInputMode">adjustPan</item> <item name="@*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item> <item name="ic_menu_add">@drawable/ic_menu_add_dark</item> <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item> @@ -53,14 +50,11 @@ <item name="@*android:errorColor">@color/setup_lock_pattern_view_error_color_dark</item> </style> - <style name="SetupWizardTheme.Light" parent="android:Theme.Material.Light.NoActionBar"> + <style name="SetupWizardTheme.Light" parent="SuwThemeMaterial.Light"> <item name="android:alertDialogTheme">@style/Theme.Light.WifiDialog</item> - <item name="android:colorAccent">@color/setup_wizard_color_accent_light</item> <item name="android:listPreferredItemPaddingEnd">@dimen/setup_wizard_margin_sides</item> <item name="android:listPreferredItemPaddingStart">@dimen/setup_wizard_margin_sides</item> - <item name="android:windowAnimationStyle">@style/Animation.SetupWizard</item> <item name="android:windowBackground">?android:attr/colorBackground</item> - <item name="android:windowSoftInputMode">adjustPan</item> <item name="@*android:preferencePanelStyle">@*android:style/PreferencePanel.Dialog</item> <item name="ic_menu_add">@drawable/ic_menu_add_light</item> <item name="ic_menu_moreoverflow">@*android:drawable/ic_menu_moreoverflow_material</item> @@ -77,13 +71,6 @@ <item name="@*android:errorColor">@color/setup_lock_pattern_view_error_color_light</item> </style> - <style name="Animation.SetupWizard" parent="@android:style/Animation.Activity"> - <item name="android:activityOpenEnterAnimation">@anim/slide_next_in</item> - <item name="android:activityOpenExitAnimation">@anim/slide_next_out</item> - <item name="android:activityCloseEnterAnimation">@anim/slide_back_in</item> - <item name="android:activityCloseExitAnimation">@anim/slide_back_out</item> - </style> - <style name="Theme.WifiDialog" parent="@*android:style/Theme.Material.Dialog.Alert"> <item name="android:windowSoftInputMode">adjustResize</item> <item name="ic_menu_add">@drawable/ic_menu_add_dark</item> diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java index a69ae38..7a4c60c 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 75a4b76..bb8d737 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 ed5b61a..ecf94de 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 09c3bfc..8d5f613 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 410804e..266a049 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 6762bfe..d91ba13 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 d9974b4..7d7fe3b 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 |