Update fingerprint settings to spec
- Make it look like a sub settings activity, with back button - Add disclaimer to describe what your fingerprint can be used for - Update visuals and text for "Add fingerprint" - Update related string Bug: 20594955 Change-Id: I0adfcc743db386e0abf9cfdafff3d068ebc3b4bc
This commit is contained in:
24
res/drawable/ic_add_24dp.xml
Normal file
24
res/drawable/ic_add_24dp.xml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<!--
|
||||||
|
~ 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
|
||||||
|
-->
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24.0dp"
|
||||||
|
android:height="24.0dp"
|
||||||
|
android:viewportWidth="48.0"
|
||||||
|
android:viewportHeight="48.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="?android:attr/colorAccent"
|
||||||
|
android:pathData="M38.0,26.0L26.0,26.0l0.0,12.0l-4.0,0.0L22.0,26.0L10.0,26.0l0.0,-4.0l12.0,0.0L22.0,10.0l4.0,0.0l0.0,12.0l12.0,0.0l0.0,4.0z"/>
|
||||||
|
</vector>
|
27
res/layout/fingerprint_settings_footer.xml
Normal file
27
res/layout/fingerprint_settings_footer.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?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"
|
||||||
|
style="@android:style/TextAppearance.Material.Body1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:paddingTop="32dp"
|
||||||
|
android:paddingStart="16dp"
|
||||||
|
android:paddingEnd="16dp"
|
||||||
|
android:selectable="false">
|
||||||
|
</TextView>
|
@@ -740,7 +740,7 @@
|
|||||||
<!-- Fingerprint category title - configuration options for managing fingerprint enrollment [CHAR LIMIT=22] -->
|
<!-- Fingerprint category title - configuration options for managing fingerprint enrollment [CHAR LIMIT=22] -->
|
||||||
<string name="fingerprint_usage_category_title">Use fingerprint for</string>
|
<string name="fingerprint_usage_category_title">Use fingerprint for</string>
|
||||||
<!-- Preference to add another fingerprint -->
|
<!-- Preference to add another fingerprint -->
|
||||||
<string name="fingerprint_add_title">Add</string>
|
<string name="fingerprint_add_title">Add fingerprint</string>
|
||||||
<!-- switch for allowing fingerprint to be used for keyguard -->
|
<!-- switch for allowing fingerprint to be used for keyguard -->
|
||||||
<string name="fingerprint_enable_keyguard_toggle_title">screen lock</string>
|
<string name="fingerprint_enable_keyguard_toggle_title">screen lock</string>
|
||||||
<!-- message shown for menu item that launches fingerprint settings or enrollment -->
|
<!-- message shown for menu item that launches fingerprint settings or enrollment -->
|
||||||
@@ -752,7 +752,7 @@
|
|||||||
<string name="security_settings_fingerprint_enroll_onboard_title">Fingerprint setup</string>
|
<string name="security_settings_fingerprint_enroll_onboard_title">Fingerprint setup</string>
|
||||||
<!-- Introduction message shown in fingerprint enrollment dialog when the user needs to choose an
|
<!-- Introduction message shown in fingerprint enrollment dialog when the user needs to choose an
|
||||||
alternate screen unlock (pin, pattern or password) as a backup to fingerprint. -->
|
alternate screen unlock (pin, pattern or password) as a backup to fingerprint. -->
|
||||||
<string name="security_settings_fingerprint_enroll_onboard_message">To use your fingerprint to unlock your screen or confirm purchases, we\'ll need to:</string>
|
<string name="security_settings_fingerprint_enroll_onboard_message">To use your fingerprint to unlock your screen or confirm purchases, you\'ll need to:</string>
|
||||||
<!-- Introduction message shown in fingerprint enrollment dialog, first item to describe what
|
<!-- Introduction message shown in fingerprint enrollment dialog, first item to describe what
|
||||||
the user needs to do. -->
|
the user needs to do. -->
|
||||||
<string name="security_settings_fingerprint_enroll_onboard_message_1">Setup your backup screen lock method</string>
|
<string name="security_settings_fingerprint_enroll_onboard_message_1">Setup your backup screen lock method</string>
|
||||||
@@ -796,6 +796,10 @@
|
|||||||
<string name="fingerprint_enroll_button_add">Add another</string>
|
<string name="fingerprint_enroll_button_add">Add another</string>
|
||||||
<!-- Button text shown at the end of enrollment that allows the user to move to the next step -->
|
<!-- Button text shown at the end of enrollment that allows the user to move to the next step -->
|
||||||
<string name="fingerprint_enroll_button_next">Next</string>
|
<string name="fingerprint_enroll_button_next">Next</string>
|
||||||
|
<!-- Text shown in fingerprint settings explaining what the fingerprint can be used for. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="security_settings_fingerprint_enroll_disclaimer">In addition to unlocking your phone, you can also use your fingerprint to authorize purchases and app access. <annotation id="url">Learn more</annotation></string>
|
||||||
|
<!-- Text shown in fingerprint settings explaining what the fingerprint can be used for in the case unlocking is disabled [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="security_settings_fingerprint_enroll_disclaimer_lockscreen_disabled">Screen lock option disabled. You can still use your fingerprint to authorize purchases and app access. <annotation id="url">Learn more</annotation></string>
|
||||||
|
|
||||||
<!-- Title of the preferences category for preference items to control encryption -->
|
<!-- Title of the preferences category for preference items to control encryption -->
|
||||||
<string name="crypt_keeper_settings_title">Encryption</string>
|
<string name="crypt_keeper_settings_title">Encryption</string>
|
||||||
@@ -5625,6 +5629,8 @@
|
|||||||
<string name="help_url_nfc_payment" translatable="false"></string>
|
<string name="help_url_nfc_payment" translatable="false"></string>
|
||||||
<!-- Help URL, Remote display [DO NOT TRANSLATE] -->
|
<!-- Help URL, Remote display [DO NOT TRANSLATE] -->
|
||||||
<string name="help_url_remote_display" translatable="false"></string>
|
<string name="help_url_remote_display" translatable="false"></string>
|
||||||
|
<!-- Help URL, Fingerprint [DO NOT TRANSLATE] -->
|
||||||
|
<string name="help_url_fingerprint" translatable="false"></string>
|
||||||
|
|
||||||
<!-- User account title [CHAR LIMIT=30] -->
|
<!-- User account title [CHAR LIMIT=30] -->
|
||||||
<string name="user_account_title">Account for content</string>
|
<string name="user_account_title">Account for content</string>
|
||||||
|
@@ -14,25 +14,7 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:title="@string/security_settings_fingerprint_preference_title">
|
android:title="@string/security_settings_fingerprint_preference_title"/>
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:key="fingerprint_manage_category"
|
|
||||||
android:title="@string/fingerprint_manage_category_title">
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:key="fingerprint_usage_category"
|
|
||||||
android:title="@string/fingerprint_usage_category_title">
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="fingerprint_enable_keyguard_toggle"
|
|
||||||
android:title="@string/fingerprint_enable_keyguard_toggle_title"
|
|
||||||
android:persistent="false" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
|
|
||||||
|
@@ -118,7 +118,7 @@ public class HelpUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Intent getHelpIntent(Context context, String helpUriString) {
|
public static Intent getHelpIntent(Context context, String helpUriString) {
|
||||||
// Try to handle as Intent Uri, otherwise just treat as Uri.
|
// Try to handle as Intent Uri, otherwise just treat as Uri.
|
||||||
try {
|
try {
|
||||||
return Intent.parseUri(helpUriString,
|
return Intent.parseUri(helpUriString,
|
||||||
|
@@ -557,7 +557,7 @@ public class SettingsActivity extends Activity
|
|||||||
// This is a "Sub Settings" when:
|
// This is a "Sub Settings" when:
|
||||||
// - this is a real SubSettings
|
// - this is a real SubSettings
|
||||||
// - or :settings:show_fragment_as_subsetting is passed to the Intent
|
// - or :settings:show_fragment_as_subsetting is passed to the Intent
|
||||||
final boolean isSubSettings = className.equals(SubSettings.class.getName()) ||
|
final boolean isSubSettings = this instanceof SubSettings ||
|
||||||
intent.getBooleanExtra(EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, false);
|
intent.getBooleanExtra(EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, false);
|
||||||
|
|
||||||
// If this is a sub settings, then apply the SubSettings Theme for the ActionBar content insets
|
// If this is a sub settings, then apply the SubSettings Theme for the ActionBar content insets
|
||||||
|
@@ -17,13 +17,22 @@
|
|||||||
package com.android.settings.fingerprint;
|
package com.android.settings.fingerprint;
|
||||||
|
|
||||||
|
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.hardware.fingerprint.Fingerprint;
|
||||||
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
|
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
|
||||||
|
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
|
||||||
|
import android.hardware.fingerprint.FingerprintManager.RemovalCallback;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@@ -31,25 +40,29 @@ import android.preference.Preference;
|
|||||||
import android.preference.Preference.OnPreferenceChangeListener;
|
import android.preference.Preference.OnPreferenceChangeListener;
|
||||||
import android.preference.PreferenceGroup;
|
import android.preference.PreferenceGroup;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.hardware.fingerprint.Fingerprint;
|
import android.provider.Browser;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.text.Annotation;
|
||||||
import android.hardware.fingerprint.FingerprintManager.AuthenticationCallback;
|
import android.text.SpannableString;
|
||||||
import android.hardware.fingerprint.FingerprintManager.RemovalCallback;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
|
import android.text.TextPaint;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.text.style.URLSpan;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.settings.ChooseLockGeneric;
|
import com.android.settings.ChooseLockGeneric;
|
||||||
import com.android.settings.ChooseLockSettingsHelper;
|
import com.android.settings.ChooseLockSettingsHelper;
|
||||||
|
import com.android.settings.HelpUtils;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsActivity;
|
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.android.settings.fingerprint.FingerprintEnrollEnrolling;
|
import com.android.settings.SubSettings;
|
||||||
import com.android.settings.search.Indexable;
|
import com.android.settings.search.Indexable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -57,7 +70,7 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Settings screen for fingerprints
|
* Settings screen for fingerprints
|
||||||
*/
|
*/
|
||||||
public class FingerprintSettings extends SettingsActivity {
|
public class FingerprintSettings extends SubSettings {
|
||||||
/**
|
/**
|
||||||
* Used by the FP settings wizard to indicate the wizard is
|
* Used by the FP settings wizard to indicate the wizard is
|
||||||
* finished, and each activity in the wizard should finish.
|
* finished, and each activity in the wizard should finish.
|
||||||
@@ -96,9 +109,7 @@ public class FingerprintSettings extends SettingsActivity {
|
|||||||
|
|
||||||
private static final String TAG = "FingerprintSettings";
|
private static final String TAG = "FingerprintSettings";
|
||||||
private static final String KEY_FINGERPRINT_ITEM_PREFIX = "key_fingerprint_item";
|
private static final String KEY_FINGERPRINT_ITEM_PREFIX = "key_fingerprint_item";
|
||||||
private static final String KEY_USAGE_CATEGORY = "fingerprint_usage_category";
|
|
||||||
private static final String KEY_FINGERPRINT_ADD = "key_fingerprint_add";
|
private static final String KEY_FINGERPRINT_ADD = "key_fingerprint_add";
|
||||||
private static final String KEY_MANAGE_CATEGORY = "fingerprint_manage_category";
|
|
||||||
private static final String KEY_FINGERPRINT_ENABLE_KEYGUARD_TOGGLE =
|
private static final String KEY_FINGERPRINT_ENABLE_KEYGUARD_TOGGLE =
|
||||||
"fingerprint_enable_keyguard_toggle";
|
"fingerprint_enable_keyguard_toggle";
|
||||||
private static final String KEY_LAUNCHED_CONFIRM = "launched_confirm";
|
private static final String KEY_LAUNCHED_CONFIRM = "launched_confirm";
|
||||||
@@ -112,7 +123,6 @@ public class FingerprintSettings extends SettingsActivity {
|
|||||||
|
|
||||||
private static final int ADD_FINGERPRINT_REQUEST = 10;
|
private static final int ADD_FINGERPRINT_REQUEST = 10;
|
||||||
|
|
||||||
private static final boolean ENABLE_USAGE_CATEGORY = false;
|
|
||||||
protected static final boolean DEBUG = true;
|
protected static final boolean DEBUG = true;
|
||||||
|
|
||||||
private FingerprintManager mFingerprintManager;
|
private FingerprintManager mFingerprintManager;
|
||||||
@@ -226,6 +236,27 @@ public class FingerprintSettings extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
TextView v = (TextView) LayoutInflater.from(view.getContext()).inflate(
|
||||||
|
R.layout.fingerprint_settings_footer, null);
|
||||||
|
v.setText(LearnMoreSpan.linkify(getText(isFingerprintDisabled()
|
||||||
|
? R.string.security_settings_fingerprint_enroll_disclaimer_lockscreen_disabled
|
||||||
|
: R.string.security_settings_fingerprint_enroll_disclaimer),
|
||||||
|
getString(getHelpResource())));
|
||||||
|
v.setMovementMethod(new LinkMovementMethod());
|
||||||
|
getListView().addFooterView(v);
|
||||||
|
getListView().setFooterDividersEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isFingerprintDisabled() {
|
||||||
|
final DevicePolicyManager dpm =
|
||||||
|
(DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||||
|
return dpm != null && (dpm.getKeyguardDisabledFeatures(null)
|
||||||
|
& DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
protected void removeFingerprintPreference(int fingerprintId) {
|
protected void removeFingerprintPreference(int fingerprintId) {
|
||||||
String name = genKey(fingerprintId);
|
String name = genKey(fingerprintId);
|
||||||
Preference prefToRemove = mManageCategory.findPreference(name);
|
Preference prefToRemove = mManageCategory.findPreference(name);
|
||||||
@@ -251,48 +282,29 @@ public class FingerprintSettings extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
addPreferencesFromResource(R.xml.security_settings_fingerprint);
|
addPreferencesFromResource(R.xml.security_settings_fingerprint);
|
||||||
root = getPreferenceScreen();
|
root = getPreferenceScreen();
|
||||||
|
addFingerprintItemPreferences(root);
|
||||||
// Fingerprint items
|
|
||||||
mManageCategory = (PreferenceGroup) root.findPreference(KEY_MANAGE_CATEGORY);
|
|
||||||
if (mManageCategory != null) {
|
|
||||||
addFingerprintItemPreferences(mManageCategory);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fingerprint usage options
|
|
||||||
PreferenceGroup usageCategory = (PreferenceGroup) root.findPreference(
|
|
||||||
KEY_USAGE_CATEGORY);
|
|
||||||
if (usageCategory != null) {
|
|
||||||
Preference toggle = root.findPreference(KEY_FINGERPRINT_ENABLE_KEYGUARD_TOGGLE);
|
|
||||||
toggle.setOnPreferenceChangeListener(this);
|
|
||||||
if (!ENABLE_USAGE_CATEGORY) {
|
|
||||||
root.removePreference(usageCategory);
|
|
||||||
} else {
|
|
||||||
toggle.setOnPreferenceChangeListener(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFingerprintItemPreferences(PreferenceGroup manageFingerprintCategory) {
|
private void addFingerprintItemPreferences(PreferenceGroup root) {
|
||||||
manageFingerprintCategory.removeAll();
|
root.removeAll();
|
||||||
final List<Fingerprint> items = mFingerprintManager.getEnrolledFingerprints();
|
final List<Fingerprint> items = mFingerprintManager.getEnrolledFingerprints();
|
||||||
final int fingerprintCount = items.size();
|
final int fingerprintCount = items.size();
|
||||||
for (int i = 0; i < fingerprintCount; i++) {
|
for (int i = 0; i < fingerprintCount; i++) {
|
||||||
final Fingerprint item = items.get(i);
|
final Fingerprint item = items.get(i);
|
||||||
FingerprintPreference pref = new FingerprintPreference(
|
FingerprintPreference pref = new FingerprintPreference(root.getContext());
|
||||||
manageFingerprintCategory.getContext());
|
|
||||||
pref.setKey(genKey(item.getFingerId()));
|
pref.setKey(genKey(item.getFingerId()));
|
||||||
pref.setTitle(item.getName());
|
pref.setTitle(item.getName());
|
||||||
pref.setFingerprint(item);
|
pref.setFingerprint(item);
|
||||||
pref.setPersistent(false);
|
pref.setPersistent(false);
|
||||||
manageFingerprintCategory.addPreference(pref);
|
root.addPreference(pref);
|
||||||
pref.setOnPreferenceChangeListener(this);
|
pref.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
Preference addPreference = new Preference(manageFingerprintCategory.getContext());
|
Preference addPreference = new Preference(root.getContext());
|
||||||
addPreference.setKey(KEY_FINGERPRINT_ADD);
|
addPreference.setKey(KEY_FINGERPRINT_ADD);
|
||||||
addPreference.setTitle(R.string.fingerprint_add_title);
|
addPreference.setTitle(R.string.fingerprint_add_title);
|
||||||
manageFingerprintCategory.addPreference(addPreference);
|
addPreference.setIcon(R.drawable.ic_add_24dp);
|
||||||
|
root.addPreference(addPreference);
|
||||||
addPreference.setOnPreferenceChangeListener(this);
|
addPreference.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,7 +415,7 @@ public class FingerprintSettings extends SettingsActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getHelpResource() {
|
protected int getHelpResource() {
|
||||||
return R.string.help_url_security;
|
return R.string.help_url_fingerprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -508,4 +520,46 @@ public class FingerprintSettings extends SettingsActivity {
|
|||||||
mView = view;
|
mView = view;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static class LearnMoreSpan extends URLSpan {
|
||||||
|
|
||||||
|
private static final Typeface TYPEFACE_MEDIUM =
|
||||||
|
Typeface.create("sans-serif-medium", Typeface.NORMAL);
|
||||||
|
|
||||||
|
private LearnMoreSpan(String url) {
|
||||||
|
super(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View widget) {
|
||||||
|
Context ctx = widget.getContext();
|
||||||
|
Intent intent = HelpUtils.getHelpIntent(ctx, getURL());
|
||||||
|
try {
|
||||||
|
ctx.startActivity(intent);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Log.w(FingerprintSettingsFragment.TAG,
|
||||||
|
"Actvity was not found for intent, " + intent.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDrawState(TextPaint ds) {
|
||||||
|
super.updateDrawState(ds);
|
||||||
|
ds.setUnderlineText(false);
|
||||||
|
ds.setTypeface(TYPEFACE_MEDIUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CharSequence linkify(CharSequence rawText, String uri) {
|
||||||
|
SpannableString msg = new SpannableString(rawText);
|
||||||
|
Annotation[] spans = msg.getSpans(0, msg.length(), Annotation.class);
|
||||||
|
SpannableStringBuilder builder = new SpannableStringBuilder(msg);
|
||||||
|
for (Annotation annotation : spans) {
|
||||||
|
int start = msg.getSpanStart(annotation);
|
||||||
|
int end = msg.getSpanEnd(annotation);
|
||||||
|
LearnMoreSpan link = new LearnMoreSpan(uri);
|
||||||
|
builder.setSpan(link, start, end, msg.getSpanFlags(link));
|
||||||
|
}
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user