disable expanded notification option when unsupported & provide informative toast
This commit is contained in:
parent
baf980951e
commit
b43037c958
|
@ -255,7 +255,7 @@
|
||||||
<string name="pref_expandNotify_sum">Always expand the notification to show playback buttons.</string>
|
<string name="pref_expandNotify_sum">Always expand the notification to show playback buttons.</string>
|
||||||
<string name="pref_persistNotify_title">Persistent Notification</string>
|
<string name="pref_persistNotify_title">Persistent Notification</string>
|
||||||
<string name="pref_persistNotify_sum">Keep notification when playback is paused.</string>
|
<string name="pref_persistNotify_sum">Keep notification when playback is paused.</string>
|
||||||
|
<string name="pref_expand_notify_unsupport_toast">Android versions before 4.1 do not support expanded notifications.</string>
|
||||||
|
|
||||||
<!-- Auto-Flattr dialog -->
|
<!-- Auto-Flattr dialog -->
|
||||||
<string name="auto_flattr_enable">Enable automatic flattring</string>
|
<string name="auto_flattr_enable">Enable automatic flattring</string>
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.content.res.Resources.Theme;
|
||||||
import android.net.wifi.WifiConfiguration;
|
import android.net.wifi.WifiConfiguration;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Build;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
|
@ -59,6 +60,9 @@ public class PreferenceActivity extends android.preference.PreferenceActivity {
|
||||||
private static final String PREF_GPODNET_LOGOUT = "pref_gpodnet_logout";
|
private static final String PREF_GPODNET_LOGOUT = "pref_gpodnet_logout";
|
||||||
private static final String PREF_GPODNET_HOSTNAME = "pref_gpodnet_hostname";
|
private static final String PREF_GPODNET_HOSTNAME = "pref_gpodnet_hostname";
|
||||||
|
|
||||||
|
private static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify";
|
||||||
|
private static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify";
|
||||||
|
|
||||||
private CheckBoxPreference[] selectedNetworks;
|
private CheckBoxPreference[] selectedNetworks;
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
|
@ -76,6 +80,23 @@ public class PreferenceActivity extends android.preference.PreferenceActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.preferences);
|
addPreferencesFromResource(R.xml.preferences);
|
||||||
|
|
||||||
|
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
|
// disable expanded notification option on unsupported android versions
|
||||||
|
findPreference(PREF_EXPANDED_NOTIFICATION).setEnabled(false);
|
||||||
|
findPreference(PREF_EXPANDED_NOTIFICATION).setOnPreferenceClickListener(
|
||||||
|
new OnPreferenceClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
|
Toast toast = Toast.makeText(PreferenceActivity.this, R.string.pref_expand_notify_unsupport_toast, Toast.LENGTH_SHORT);
|
||||||
|
toast.show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
findPreference(PREF_FLATTR_THIS_APP).setOnPreferenceClickListener(
|
findPreference(PREF_FLATTR_THIS_APP).setOnPreferenceClickListener(
|
||||||
new OnPreferenceClickListener() {
|
new OnPreferenceClickListener() {
|
||||||
|
|
||||||
|
@ -271,8 +292,6 @@ public class PreferenceActivity extends android.preference.PreferenceActivity {
|
||||||
buildAutodownloadSelectedNetworsPreference();
|
buildAutodownloadSelectedNetworsPreference();
|
||||||
setSelectedNetworksEnabled(UserPreferences
|
setSelectedNetworksEnabled(UserPreferences
|
||||||
.isEnableAutodownloadWifiFilter());
|
.isEnableAutodownloadWifiFilter());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateGpodnetPreferenceScreen() {
|
private void updateGpodnetPreferenceScreen() {
|
||||||
|
|
Loading…
Reference in New Issue