mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-03 17:02:13 +01:00
allow to open Android notification settings from Notification settings
This commit is contained in:
parent
43a6a5af55
commit
3450e5d5e7
@ -42,13 +42,13 @@ import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.database.PeriodicExporter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GBPrefs;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||
|
||||
@ -108,11 +108,31 @@ public class NotificationManagementActivity extends AbstractSettingsActivity {
|
||||
category.removePreference(pref);
|
||||
}
|
||||
|
||||
pref = findPreference("notifications_settings");
|
||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName());
|
||||
//This could open notification channel settings, if needed...:
|
||||
//Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS);
|
||||
//intent.putExtra(Settings.EXTRA_CHANNEL_ID, GB.NOTIFICATION_CHANNEL_ID_TRANSFER);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (GBApplication.isRunningTenOrLater()) {
|
||||
pref = findPreference("minimize_priority");
|
||||
PreferenceCategory category = (PreferenceCategory) findPreference("pref_key_notifications");
|
||||
category.removePreference(pref);
|
||||
}
|
||||
|
||||
if (!GBApplication.isRunningOreoOrLater()) {
|
||||
pref = findPreference("notifications_settings");
|
||||
PreferenceCategory category = (PreferenceCategory) findPreference("pref_key_notifications");
|
||||
category.removePreference(pref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -142,6 +142,7 @@
|
||||
<string name="pref_title_notifications_pebblemsg">Pebble Messages</string>
|
||||
<string name="pref_summary_notifications_pebblemsg">Support for apps that send notifications to the Pebble via PebbleKit.</string>
|
||||
<string name="pref_title_notifications_generic">Generic notification support</string>
|
||||
<string name="pref_title_notifications_generic_settings">Android notification settings</string>
|
||||
<string name="pref_title_whenscreenon">…also when screen is on</string>
|
||||
<string name="pref_title_notification_filter">Do Not Disturb</string>
|
||||
<string name="pref_summary_notification_filter">Block all notifications when Do Not Disturb is enabled on the phone</string>
|
||||
|
@ -3,6 +3,10 @@
|
||||
android:key="pref_key_notifications"
|
||||
android:title="@string/pref_header_notifications">
|
||||
|
||||
<Preference
|
||||
android:key="notifications_settings"
|
||||
android:title="@string/pref_title_notifications_generic_settings" />
|
||||
|
||||
<Preference
|
||||
android:key="notifications_generic"
|
||||
android:title="@string/pref_title_notifications_generic" />
|
||||
|
Loading…
Reference in New Issue
Block a user