mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 12:26:48 +01:00
Preferences: "Generic Notification Support" is no longer a checkbox - it now opens the Android Notificaion Permission Dialog
If the permission is not granted we wont get notfifications, an extra preference for Gadgetbridge is pointless, so I removed it.
This commit is contained in:
parent
3e4922a4eb
commit
eeb74b4c61
@ -31,9 +31,6 @@ public class NotificationListener extends NotificationListenerService {
|
||||
Log.i(TAG, source);
|
||||
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (!sharedPrefs.getBoolean("notifications_generic", true)) {
|
||||
return;
|
||||
}
|
||||
if (!sharedPrefs.getBoolean("notifications_generic_whenscreenon", false)) {
|
||||
PowerManager powermanager = (PowerManager) getSystemService(POWER_SERVICE);
|
||||
if (powermanager.isScreenOn()) {
|
||||
|
@ -2,6 +2,7 @@ package nodomain.freeyourgadget.gadgetbridge;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@ -65,6 +66,14 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
getPreferenceScreen().addPreference(fakeHeader);
|
||||
addPreferencesFromResource(R.xml.pref_notification);
|
||||
|
||||
Preference pref = (Preference) findPreference("notifications_generic");
|
||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Intent enableIntent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
||||
startActivity(enableIntent);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
|
||||
// their values. When their values change, their summaries are updated
|
||||
@ -135,7 +144,6 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
? listPreference.getEntries()[index]
|
||||
: null);
|
||||
|
||||
|
||||
} else {
|
||||
// For all other preferences, set the summary to the value's
|
||||
// simple string representation.
|
||||
@ -181,8 +189,8 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
// to their values. When their values change, their summaries are
|
||||
// updated to reflect the new value, per the Android Design
|
||||
// guidelines.
|
||||
bindPreferenceSummaryToValue(findPreference("example_text"));
|
||||
bindPreferenceSummaryToValue(findPreference("example_list"));
|
||||
//bindPreferenceSummaryToValue(findPreference("example_text"));
|
||||
//bindPreferenceSummaryToValue(findPreference("example_list"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,11 +205,20 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.pref_notification);
|
||||
|
||||
Preference pref = (Preference) findPreference("notifications_generic");
|
||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Intent enableIntent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
||||
startActivity(enableIntent);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||
// to their values. When their values change, their summaries are
|
||||
// updated to reflect the new value, per the Android Design
|
||||
// guidelines.
|
||||
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
|
||||
//bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,43 +3,41 @@
|
||||
<!-- A 'parent' preference, which enables/disables child preferences (below)
|
||||
when checked/unchecked. -->
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="notifications_sms"
|
||||
android:title="@string/pref_title_notifications_sms"
|
||||
android:defaultValue="true" />
|
||||
android:title="@string/pref_title_notifications_sms" />
|
||||
|
||||
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:dependency="notifications_sms"
|
||||
android:key="notifications_sms_whenscreenon"
|
||||
android:title="@string/pref_title_whenscreenon"
|
||||
android:defaultValue="false" />
|
||||
android:title="@string/pref_title_whenscreenon" />
|
||||
|
||||
<!-- A 'parent' preference, which enables/disables child preferences (below)
|
||||
when checked/unchecked. -->
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="notifications_k9mail"
|
||||
android:title="@string/pref_title_notifications_k9mail"
|
||||
android:defaultValue="true" />
|
||||
android:title="@string/pref_title_notifications_k9mail" />
|
||||
|
||||
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:dependency="notifications_k9mail"
|
||||
android:key="notifications_k9mail_whenscreenon"
|
||||
android:title="@string/pref_title_whenscreenon"
|
||||
android:defaultValue="false" />
|
||||
android:title="@string/pref_title_whenscreenon" />
|
||||
|
||||
<!-- A 'parent' preference, which enables/disables child preferences (below)
|
||||
when checked/unchecked. -->
|
||||
<CheckBoxPreference
|
||||
<Preference
|
||||
android:key="notifications_generic"
|
||||
android:title="@string/pref_title_notifications_generic"
|
||||
android:defaultValue="true" />
|
||||
android:title="@string/pref_title_notifications_generic" />
|
||||
|
||||
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
|
||||
<CheckBoxPreference
|
||||
android:dependency="notifications_generic"
|
||||
android:defaultValue="false"
|
||||
android:key="notifications_generic_whenscreenon"
|
||||
android:title="@string/pref_title_whenscreenon"
|
||||
android:defaultValue="false" />
|
||||
android:title="@string/pref_title_whenscreenon" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
Loading…
Reference in New Issue
Block a user