Share themes with SettingsLib.
Using a consistent theme allows the elements to have a consistent look
with the rest of settings, including consistent icon alignment.
Updating also has the side effect of removing OK and Cancel buttons from
dialogs, so these are explicitly re-added to the
NameAutoCompletePreference.
Bug: 71858437
Test: manual
Change-Id: I9f7713bff46432246225e8b67e1175bc79c129b8
diff --git a/res/layout/custom_preference_category_layout.xml b/res/layout/custom_preference_category_layout.xml
index 9a1dcd4..03dfa00 100644
--- a/res/layout/custom_preference_category_layout.xml
+++ b/res/layout/custom_preference_category_layout.xml
@@ -18,4 +18,4 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="0pt"/>
-<!-- Use 0pt so that the category title does not show-->
\ No newline at end of file
+<!-- Use 0pt so that the category title does not show-->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index cda3027..1e51f75 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -59,11 +59,9 @@
<item name="android:layout">@layout/custom_preference_category_layout</item>
</style>
- <style name="PreferenceTheme" parent="@style/PreferenceThemeOverlay.v14.Material">
- <!-- Parent path frameworks/support/v14/preference/res/values/themes.xml -->
- <item name="android:scrollbars">vertical</item>
+ <style name="PreferenceTheme" parent="@style/PreferenceThemeOverlay.SettingsBase">
+ <!-- Parent path frameworks/support/SettingsLib/res/values/themes.xml -->
<item name="footerPreferenceStyle">@style/FooterPreference</item>
- <item name="preferenceCategoryStyle">@style/PreferenceCategory</item>
</style>
<style name="FooterPreference" parent="PreferenceTheme">
@@ -71,8 +69,8 @@
<item name="allowDividerAbove">true</item>
</style>
- <style name="PreferenceCategory" parent="@style/Preference.Category.Material">
- <item name="allowDividerAbove">true</item>
- <item name="android:layout">@layout/preference_category_material_settings</item>
+ <style name="NameAutoCompletePreference" parent="PreferenceTheme">
+ <item name="android:positiveButtonText">@android:string/ok</item>
+ <item name="android:negativeButtonText">@android:string/cancel</item>
</style>
</resources>
diff --git a/res/xml/edit_medical_info.xml b/res/xml/edit_medical_info.xml
index 8bc2383..5795e11 100644
--- a/res/xml/edit_medical_info.xml
+++ b/res/xml/edit_medical_info.xml
@@ -24,7 +24,8 @@
android:key="name"
android:singleLine="true"
android:title="@string/name"
- app:summary="@string/unknown_name" />
+ app:summary="@string/unknown_name"
+ style="@style/NameAutoCompletePreference" />
<com.android.emergency.preferences.EmergencyEditTextPreference
android:icon="@drawable/ic_address_black_24dp"
diff --git a/src/com/android/emergency/preferences/AutoCompleteEditTextPreference.java b/src/com/android/emergency/preferences/AutoCompleteEditTextPreference.java
index d9e2b26..ab3c6b4 100644
--- a/src/com/android/emergency/preferences/AutoCompleteEditTextPreference.java
+++ b/src/com/android/emergency/preferences/AutoCompleteEditTextPreference.java
@@ -56,7 +56,7 @@
private boolean mTextSet;
public AutoCompleteEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr,
- int defStyleRes) {
+ int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
mAutoCompleteTextView = new InstantAutoCompleteTextView(context, attrs);
@@ -91,7 +91,7 @@
}
public AutoCompleteEditTextPreference(Context context, AttributeSet attrs) {
- this(context, attrs, android.R.attr.dialogPreferenceStyle);
+ this(context, attrs, R.attr.dialogPreferenceStyle);
}
public AutoCompleteEditTextPreference(Context context) {