1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2025-12-09 05:41:12 +01:00
Rewrote ThemedSettings by inheriting Preference classes

Fixed issues pointed out by gsantner

Added back circle color picker preview to Settings and reflect color changes immediatelly :D

Removed some debug messages and unified usage of Themeable
This commit is contained in:
vanitasvitae 2016-10-25 17:04:32 +02:00
parent 6ad634cc5b
commit b9221099c2
20 changed files with 677 additions and 388 deletions

View file

@ -0,0 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/md_red_500"/>
<size android:width="@dimen/color_picker_circle_size" android:height="@dimen/color_picker_circle_size"/>
</shape>

View file

@ -22,7 +22,7 @@
<FrameLayout
android:id="@+id/settings__fragment_container"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

View file

@ -15,4 +15,5 @@
<dimen name="textsize_badge_count">11sp</dimen>
<dimen name="color_picker_circle_size">30dp</dimen>
</resources>

View file

@ -19,10 +19,10 @@
<string name="pref_key__extended_notifications" translatable="false">pref_key__extended_notifications</string>
<!-- Themes -->
<string name="pref_key__primary_color__preference_click" translatable="false">pref_key_primary_color</string>
<string name="pref_key__primary_color__preference_click" translatable="false">@string/pref_key__primary_color_shade</string>
<string name="pref_key__primary_color_base" translatable="false">pref_key_primary_color_base</string>
<string name="pref_key__primary_color_shade" translatable="false">pref_key_primary_color_shade</string>
<string name="pref_key__accent_color__preference_click" translatable="false">pref_key_accent_color</string>
<string name="pref_key__accent_color__preference_click" translatable="false">@string/pref_key__accent_color_shade</string>
<string name="pref_key__accent_color_base" translatable="false">pref_key_accent_color_base</string>
<string name="pref_key__accent_color_shade" translatable="false">pref_key_accent_color_shade</string>
@ -151,4 +151,18 @@
<!-- Recently added - Please move to right section-->
<!-- Sorry -->
<string name="pref_key__title__appearance" translatable="false">pref_key__title__appearance</string>
<string name="pref_key__title__pod_settings" translatable="false">pref_key__title__pod_settings</string>
<string name="pref_key__title__network" translatable="false">pref_key__title__network</string>
<string name="pref_key__title__more" translatable="false">pref_key__title__more</string>
<string name="pref_key__title__debugging" translatable="false">pref_key__title__debugging</string>
<string name="pref_key__title__visibility_nav" translatable="false">pref_key__title__visibility_nav</string>
<string name="pref_key__title__proxy" translatable="false">pref_key__title__proxy</string>
<string name="pref_key__title__themes" translatable="false">pref_key__title__themes</string>
<string name="pref_key__cat_themes" translatable="false">pref_key__cat_themes</string>
<string name="pref_key__cat_nav_slider" translatable="false">pref_key__cat_nav_slider</string>
<string name="pref_key__cat_proxy" translatable="false">pref_key__cat_proxy</string>
<string name="pref_key__cat_debugging" translatable="false">pref_key__cat_debugging</string>
</resources>

View file

