From a70a00e6e9511d8826874488b2904b86b3d3e930 Mon Sep 17 00:00:00 2001 From: Hermes Junior Date: Wed, 17 Jun 2020 18:14:36 +0200 Subject: [PATCH] Add icons to sort bottom sheets. --- .../Settings/CreditsPreferenceFragment.java | 10 ++ .../Utils/SharedPreferencesUtils.java | 1 + app/src/main/res/drawable/ic_best_24.xml | 17 ++ .../main/res/drawable/ic_controversial_24.xml | 9 + app/src/main/res/drawable/ic_hot_24.xml | 9 + app/src/main/res/drawable/ic_new_24.xml | 9 + app/src/main/res/drawable/ic_random_24.xml | 9 + app/src/main/res/drawable/ic_rising_24.xml | 9 + app/src/main/res/drawable/ic_top_24.xml | 9 + ...ent_search_post_sort_type_bottom_sheet.xml | 112 +++++++------ .../fragment_sort_type_bottom_sheet.xml | 154 ++++++++++-------- ...ment_user_thing_sort_type_bottom_sheet.xml | 90 +++++----- app/src/main/res/values/strings.xml | 2 + app/src/main/res/xml/credits_preferences.xml | 7 +- 14 files changed, 294 insertions(+), 153 deletions(-) create mode 100644 app/src/main/res/drawable/ic_best_24.xml create mode 100644 app/src/main/res/drawable/ic_controversial_24.xml create mode 100644 app/src/main/res/drawable/ic_hot_24.xml create mode 100644 app/src/main/res/drawable/ic_new_24.xml create mode 100644 app/src/main/res/drawable/ic_random_24.xml create mode 100644 app/src/main/res/drawable/ic_rising_24.xml create mode 100644 app/src/main/res/drawable/ic_top_24.xml diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java index 8607b486..3bb14843 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/CreditsPreferenceFragment.java @@ -32,6 +32,7 @@ public class CreditsPreferenceFragment extends PreferenceFragmentCompat { Preference gildedIconPreference = findPreference(SharedPreferencesUtils.GILDED_ICON_KEY); Preference crosspostIconPreference = findPreference(SharedPreferencesUtils.CROSSPOST_ICON_KEY); Preference thumbtackIconPreference = findPreference(SharedPreferencesUtils.THUMBTACK_ICON_KEY); + Preference bestRocketIconPreference = findPreference(SharedPreferencesUtils.BEST_ROCKET_ICON_KEY); Preference materialIconsPreference = findPreference(SharedPreferencesUtils.MATERIAL_ICONS_KEY); if (iconForegroundPreference != null) { @@ -88,6 +89,15 @@ public class CreditsPreferenceFragment extends PreferenceFragmentCompat { }); } + if (bestRocketIconPreference != null) { + bestRocketIconPreference.setOnPreferenceClickListener(preference -> { + Intent intent = new Intent(activity, LinkResolverActivity.class); + intent.setData(Uri.parse("https://www.flaticon.com/free-icon/spring-swing-rocket_2929322?term=space%20ship&page=1&position=18")); + startActivity(intent); + return true; + }); + } + if (materialIconsPreference != null) { materialIconsPreference.setOnPreferenceClickListener(preference -> { Intent intent = new Intent(activity, LinkResolverActivity.class); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java index a26571a9..61af3068 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java @@ -18,6 +18,7 @@ public class SharedPreferencesUtils { public static final String GILDED_ICON_KEY = "gilded_icon"; public static final String CROSSPOST_ICON_KEY = "crosspost_icon"; public static final String THUMBTACK_ICON_KEY = "thumbtack_icon"; + public static final String BEST_ROCKET_ICON_KEY = "best_rocket_icon"; public static final String MATERIAL_ICONS_KEY = "material_icons"; public static final String OPEN_SOURCE_KEY = "open_source"; public static final String RATE_KEY = "rate"; diff --git a/app/src/main/res/drawable/ic_best_24.xml b/app/src/main/res/drawable/ic_best_24.xml new file mode 100644 index 00000000..6a592ecc --- /dev/null +++ b/app/src/main/res/drawable/ic_best_24.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/app/src/main/res/drawable/ic_controversial_24.xml b/app/src/main/res/drawable/ic_controversial_24.xml new file mode 100644 index 00000000..8084cc1d --- /dev/null +++ b/app/src/main/res/drawable/ic_controversial_24.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_hot_24.xml b/app/src/main/res/drawable/ic_hot_24.xml new file mode 100644 index 00000000..c163a23d --- /dev/null +++ b/app/src/main/res/drawable/ic_hot_24.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_new_24.xml b/app/src/main/res/drawable/ic_new_24.xml new file mode 100644 index 00000000..5ed64d37 --- /dev/null +++ b/app/src/main/res/drawable/ic_new_24.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_random_24.xml b/app/src/main/res/drawable/ic_random_24.xml new file mode 100644 index 00000000..002ff2d7 --- /dev/null +++ b/app/src/main/res/drawable/ic_random_24.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_rising_24.xml b/app/src/main/res/drawable/ic_rising_24.xml new file mode 100644 index 00000000..75754f74 --- /dev/null +++ b/app/src/main/res/drawable/ic_rising_24.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_top_24.xml b/app/src/main/res/drawable/ic_top_24.xml new file mode 100644 index 00000000..ed64f733 --- /dev/null +++ b/app/src/main/res/drawable/ic_top_24.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/fragment_search_post_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_search_post_sort_type_bottom_sheet.xml index f7511131..8b1c86b6 100644 --- a/app/src/main/res/layout/fragment_search_post_sort_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_search_post_sort_type_bottom_sheet.xml @@ -1,95 +1,111 @@ + android:overScrollMode="never" + android:paddingBottom="8dp"> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml index d8a62445..d5c9e34d 100644 --- a/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml @@ -1,127 +1,149 @@ + android:overScrollMode="never" + android:paddingBottom="8dp"> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/fragment_user_thing_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_user_thing_sort_type_bottom_sheet.xml index 8abaf5ff..17056053 100644 --- a/app/src/main/res/layout/fragment_user_thing_sort_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_user_thing_sort_type_bottom_sheet.xml @@ -1,71 +1,85 @@ - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - + app:drawableTint="?attr/primaryTextColor" /> - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 53f28bc9..16bd68e7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -387,6 +387,8 @@ Icon made by Freepik from www.flaticon.com Thumbtack Icon Icon made by Freepik from www.flaticon.com + Rocket Icon + Icon made by Freepik from www.flaticon.com Material Icons Open Source Star it on Github if you like this app diff --git a/app/src/main/res/xml/credits_preferences.xml b/app/src/main/res/xml/credits_preferences.xml index e630422b..8e622332 100644 --- a/app/src/main/res/xml/credits_preferences.xml +++ b/app/src/main/res/xml/credits_preferences.xml @@ -32,8 +32,13 @@ app:title="@string/settings_credits_thumbtack_icon_title" android:summary="@string/settings_credits_thumbtack_icon_summary" /> + + - \ No newline at end of file +