summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurice Lam <yukl@google.com>2014-11-25 19:25:56 -0800
committerMaurice Lam <yukl@google.com>2014-12-01 16:18:27 -0800
commit6b19fa9017800b94c75238339a337fd8f6c3e808 (patch)
treed3173e4dd1cf5b45a148a913b66c51bf1bb8b431
parentc868f7035a6d05332b3d8afcde2ae27ad0413e79 (diff)
downloadpackages_apps_Settings-6b19fa9017800b94c75238339a337fd8f6c3e808.zip
packages_apps_Settings-6b19fa9017800b94c75238339a337fd8f6c3e808.tar.gz
packages_apps_Settings-6b19fa9017800b94c75238339a337fd8f6c3e808.tar.bz2
[FRP] Theming for Pattern and Password screens
Basic theming for pattern and password screens. Create subclasses for ChooseLockPassword and ChooseLockPattern, and copied their XML layouts. This CL mainly uses the buttons in the original screens as-is, with a follow-up CL coming to change to use the nav bar buttons. Bug: 18482708 Change-Id: I81751f781de633aff23fc68657589360007c235a
-rw-r--r--AndroidManifest.xml9
-rw-r--r--res/layout-land/setup_template.xml68
-rw-r--r--res/layout-sw600dp-land/setup_template.xml74
-rw-r--r--res/layout-sw600dp/setup_template.xml74
-rw-r--r--res/layout/setup_choose_lock_password.xml83
-rw-r--r--res/layout/setup_choose_lock_pattern.xml82
-rw-r--r--res/layout/setup_template.xml75
-rw-r--r--src/com/android/settings/ChooseLockGeneric.java25
-rw-r--r--src/com/android/settings/ChooseLockPassword.java14
-rw-r--r--src/com/android/settings/ChooseLockPattern.java14
-rw-r--r--src/com/android/settings/SetupChooseLockGeneric.java22
-rw-r--r--src/com/android/settings/SetupChooseLockPassword.java90
-rw-r--r--src/com/android/settings/SetupChooseLockPattern.java88
-rw-r--r--src/com/android/settings/SetupWizardUtils.java6
14 files changed, 708 insertions, 16 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5c889f4..82b135f 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1159,8 +1159,17 @@
android:excludeFromRecents="true"
/>
+ <activity android:name="SetupChooseLockPattern"
+ android:exported="false"
+ android:theme="@style/SetupWizardDisableAppStartingTheme" />
+
<activity android:name="ChooseLockPattern" android:exported="false"/>
+ <activity android:name="SetupChooseLockPassword"
+ android:exported="false"
+ android:theme="@style/SetupWizardDisableAppStartingTheme"
+ android:windowSoftInputMode="stateVisible|adjustResize" />
+
<activity android:name="ChooseLockPassword" android:exported="false"
android:windowSoftInputMode="stateVisible|adjustResize"/>
diff --git a/res/layout-land/setup_template.xml b/res/layout-land/setup_template.xml
new file mode 100644
index 0000000..cc3402f
--- /dev/null
+++ b/res/layout-land/setup_template.xml
@@ -0,0 +1,68 @@
+<?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.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <RelativeLayout
+ android:layout_weight="1"
+ android:layout_width="match_parent"
+ android:layout_height="0dp">
+
+ <FrameLayout
+ android:id="@+id/title_area"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:background="@drawable/setup_illustration_bg"
+ android:elevation="@dimen/setup_wizard_title_area_elevation">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/wifi_setup_title"
+ style="@style/SetupTitle"/>
+ </FrameLayout>
+
+ <ScrollView
+ android:id="@+id/bottom_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/title_area"
+ android:layout_alignParentBottom="true"
+ android:fillViewport="true">
+
+ <FrameLayout android:id="@+id/setup_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"/>
+
+ </ScrollView>
+
+ </RelativeLayout>
+
+ <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
+ android:id="@+id/navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="56dip"
+ style="@style/setup_wizard_navbar_style"/>
+</LinearLayout>
+
diff --git a/res/layout-sw600dp-land/setup_template.xml b/res/layout-sw600dp-land/setup_template.xml
new file mode 100644
index 0000000..33c31a5
--- /dev/null
+++ b/res/layout-sw600dp-land/setup_template.xml
@@ -0,0 +1,74 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <com.android.settings.widget.SetupWizardIllustration
+ android:id="@+id/illustration_tablet"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/setup_illustration_bg"
+ android:foreground="@drawable/setup_illustration_wifi_wide">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="start|top"
+ android:weightSum="16">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height"
+ android:layout_weight="6"
+ android:text="@string/wifi_setup_title"
+ style="@style/SetupCardTitle"/>
+
+ <ScrollView
+ android:id="@+id/bottom_scroll_view"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/setup_wizard_card_land_margin_top"
+ android:layout_weight="8"
+ android:background="@drawable/setup_wizard_card_bg"
+ android:elevation="@dimen/setup_wizard_card_elevation"
+ android:fillViewport="true">
+
+ <FrameLayout android:id="@+id/setup_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"/>
+
+ </ScrollView>
+
+ </LinearLayout>
+
+ </com.android.settings.widget.SetupWizardIllustration>
+
+ <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
+ android:id="@+id/navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="56dip"
+ style="@style/setup_wizard_navbar_style"/>
+
+</LinearLayout>
+
diff --git a/res/layout-sw600dp/setup_template.xml b/res/layout-sw600dp/setup_template.xml
new file mode 100644
index 0000000..eb210b7
--- /dev/null
+++ b/res/layout-sw600dp/setup_template.xml
@@ -0,0 +1,74 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <com.android.settings.widget.SetupWizardIllustration
+ android:id="@+id/illustration_tablet"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/setup_illustration_bg"
+ android:foreground="@drawable/setup_illustration_wifi_wide">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/setup_wizard_tablet_illustration_height"
+ android:orientation="vertical"
+ android:paddingStart="@dimen/setup_wizard_card_port_margin_sides"
+ android:paddingEnd="@dimen/setup_wizard_card_port_margin_sides">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/wifi_setup_title"
+ style="@style/SetupCardTitle"/>
+
+ <ScrollView
+ android:id="@+id/bottom_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@drawable/setup_wizard_card_bg"
+ android:elevation="@dimen/setup_wizard_card_elevation"
+ android:fillViewport="true">
+
+ <FrameLayout
+ android:id="@+id/setup_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false"/>
+
+ </ScrollView>
+
+ </LinearLayout>
+
+ </com.android.settings.widget.SetupWizardIllustration>
+
+ <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
+ android:id="@+id/navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="56dip"
+ style="@style/setup_wizard_navbar_style"/>
+
+</LinearLayout>
+
diff --git a/res/layout/setup_choose_lock_password.xml b/res/layout/setup_choose_lock_password.xml
new file mode 100644
index 0000000..b1ac02b
--- /dev/null
+++ b/res/layout/setup_choose_lock_password.xml
@@ -0,0 +1,83 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+
+ <!-- header text ('Enter Pin') -->
+ <TextView android:id="@+id/headerText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:lines="2"
+ android:textAppearance="?android:attr/textAppearanceMedium"/>
+
+ <!-- Password entry field -->
+ <EditText android:id="@+id/password_entry"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginStart="30dip"
+ android:layout_marginEnd="30dip"
+ android:gravity="center"
+ android:inputType="textPassword"
+ android:imeOptions="actionNext"
+ android:textSize="24sp"
+ style="@style/TextAppearance.PasswordEntry"/>
+
+ <!-- Spacer between password entry and keyboard -->
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ style="@style/SecurityPreferenceButtonContainer">
+
+ <!-- left : cancel -->
+ <Button android:id="@+id/cancel_button"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/lockpassword_cancel_label"
+ style="@style/SecurityPreferenceButton"/>
+
+ <!-- right : continue -->
+ <Button android:id="@+id/next_button"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/lockpassword_continue_label"
+ style="@style/SecurityPreferenceButton"/>
+
+ </LinearLayout>
+
+ <!-- Alphanumeric keyboard -->
+ <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#00000000"
+ android:keyBackground="@*android:drawable/btn_keyboard_key_fulltrans"
+ android:visibility="gone"/>
+
+</LinearLayout>
diff --git a/res/layout/setup_choose_lock_pattern.xml b/res/layout/setup_choose_lock_pattern.xml
new file mode 100644
index 0000000..5992126
--- /dev/null
+++ b/res/layout/setup_choose_lock_pattern.xml
@@ -0,0 +1,82 @@
+<?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.
+-->
+
+<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/topLayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <!-- takes up all space above button bar at bottom -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:orientation="vertical">
+
+ <TextView android:id="@+id/headerText"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:minHeight="50dp"
+ android:textSize="18sp"/>
+
+ <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="4"
+ android:background="@color/lock_pattern_background"/>
+
+ <TextView android:id="@+id/footerText"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:minHeight="50dp"
+ android:textSize="14sp"/>
+
+ </LinearLayout>
+
+ <!-- Buttons are hidden during setup, and use the buttons in setup navigation bar instead -->
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ style="@style/SecurityPreferenceButtonContainer">
+
+ <!-- left : cancel, or re-try -->
+ <Button android:id="@+id/footerLeftButton"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/lockpattern_tutorial_cancel_label"
+ style="@style/SecurityPreferenceButton"/>
+
+ <!-- right : confirm or ok -->
+ <Button android:id="@+id/footerRightButton"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/lockpattern_tutorial_continue_label"
+ style="@style/SecurityPreferenceButton"/>
+
+ </LinearLayout>
+
+</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
diff --git a/res/layout/setup_template.xml b/res/layout/setup_template.xml
new file mode 100644
index 0000000..7d8ffc8
--- /dev/null
+++ b/res/layout/setup_template.xml
@@ -0,0 +1,75 @@
+<?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.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <ScrollView
+ android:id="@+id/bottom_scroll_view"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:fillViewport="true">
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:clipChildren="false">
+
+ <com.android.settings.widget.SetupWizardIllustration
+ android:id="@+id/illustration_phone"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:elevation="@dimen/setup_wizard_title_area_elevation"
+ android:background="@drawable/setup_illustration_bg"
+ android:foreground="@drawable/setup_illustration_wifi"
+ android:tag="stickyContainer"
+ settings:aspectRatio="2.22">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:tag="sticky"
+ android:text="@string/wifi_setup_title"
+ style="@style/SetupTitle"/>
+
+ </com.android.settings.widget.SetupWizardIllustration>
+
+ <FrameLayout
+ android:id="@+id/setup_content"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/illustration_phone"
+ android:clipChildren="false"/>
+
+ </RelativeLayout>
+
+ </ScrollView>
+
+ <fragment android:name="com.android.setupwizard.navigationbar.SetupWizardNavBar"
+ android:id="@+id/navigation_bar"
+ android:layout_width="match_parent"
+ android:layout_height="56dip"
+ style="@style/setup_wizard_navbar_style"/>
+
+</LinearLayout>
+
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index b242517..1f2f2b3 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -18,7 +18,6 @@ package com.android.settings;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.Activity;
-import android.app.ActivityManagerNative;
import android.app.Fragment;
import android.app.PendingIntent;
import android.app.admin.DevicePolicyManager;
@@ -27,8 +26,6 @@ import android.content.Intent;
import android.content.pm.UserInfo;
import android.os.Bundle;
import android.os.Process;
-import android.os.RemoteException;
-import android.os.UserHandle;
import android.os.UserManager;
import android.preference.Preference;
import android.preference.PreferenceScreen;
@@ -404,6 +401,19 @@ public class ChooseLockGeneric extends SettingsActivity {
return intent;
}
+ protected Intent getLockPasswordIntent(Context context, int quality,
+ final boolean isFallback, int minLength, final int maxLength,
+ boolean requirePasswordToDecrypt, boolean confirmCredentials) {
+ return ChooseLockPassword.createIntent(context, quality, isFallback, minLength,
+ maxLength, requirePasswordToDecrypt, confirmCredentials);
+ }
+
+ protected Intent getLockPatternIntent(Context context, final boolean isFallback,
+ final boolean requirePassword, final boolean confirmCredentials) {
+ return ChooseLockPattern.createIntent(context, isFallback, requirePassword,
+ confirmCredentials);
+ }
+
/**
* Invokes an activity to change the user's pattern, password or PIN based on given quality
* and minimum quality specified by DevicePolicyManager. If quality is
@@ -424,14 +434,15 @@ public class ChooseLockGeneric extends SettingsActivity {
quality = upgradeQuality(quality, null);
+ final Context context = getActivity();
if (quality >= DevicePolicyManager.PASSWORD_QUALITY_NUMERIC) {
int minLength = mDPM.getPasswordMinimumLength(null);
if (minLength < MIN_PASSWORD_LENGTH) {
minLength = MIN_PASSWORD_LENGTH;
}
final int maxLength = mDPM.getPasswordMaximumLength(quality);
- Intent intent = ChooseLockPassword.createIntent(getActivity(), quality, isFallback,
- minLength, maxLength, mRequirePassword, false /* confirm credentials */);
+ Intent intent = getLockPasswordIntent(context, quality, isFallback, minLength,
+ maxLength, mRequirePassword, /* confirm credentials */false);
if (isFallback) {
startActivityForResult(intent, FALLBACK_REQUEST);
return;
@@ -441,8 +452,8 @@ public class ChooseLockGeneric extends SettingsActivity {
startActivity(intent);
}
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
- Intent intent = ChooseLockPattern.createIntent(getActivity(),
- isFallback, mRequirePassword, false /* confirm credentials */);
+ Intent intent = getLockPatternIntent(context, isFallback, mRequirePassword,
+ /* confirm credentials */false);
if (isFallback) {
startActivityForResult(intent, FALLBACK_REQUEST);
return;
diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java
index 861930a..dbf6d2f 100644
--- a/src/com/android/settings/ChooseLockPassword.java
+++ b/src/com/android/settings/ChooseLockPassword.java
@@ -61,7 +61,7 @@ public class ChooseLockPassword extends SettingsActivity {
@Override
public Intent getIntent() {
Intent modIntent = new Intent(super.getIntent());
- modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPasswordFragment.class.getName());
+ modIntent.putExtra(EXTRA_SHOW_FRAGMENT, getFragmentClass().getName());
return modIntent;
}
@@ -84,6 +84,10 @@ public class ChooseLockPassword extends SettingsActivity {
return false;
}
+ /* package */ Class<? extends Fragment> getFragmentClass() {
+ return ChooseLockPasswordFragment.class;
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO: Fix on phones
@@ -200,8 +204,12 @@ public class ChooseLockPassword extends SettingsActivity {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.choose_lock_password, container, false);
+ }
- View view = inflater.inflate(R.layout.choose_lock_password, null);
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
mCancelButton = (Button) view.findViewById(R.id.cancel_button);
mCancelButton.setOnClickListener(this);
@@ -254,8 +262,6 @@ public class ChooseLockPassword extends SettingsActivity {
CharSequence title = getText(id);
sa.setTitle(title);
}
-
- return view;
}
@Override
diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java
index 2c3beef..d055184 100644
--- a/src/com/android/settings/ChooseLockPattern.java
+++ b/src/com/android/settings/ChooseLockPattern.java
@@ -65,7 +65,7 @@ public class ChooseLockPattern extends SettingsActivity {
@Override
public Intent getIntent() {
Intent modIntent = new Intent(super.getIntent());
- modIntent.putExtra(EXTRA_SHOW_FRAGMENT, ChooseLockPatternFragment.class.getName());
+ modIntent.putExtra(EXTRA_SHOW_FRAGMENT, getFragmentClass().getName());
return modIntent;
}
@@ -85,6 +85,10 @@ public class ChooseLockPattern extends SettingsActivity {
return false;
}
+ /* package */ Class<? extends Fragment> getFragmentClass() {
+ return ChooseLockPatternFragment.class;
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
// requestWindowFeature(Window.FEATURE_NO_TITLE);
@@ -327,9 +331,12 @@ public class ChooseLockPattern extends SettingsActivity {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.choose_lock_pattern, container, false);
+ }
- // setupViews()
- View view = inflater.inflate(R.layout.choose_lock_pattern, null);
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
mHeaderText = (TextView) view.findViewById(R.id.headerText);
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
@@ -377,7 +384,6 @@ public class ChooseLockPattern extends SettingsActivity {
updateStage(Stage.values()[savedInstanceState.getInt(KEY_UI_STAGE)]);
}
mDone = false;
- return view;
}
public void onClick(View v) {
diff --git a/src/com/android/settings/SetupChooseLockGeneric.java b/src/com/android/settings/SetupChooseLockGeneric.java
index c451ea4..def8593 100644
--- a/src/com/android/settings/SetupChooseLockGeneric.java
+++ b/src/com/android/settings/SetupChooseLockGeneric.java
@@ -18,7 +18,8 @@ package com.android.settings;
import com.android.setupwizard.navigationbar.SetupWizardNavBar;
-
+import android.content.Context;
+import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.PreferenceFragment;
@@ -81,5 +82,24 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric
super.onViewCreated(view, savedInstanceState);
SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
}
+
+ @Override
+ protected Intent getLockPasswordIntent(Context context, int quality, boolean isFallback,
+ int minLength, int maxLength, boolean requirePasswordToDecrypt,
+ boolean confirmCredentials) {
+ final Intent intent = SetupChooseLockPassword.createIntent(context, quality,
+ isFallback, minLength, maxLength, requirePasswordToDecrypt, confirmCredentials);
+ SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent);
+ return intent;
+ }
+
+ @Override
+ protected Intent getLockPatternIntent(Context context, boolean isFallback,
+ boolean requirePassword, boolean confirmCredentials) {
+ final Intent intent = SetupChooseLockPattern.createIntent(context, isFallback,
+ requirePassword, confirmCredentials);
+ SetupWizardUtils.copySetupExtras(getActivity().getIntent(), intent);
+ return intent;
+ }
}
}
diff --git a/src/com/android/settings/SetupChooseLockPassword.java b/src/com/android/settings/SetupChooseLockPassword.java
new file mode 100644
index 0000000..5366a55
--- /dev/null
+++ b/src/com/android/settings/SetupChooseLockPassword.java
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+package com.android.settings;
+
+import com.android.setupwizard.navigationbar.SetupWizardNavBar;
+
+import android.app.Fragment;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class SetupChooseLockPassword extends ChooseLockPassword
+ implements SetupWizardNavBar.NavigationBarListener {
+
+ public static Intent createIntent(Context context, int quality, final boolean isFallback,
+ int minLength, final int maxLength, boolean requirePasswordToDecrypt,
+ boolean confirmCredentials) {
+ Intent intent = ChooseLockPassword.createIntent(context, quality, isFallback, minLength,
+ maxLength, requirePasswordToDecrypt, confirmCredentials);
+ intent.setClass(context, SetupChooseLockPassword.class);
+ intent.putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, false);
+ return intent;
+ }
+
+ @Override
+ protected boolean isValidFragment(String fragmentName) {
+ return SetupChooseLockPasswordFragment.class.getName().equals(fragmentName);
+ }
+
+ @Override
+ /* package */ Class<? extends Fragment> getFragmentClass() {
+ return SetupChooseLockPasswordFragment.class;
+ }
+
+ @Override
+ protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
+ resid = SetupWizardUtils.getTheme(getIntent(), resid);
+ super.onApplyThemeResource(theme, resid, first);
+ }
+
+ @Override
+ public void onNavigationBarCreated(SetupWizardNavBar bar) {
+ SetupWizardUtils.setImmersiveMode(this, bar);
+ }
+
+ @Override
+ public void onNavigateBack() {
+ onBackPressed();
+ }
+
+ @Override
+ public void onNavigateNext() {
+ }
+
+ 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);
+ ViewGroup setupContent = (ViewGroup) view.findViewById(R.id.setup_content);
+ inflater.inflate(R.layout.setup_choose_lock_password, setupContent, true);
+ return view;
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
+ }
+ }
+}
diff --git a/src/com/android/settings/SetupChooseLockPattern.java b/src/com/android/settings/SetupChooseLockPattern.java
new file mode 100644
index 0000000..019f434
--- /dev/null
+++ b/src/com/android/settings/SetupChooseLockPattern.java
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+package com.android.settings;
+
+import com.android.setupwizard.navigationbar.SetupWizardNavBar;
+
+import android.app.Fragment;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class SetupChooseLockPattern extends ChooseLockPattern
+ implements SetupWizardNavBar.NavigationBarListener {
+
+ public static Intent createIntent(Context context, final boolean isFallback,
+ boolean requirePassword, boolean confirmCredentials) {
+ Intent intent = ChooseLockPattern.createIntent(context, isFallback, requirePassword,
+ confirmCredentials);
+ intent.setClass(context, SetupChooseLockPattern.class);
+ return intent;
+ }
+
+ @Override
+ protected boolean isValidFragment(String fragmentName) {
+ return SetupChooseLockPatternFragment.class.getName().equals(fragmentName);
+ }
+
+ @Override
+ /* package */ Class<? extends Fragment> getFragmentClass() {
+ return SetupChooseLockPatternFragment.class;
+ }
+
+ @Override
+ protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
+ resid = SetupWizardUtils.getTheme(getIntent(), resid);
+ super.onApplyThemeResource(theme, resid, first);
+ }
+
+ @Override
+ public void onNavigationBarCreated(SetupWizardNavBar bar) {
+ SetupWizardUtils.setImmersiveMode(this, bar);
+ }
+
+ @Override
+ public void onNavigateBack() {
+ onBackPressed();
+ }
+
+ @Override
+ public void onNavigateNext() {
+ }
+
+ public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment {
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ final View view = inflater.inflate(R.layout.setup_template, container, false);
+ ViewGroup setupContent = (ViewGroup) view.findViewById(R.id.setup_content);
+ inflater.inflate(R.layout.setup_choose_lock_pattern, setupContent, true);
+ return view;
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
+ }
+ }
+}
diff --git a/src/com/android/settings/SetupWizardUtils.java b/src/com/android/settings/SetupWizardUtils.java
index 48eb4b8..0f54e63 100644
--- a/src/com/android/settings/SetupWizardUtils.java
+++ b/src/com/android/settings/SetupWizardUtils.java
@@ -103,4 +103,10 @@ public class SetupWizardUtils {
public static void setHeaderText(Activity activity, CharSequence text) {
getHeader(activity).setText(text);
}
+
+ 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));
+ }
}