Open notification channel settings from app settings

This commit is contained in:
xynngh 2020-10-02 15:41:35 +04:00
parent c879e11d53
commit b921c58abf
4 changed files with 21 additions and 0 deletions

View File

@ -104,6 +104,7 @@ public class SettingsActivity extends AppCompatActivity
private static final String PREF_USE_CALL_SCREENING_SERVICE = "useCallScreeningService"; private static final String PREF_USE_CALL_SCREENING_SERVICE = "useCallScreeningService";
private static final String PREF_AUTO_UPDATE_ENABLED = "autoUpdateEnabled"; private static final String PREF_AUTO_UPDATE_ENABLED = "autoUpdateEnabled";
private static final String PREF_NOTIFICATION_CHANNEL_SETTINGS = "notificationChannelSettings";
private static final String PREF_CATEGORY_NOTIFICATIONS = "categoryNotifications"; private static final String PREF_CATEGORY_NOTIFICATIONS = "categoryNotifications";
private static final String PREF_SCREEN_ADVANCED = "screenAdvanced"; private static final String PREF_SCREEN_ADVANCED = "screenAdvanced";
private static final String PREF_DB_MANAGEMENT = "dbManagement"; private static final String PREF_DB_MANAGEMENT = "dbManagement";
@ -226,9 +227,22 @@ public class SettingsActivity extends AppCompatActivity
return true; return true;
}); });
Preference notificationChannelSettings = requireNonNull(
findPreference(PREF_NOTIFICATION_CHANNEL_SETTINGS));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationChannelSettings.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(
android.provider.Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra(android.provider.Settings.EXTRA_APP_PACKAGE,
BuildConfig.APPLICATION_ID);
startActivity(intent);
return true;
});
Preference category = requireNonNull(findPreference(PREF_CATEGORY_NOTIFICATIONS)); Preference category = requireNonNull(findPreference(PREF_CATEGORY_NOTIFICATIONS));
category.setVisible(false); category.setVisible(false);
} else {
notificationChannelSettings.setVisible(false);
} }
} }

View File

@ -100,6 +100,7 @@
<string name="show_notifications_for_known_callers_summary">Показывать уведомления для известных звонящих (номеров из телефонной книги)</string> <string name="show_notifications_for_known_callers_summary">Показывать уведомления для известных звонящих (номеров из телефонной книги)</string>
<string name="show_notifications_for_unknown_callers">Уведомления для неизвестных звонящих</string> <string name="show_notifications_for_unknown_callers">Уведомления для неизвестных звонящих</string>
<string name="show_notifications_for_unknown_callers_summary">Показывать уведомления для неизвестных звонящих (отсутствующих в телефонной книге и в базе номеров)</string> <string name="show_notifications_for_unknown_callers_summary">Показывать уведомления для неизвестных звонящих (отсутствующих в телефонной книге и в базе номеров)</string>
<string name="notification_settings">Настройки уведомлений</string>
<string name="settings_screen_advanced">Продвинутые настройки</string> <string name="settings_screen_advanced">Продвинутые настройки</string>
<string name="settings_category_country_codes">Коды страны</string> <string name="settings_category_country_codes">Коды страны</string>
<string name="country_codes_info">Объяснение</string> <string name="country_codes_info">Объяснение</string>

View File

@ -89,6 +89,7 @@
<string name="show_notifications_for_known_callers_summary">Display notifications for known callers (numbers in Contacts)</string> <string name="show_notifications_for_known_callers_summary">Display notifications for known callers (numbers in Contacts)</string>
<string name="show_notifications_for_unknown_callers">Notifications for unknown callers</string> <string name="show_notifications_for_unknown_callers">Notifications for unknown callers</string>
<string name="show_notifications_for_unknown_callers_summary">Display notifications for unknown callers (neither in Contacts nor in number database)</string> <string name="show_notifications_for_unknown_callers_summary">Display notifications for unknown callers (neither in Contacts nor in number database)</string>
<string name="notification_settings">Notification settings</string>
<string name="incoming_call_notifications">Incoming call notifications</string> <string name="incoming_call_notifications">Incoming call notifications</string>
<string name="incoming_call_notifications_summary">Displays a notification with phone number summary (rating, reviews count, category) during incoming calls</string> <string name="incoming_call_notifications_summary">Displays a notification with phone number summary (rating, reviews count, category) during incoming calls</string>

View File

@ -57,6 +57,11 @@
app:summary="@string/use_monitoring_service_summary" app:summary="@string/use_monitoring_service_summary"
app:title="@string/use_monitoring_service" /> app:title="@string/use_monitoring_service" />
<Preference
app:key="notificationChannelSettings"
app:persistent="false"
app:title="@string/notification_settings" />
<PreferenceCategory <PreferenceCategory
app:key="categoryNotifications" app:key="categoryNotifications"
app:title="@string/settings_category_notifications_incoming_calls"> app:title="@string/settings_category_notifications_incoming_calls">