From 995701174de54219c528993674cfa92995c03d17 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 27 Aug 2019 17:16:31 +0800 Subject: [PATCH] Delete wrong credit. Change the notification icon and color. --- .idea/assetWizardSettings.xml | 4 ++-- .../Settings/CreditsPreferenceFragment.java | 10 ---------- .../infinityforreddit/NotificationUtils.java | 6 ++++-- .../SharedPreferencesUtils.java | 1 - app/src/main/res/drawable/ic_notification.xml | 19 +++++++++++++++++++ app/src/main/res/values/colors.xml | 2 ++ app/src/main/res/values/strings.xml | 2 -- app/src/main/res/xml/credits_preferences.xml | 5 ----- 8 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 app/src/main/res/drawable/ic_notification.xml diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml index a708e9ab..599bbd3b 100644 --- a/.idea/assetWizardSettings.xml +++ b/.idea/assetWizardSettings.xml @@ -159,8 +159,8 @@ - - + + diff --git a/app/src/main/java/Settings/CreditsPreferenceFragment.java b/app/src/main/java/Settings/CreditsPreferenceFragment.java index 6bc3b467..55fb3363 100644 --- a/app/src/main/java/Settings/CreditsPreferenceFragment.java +++ b/app/src/main/java/Settings/CreditsPreferenceFragment.java @@ -25,7 +25,6 @@ public class CreditsPreferenceFragment extends PreferenceFragmentCompat { Preference iconForegroundPreference = findPreference(SharedPreferencesUtils.ICON_FOREGROUND_KEY); Preference iconBackgroundPreference = findPreference(SharedPreferencesUtils.ICON_BACKGROUND_KEY); Preference errorImagePreference = findPreference(SharedPreferencesUtils.ERROR_IMAGE_KEY); - Preference placeholderPreference = findPreference(SharedPreferencesUtils.SUBREDDIT_AND_USER_PLACEHOLDER_KEY); Preference gildedIconPreference = findPreference(SharedPreferencesUtils.GILDED_ICON_KEY); Preference crosspostIconPreference = findPreference(SharedPreferencesUtils.CROSSPOST_ICON_KEY); Preference thumbtackIconPreference = findPreference(SharedPreferencesUtils.THUMBTACK_ICON_KEY); @@ -61,15 +60,6 @@ public class CreditsPreferenceFragment extends PreferenceFragmentCompat { }); } - if(placeholderPreference != null) { - placeholderPreference.setOnPreferenceClickListener(preference -> { - Intent intent = new Intent(activity, LinkResolverActivity.class); - intent.setData(Uri.parse("https://www.freepik.com/free-photos-vectors/technology")); - startActivity(intent); - return true; - }); - } - if(gildedIconPreference != null) { gildedIconPreference.setOnPreferenceClickListener(preference -> { Intent intent = new Intent(activity, LinkResolverActivity.class); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/NotificationUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/NotificationUtils.java index 7d09608f..f9e4bdee 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/NotificationUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/NotificationUtils.java @@ -29,7 +29,8 @@ class NotificationUtils { return new NotificationCompat.Builder(context.getApplicationContext(), channelId) .setContentTitle(title) .setContentText(content) - .setSmallIcon(R.drawable.ic_launcher_foreground) + .setSmallIcon(R.drawable.ic_notification) + .setColor(context.getResources().getColor(R.color.notificationIconColor)) .setStyle(new NotificationCompat.BigTextStyle() .setSummaryText(summary) .bigText(content)) @@ -49,7 +50,8 @@ class NotificationUtils { .setContentTitle(title) //set content text to support devices running API level < 24 .setContentText(content) - .setSmallIcon(R.drawable.ic_launcher_foreground) + .setSmallIcon(R.drawable.ic_notification) + .setColor(context.getResources().getColor(R.color.notificationIconColor)) .setGroup(group) .setGroupSummary(true) .setAutoCancel(true); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java index d54e83cb..fd7dc27f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SharedPreferencesUtils.java @@ -13,7 +13,6 @@ public class SharedPreferencesUtils { public static final String ICON_FOREGROUND_KEY = "icon_foreground"; public static final String ICON_BACKGROUND_KEY = "icon_background"; public static final String ERROR_IMAGE_KEY = "error_image"; - public static final String SUBREDDIT_AND_USER_PLACEHOLDER_KEY = "subreddit_and_user_profile_placeholder"; 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"; diff --git a/app/src/main/res/drawable/ic_notification.xml b/app/src/main/res/drawable/ic_notification.xml new file mode 100644 index 00000000..50344c41 --- /dev/null +++ b/app/src/main/res/drawable/ic_notification.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index a83bdede..000500bf 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -55,4 +55,6 @@ #B4009F #EE7302 + + @color/colorPrimary diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ecd92af2..64be0073 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -270,8 +270,6 @@ Background vector created by freepik - www.freepik.com Error Image Technology vector created by freepik - www.freepik.com - Subreddit and User Placeholder - Technology vector created by freepik - www.freepik.com Gilded Icon Icon made by Freepik from www.flaticon.com Crosspost Icon diff --git a/app/src/main/res/xml/credits_preferences.xml b/app/src/main/res/xml/credits_preferences.xml index d5a5f580..e630422b 100644 --- a/app/src/main/res/xml/credits_preferences.xml +++ b/app/src/main/res/xml/credits_preferences.xml @@ -17,11 +17,6 @@ app:title="@string/settings_credits_error_image_title" android:summary="@string/settings_credits_error_image_summary" /> - -