OSDN Git Service

[Fingerprint] Help text for backup screen lock
authorMaurice Lam <yukl@google.com>
Mon, 3 Aug 2015 22:33:25 +0000 (15:33 -0700)
committerMaurice Lam <yukl@google.com>
Mon, 3 Aug 2015 23:12:09 +0000 (23:12 +0000)
Show a help text saying "Choose your backup screen lock method" when
asking the user for backup screen lock during fingerprint enrollment.

A backup translation is specified, using the source string "Set up your
backup screen lock method".

Bug: 22879473
Change-Id: I9b9348141227103e695d1fc78601745cac0309a7

res/layout/choose_lock_generic_fingerprint_header.xml [new file with mode: 0644]
res/values/strings.xml
src/com/android/settings/ChooseLockGeneric.java

diff --git a/res/layout/choose_lock_generic_fingerprint_header.xml b/res/layout/choose_lock_generic_fingerprint_header.xml
new file mode 100644 (file)
index 0000000..5ad3004
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:gravity="center_vertical"
+    android:minHeight="56dp"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:text="@string/lock_settings_picker_fingerprint_message"
+    android:textAppearance="@android:style/TextAppearance.Material.Subhead" />
index 51bc4ec..3e230b1 100644 (file)
     <!--  Title for security picker to choose the unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
     <string name="lock_settings_picker_title">Choose screen lock</string>
 
+    <!-- Message shown in screen lock picker while setting up the backup/fallback screen lock method for fingerprint. Users can choose to use this method to unlock the screen instead of fingerprint, or when fingerprint is not accepted. [CHAR LIMIT=80] [BACKUP_MESSAGE_ID=2799884038398627882] -->
+    <string name="lock_settings_picker_fingerprint_message">Choose your backup screen lock method</string>
+
     <!--  Main Security lock settings --><skip />
     <!--  Title for PreferenceScreen to launch picker for security method when there is none [CHAR LIMIT=22] -->
     <string name="unlock_set_unlock_launch_picker_title">Screen lock</string>
index 70ef4d9..1015a45 100644 (file)
@@ -38,7 +38,10 @@ import android.hardware.fingerprint.FingerprintManager;
 import android.hardware.fingerprint.FingerprintManager.RemovalCallback;
 import android.util.EventLog;
 import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
 import android.view.accessibility.AccessibilityManager;
+import android.widget.ListView;
 import android.widget.Toast;
 
 import com.android.internal.logging.MetricsLogger;
@@ -168,6 +171,18 @@ public class ChooseLockGeneric extends SettingsActivity {
         }
 
         @Override
+        public void onViewCreated(View view, Bundle savedInstanceState) {
+            super.onViewCreated(view, savedInstanceState);
+            if (mForFingerprint) {
+                final LayoutInflater inflater = LayoutInflater.from(getContext());
+                final ListView listView = getListView();
+                final View fingerprintHeader = inflater.inflate(
+                        R.layout.choose_lock_generic_fingerprint_header, listView, false);
+                listView.addHeaderView(fingerprintHeader, null, false);
+            }
+        }
+
+        @Override
         public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
                 Preference preference) {
             final String key = preference.getKey();