@ -1,205 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Appearance -->
<PreferenceCategory
android:key="@string/pref_catkey__category_visuals"
android:title="@string/pref_cat__visuals">
<PreferenceScreen
android:summary="@string/pref_desc__sub_nav_slider"
android:title="@string/pref_title__sub_nav_slider">
<PreferenceCategory
android:key="@string/pref_catkey__visibility_nav"
android:title="@string/pref_cat__visibility_nav_items">
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__profile"
android:title="@string/nav_profile"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__followed_tags"
android:title="@string/nav_followed_tags"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__aspects"
android:title="@string/nav_aspects"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__activities"
android:title="@string/nav_activities"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__liked"
android:title="@string/nav_liked"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__commented"
android:title="@string/nav_commented"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__mentions"
android:title="@string/nav_mentions"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__public_activities"
android:title="@string/nav_public_activities"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__exit"
android:title="@string/action_exit_app"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__help_license"
android:title="@string/nav_help_license"/>
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen
android:title="@string/pref_title__themes"
android:summary="@string/pref_desc__themes" >
<Preference
android:key="@string/pref_key__primary_color__preference_click"
android:summary="@string/pref_desc__primary_color"
android:title="@string/pref_title__primary_color" />
<Preference
android:key="@string/pref_key__accent_color__preference_click"
android:summary="@string/pref_desc__accent_color"
android:title="@string/pref_title__accent_color" />
</PreferenceScreen>
<ListPreference
android:dialogTitle="@string/pref_title__font_size"
android:entries="@array/pref_entries__font_size"
android:entryValues="@array/pref_entries_values__font_size"
android:key="@string/pref_key__font_size"
android:summary="%s"
android:title="@string/pref_title__font_size"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__intellihide_toolbars"
android:summary="@string/pref_desc__intellihide_toolbars"
android:title="@string/pref_title__intellihide_toolbars"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__extended_notifications"
android:summary="@string/pref_desc__extended_notifications"
android:title="@string/pref_title__extended_notifications"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__append_shared_via_app"
android:summary="@string/pref_desc__append_shared_via_app"
android:title="@string/pref_title__append_shared_via_app"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__chrome_custom_tabs_enabled"
android:summary="@string/pref_desc__chrome_custom_tabs_enabled"
android:title="@string/pref_title__chrome_custom_tabs_enabled"/>
</PreferenceCategory>
<!-- Diaspora Pod Settings -->
<PreferenceCategory
android:key="@string/pref_catkey__pod_settings"
android:title="@string/pref_cat__pod_settings">
<Preference
android:key="@string/pref_key__personal_settings"
android:summary="@string/pref_desc__personal_settings"
android:title="@string/pref_title__personal_settings"/>
<Preference
android:key="@string/pref_key__manage_tags"
android:summary="@string/pref_desc__manage_tags"
android:title="@string/pref_title__manage_tags"/>
<Preference
android:key="@string/pref_key__manage_contacts"
android:summary="@string/pref_desc__manage_contacts"
android:title="@string/pref_title__manage_contacts"/>
<Preference
android:key="@string/pref_key__change_account"
android:summary="@string/pref_desc__change_account"
android:title="@string/pref_title__change_account"/>
</PreferenceCategory>
<!-- Networking -->
<PreferenceCategory
android:key="@string/pref_catkey__network"
android:title="@string/pref_cat__network">
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__load_images"
android:summary="@string/pref_desc__load_images"
android:title="@string/pref_title__load_images"/>
<Preference
android:key="@string/pref_key__clear_cache"
android:summary="@string/pref_desc__clear_cache"
android:title="@string/pref_title__clear_cache"/>
<PreferenceScreen
android:summary="@string/pref_desc__sub_proxy"
android:title="@string/pref_title__sub_proxy">
<PreferenceCategory
android:title="@string/HTTP">
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__http_proxy_enabled"
android:summary="@string/pref_desc__http_proxy_enabled"
android:title="@string/pref_title__proxy_enabled"/>
<EditTextPreference
android:dependency="@string/pref_key__http_proxy_enabled"
android:inputType="textNoSuggestions"
android:key="@string/pref_key__http_proxy_host"
android:title="@string/pref_title__http_proxy_host"/>
<EditTextPreference
android:dependency="@string/pref_key__http_proxy_enabled"
android:inputType="number"
android:key="@string/pref_key__http_proxy_port"
android:title="@string/pref_title__http_proxy_port"/>
<Preference
android:icon="@drawable/tor_onion"
android:dependency="@string/pref_key__http_proxy_enabled"
android:key="@string/pref_key__http_proxy_load_tor_preset"
android:summary="@string/pref_desc__http_proxy_load_tor_preset"
android:title="@string/pref_title__http_proxy_load_tor_preset"/>
</PreferenceCategory>
</PreferenceScreen>
</PreferenceCategory>
<!-- More -->
<PreferenceCategory
android:key="@string/pref_catkey__category_more"
android:title="@string/pref_cat__more">
<PreferenceScreen
android:summary="@string/pref_desc__sub_logging"
android:title="@string/pref_title__sub_logging">
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__logging_enabled"
android:title="@string/pref_title__logging_enabled"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__logging_spam_enabled"
android:title="@string/pref_title__logging_spam_enabled"/>
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Appearance -->
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__appearance"
android:title="@string/pref_cat__visuals">
<Preference
android:key="@string/pref_key__cat_themes"
android:title="@string/pref_title__themes"
android:summary="@string/pref_desc__themes" />
<Preference
android:key="@string/pref_key__cat_nav_slider"
android:summary="@string/pref_desc__sub_nav_slider"
android:title="@string/pref_title__sub_nav_slider" />
<ListPreference
android:dialogTitle="@string/pref_title__font_size"
android:entries="@array/pref_entries__font_size"
android:entryValues="@array/pref_entries_values__font_size"
android:key="@string/pref_key__font_size"
android:summary="%s"
android:title="@string/pref_title__font_size"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__intellihide_toolbars"
android:summary="@string/pref_desc__intellihide_toolbars"
android:title="@string/pref_title__intellihide_toolbars"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__extended_notifications"
android:summary="@string/pref_desc__extended_notifications"
android:title="@string/pref_title__extended_notifications"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__append_shared_via_app"
android:summary="@string/pref_desc__append_shared_via_app"
android:title="@string/pref_title__append_shared_via_app"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__chrome_custom_tabs_enabled"
android:summary="@string/pref_desc__chrome_custom_tabs_enabled"
android:title="@string/pref_title__chrome_custom_tabs_enabled"/>
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
<!-- Diaspora Pod Settings -->
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__pod_settings"
android:title="@string/pref_cat__pod_settings">
<Preference
android:key="@string/pref_key__personal_settings"
android:summary="@string/pref_desc__personal_settings"
android:title="@string/pref_title__personal_settings"/>
<Preference
android:key="@string/pref_key__manage_tags"
android:summary="@string/pref_desc__manage_tags"
android:title="@string/pref_title__manage_tags"/>
<Preference
android:key="@string/pref_key__manage_contacts"
android:summary="@string/pref_desc__manage_contacts"
android:title="@string/pref_title__manage_contacts"/>
<Preference
android:key="@string/pref_key__change_account"
android:summary="@string/pref_desc__change_account"
android:title="@string/pref_title__change_account"/>
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
<!-- Networking -->
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__network"
android:title="@string/pref_cat__network">
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__load_images"
android:summary="@string/pref_desc__load_images"
android:title="@string/pref_title__load_images"/>
<Preference
android:key="@string/pref_key__clear_cache"
android:summary="@string/pref_desc__clear_cache"
android:title="@string/pref_title__clear_cache"/>
<Preference
android:key="@string/pref_key__cat_proxy"
android:summary="@string/pref_desc__sub_proxy"
android:title="@string/pref_title__sub_proxy" />
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
<!-- More -->
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__more"
android:title="@string/pref_cat__more">
<Preference
android:key="@string/pref_key__cat_debugging"
android:summary="@string/pref_desc__sub_logging"
android:title="@string/pref_title__sub_logging" />
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__debugging"
android:title="@string/pref_title__sub_logging">
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__logging_enabled"
android:title="@string/pref_title__logging_enabled"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__logging_spam_enabled"
android:title="@string/pref_title__logging_spam_enabled"/>
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__visibility_nav"
android:title="@string/pref_cat__visibility_nav_items">
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__profile"
android:title="@string/nav_profile"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__followed_tags"
android:title="@string/nav_followed_tags"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__aspects"
android:title="@string/nav_aspects"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__activities"
android:title="@string/nav_activities"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__liked"
android:title="@string/nav_liked"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__commented"
android:title="@string/nav_commented"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__mentions"
android:title="@string/nav_mentions"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__public_activities"
android:title="@string/nav_public_activities"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__visibility_nav__exit"
android:title="@string/action_exit_app"/>
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_key__visibility_nav__help_license"
android:title="@string/nav_help_license"/>
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__proxy"
android:title="@string/HTTP">
<com.github.dfa.diaspora_android.ui.ThemedCheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_key__http_proxy_enabled"
android:summary="@string/pref_desc__http_proxy_enabled"
android:title="@string/pref_title__proxy_enabled"/>
<EditTextPreference
android:dependency="@string/pref_key__http_proxy_enabled"
android:inputType="textNoSuggestions"
android:key="@string/pref_key__http_proxy_host"
android:title="@string/pref_title__http_proxy_host"/>
<EditTextPreference
android:dependency="@string/pref_key__http_proxy_enabled"
android:inputType="number"
android:key="@string/pref_key__http_proxy_port"
android:title="@string/pref_title__http_proxy_port"/>
<Preference
android:icon="@drawable/tor_onion"
android:dependency="@string/pref_key__http_proxy_enabled"
android:key="@string/pref_key__http_proxy_load_tor_preset"
android:summary="@string/pref_desc__http_proxy_load_tor_preset"
android:title="@string/pref_title__http_proxy_load_tor_preset"/>
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
</PreferenceScreen>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory
android:key="@string/pref_key__title__themes"
android:title="@string/pref_title__themes">
<com.github.dfa.diaspora_android.ui.ThemedColorPickerPreference
android:key="@string/pref_key__primary_color__preference_click"
android:summary="@string/pref_desc__primary_color"
android:title="@string/pref_title__primary_color"
android:icon="@drawable/circle" />
<com.github.dfa.diaspora_android.ui.ThemedColorPickerPreference
android:key="@string/pref_key__accent_color__preference_click"
android:summary="@string/pref_desc__accent_color"
android:title="@string/pref_title__accent_color"
android:icon="@drawable/circle" />
</com.github.dfa.diaspora_android.ui.ThemedPreferenceCategory>
</PreferenceScreen>