From f816f2637d229845ecd4949a4d844caa22511077 Mon Sep 17 00:00:00 2001 From: xynngh Date: Tue, 3 Nov 2020 00:09:20 +0400 Subject: [PATCH] Init notification channels before opening notification settings --- .../dummydomain/yetanothercallblocker/NotificationHelper.java | 2 +- .../dummydomain/yetanothercallblocker/RootSettingsFragment.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/dummydomain/yetanothercallblocker/NotificationHelper.java b/app/src/main/java/dummydomain/yetanothercallblocker/NotificationHelper.java index 7d3350c..3da1e5c 100644 --- a/app/src/main/java/dummydomain/yetanothercallblocker/NotificationHelper.java +++ b/app/src/main/java/dummydomain/yetanothercallblocker/NotificationHelper.java @@ -297,7 +297,7 @@ public class NotificationHelper { ReviewsActivity.getNumberIntent(context, numberInfo.number))); } - private static void initNotificationChannels(Context context) { + public static void initNotificationChannels(Context context) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return; if (notificationChannelsInitialized) return; diff --git a/app/src/main/java/dummydomain/yetanothercallblocker/RootSettingsFragment.java b/app/src/main/java/dummydomain/yetanothercallblocker/RootSettingsFragment.java index c4aeda1..73c0045 100644 --- a/app/src/main/java/dummydomain/yetanothercallblocker/RootSettingsFragment.java +++ b/app/src/main/java/dummydomain/yetanothercallblocker/RootSettingsFragment.java @@ -172,6 +172,8 @@ public class RootSettingsFragment extends BaseSettingsFragment { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { requirePreference(PREF_NOTIFICATION_CHANNEL_SETTINGS) .setOnPreferenceClickListener(preference -> { + NotificationHelper.initNotificationChannels(requireContext()); + Intent intent = new Intent( android.provider.Settings.ACTION_APP_NOTIFICATION_SETTINGS); intent.putExtra(android.provider.Settings.EXTRA_APP_PACKAGE,