diff options
author | stefan-niedermann <info@niedermann.it> | 2020-01-25 13:18:25 +0300 |
---|---|---|
committer | stefan-niedermann <info@niedermann.it> | 2020-01-25 13:18:25 +0300 |
commit | 213174d6cae08a249f1e5687d224c914b208a2eb (patch) | |
tree | 99092240e1a30fe498a765ff8b5e6e7e27677361 /app/src/main/res | |
parent | 0d27086f9a00e2f3e28e35dc0340c98fe72e0cb7 (diff) |
#466 Header title not aligned
Use custom layout for preference items to align text to title
Diffstat (limited to 'app/src/main/res')
-rw-r--r-- | app/src/main/res/layout/item_pref.xml | 54 | ||||
-rw-r--r-- | app/src/main/res/values/styles.xml | 5 | ||||
-rw-r--r-- | app/src/main/res/xml/preferences.xml | 5 |
3 files changed, 59 insertions, 5 deletions
diff --git a/app/src/main/res/layout/item_pref.xml b/app/src/main/res/layout/item_pref.xml new file mode 100644 index 00000000..2140d9ca --- /dev/null +++ b/app/src/main/res/layout/item_pref.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:minHeight="?android:attr/listPreferredItemHeight"> + + <ImageView + android:id="@android:id/icon" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:contentDescription="@null" + android:padding="16dp" + tools:src="@drawable/ic_settings_grey600_24dp" /> + + <LinearLayout + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="center_vertical" + android:orientation="vertical" + tools:ignore="RtlSymmetry"> + + + <TextView + android:id="@android:id/title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:ellipsize="marquee" + android:fadingEdge="horizontal" + android:singleLine="true" + android:textColor="@color/fg_default" + tools:text="@string/action_settings" /> + + <TextView + android:id="@android:id/summary" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:maxLines="2" + android:textColor="@color/fg_default_low" + tools:text="This is a summary" /> + </LinearLayout> + + <!-- Preference should place its actual preference widget here. --> + <LinearLayout + android:id="@android:id/widget_frame" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:gravity="center_vertical" + android:orientation="vertical" + android:padding="16dp" /> + +</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index e75c24aa..24e89cf5 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -11,11 +11,6 @@ <item name="windowNoTitle">true</item> </style> - <style name="Preferences" parent="AppTheme"> - <item name="android:textColor">@color/fg_default</item> - <item name="android:textColorSecondary">@color/fg_default_low</item> - </style> - <style name="ncAlertDialog" parent="@style/Theme.AppCompat.DayNight.Dialog.Alert"> <item name="colorAccent">@color/primary</item> <item name="colorPrimary">@color/primary</item> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index db4f57e2..d1668a87 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -7,6 +7,7 @@ android:entryValues="@array/noteMode_values" android:icon="@drawable/ic_remove_red_eye_grey_24dp" android:key="@string/pref_key_note_mode" + android:layout="@layout/item_pref" android:summary="%s" android:title="@string/settings_note_mode" /> @@ -14,12 +15,14 @@ android:defaultValue="@string/pref_value_theme_light" android:icon="@drawable/ic_brightness_2_grey_24dp" android:key="@string/pref_key_theme" + android:layout="@layout/item_pref" android:title="@string/settings_theme_title" /> <SwitchPreference android:defaultValue="@string/pref_value_font_normal" android:icon="@drawable/ic_text_fields_black_24dp" android:key="@string/pref_key_font" + android:layout="@layout/item_pref" android:title="@string/settings_font_title" /> <ListPreference @@ -28,6 +31,7 @@ android:entryValues="@array/fontSize_values" android:icon="@drawable/ic_format_size_black_24dp" android:key="@string/pref_key_font_size" + android:layout="@layout/item_pref" android:summary="%s" android:title="@string/settings_font_size" /> @@ -35,6 +39,7 @@ android:defaultValue="@string/pref_value_wifi_and_mobile" android:icon="@drawable/ic_sync_black_24dp" android:key="@string/pref_key_wifi_only" + android:layout="@layout/item_pref" android:title="@string/settings_wifi_only" /> </PreferenceScreen> |