diff options
| author | PrimeDirective <activethrasher00@gmail.com> | 2014-11-02 16:39:03 +0100 |
|---|---|---|
| committer | LorDClockaN <davor@losinj.com> | 2014-11-02 16:56:15 +0100 |
| commit | 35c4a2ae61610a02130b360a97a027240cc04a20 (patch) | |
| tree | 244263585a9a8bd1f6722bbc02437ec95d22d833 | |
| parent | 56fcbe79188e2ee39c353c9783489f2e287e5bf7 (diff) | |
ActiveNotifications: fixes for consistencykitkat
PS2: AICPfy
Change-Id: I08b4d62444104fe2ed7f8869f4bee1161ab25030
| -rw-r--r-- | res/xml/active_notification_settings.xml | 5 | ||||
| -rw-r--r-- | res/xml/active_notifications.xml | 5 | ||||
| -rw-r--r-- | src/com/android/settings/vanir/ActiveNotificationSettings.java | 93 | ||||
| -rw-r--r-- | src/com/android/settings/vanir/ActiveNotifications.java | 20 |
4 files changed, 70 insertions, 53 deletions
diff --git a/res/xml/active_notification_settings.xml b/res/xml/active_notification_settings.xml index ada70c31826..ef36b16a704 100644 --- a/res/xml/active_notification_settings.xml +++ b/res/xml/active_notification_settings.xml @@ -89,6 +89,11 @@ android:summary="@string/wake_on_notification_summary" /> <CheckBoxPreference + android:key="dismiss_all" + android:title="@string/dismiss_all" + android:summary="@string/dismiss_all_summary" /> + + <CheckBoxPreference android:key="expanded_view" android:title="@string/expanded_view" android:summary="@string/expanded_view_summary" /> diff --git a/res/xml/active_notifications.xml b/res/xml/active_notifications.xml index 935f5498e22..6cd9eaf3983 100644 --- a/res/xml/active_notifications.xml +++ b/res/xml/active_notifications.xml @@ -52,11 +52,6 @@ android:title="@string/hide_non_clearable" android:summary="@string/hide_non_clearable_summary" /> - <CheckBoxPreference - android:key="dismiss_all" - android:title="@string/dismiss_all" - android:summary="@string/dismiss_all_summary" /> - </PreferenceCategory> <PreferenceScreen diff --git a/src/com/android/settings/vanir/ActiveNotificationSettings.java b/src/com/android/settings/vanir/ActiveNotificationSettings.java index e0887a5497b..2d5c320fe9c 100644 --- a/src/com/android/settings/vanir/ActiveNotificationSettings.java +++ b/src/com/android/settings/vanir/ActiveNotificationSettings.java @@ -16,6 +16,7 @@ package com.android.settings.vanir; +import android.content.ContentResolver; import android.content.Context; import android.graphics.Point; import android.os.Bundle; @@ -45,10 +46,11 @@ public class ActiveNotificationSettings extends SettingsPreferenceFragment imple private static final String KEY_ACTIVE_DISPLAY_DOUBLE_TAP = "active_display_double_tap"; private static final String KEY_OFFSET_TOP = "offset_top"; private static final String KEY_EXPANDED_VIEW = "expanded_view"; - private static final String KEY_WAKE_ON_NOTIFICATION = "wake_on_notification"; + private static final String KEY_DISMISS_ALL = "dismiss_all"; private static final String KEY_FORCE_EXPANDED_VIEW = "force_expanded_view"; private static final String KEY_NOTIFICATIONS_HEIGHT = "notifications_height"; private static final String KEY_EXCLUDED_NOTIF_APPS = "excluded_apps"; + private static final String KEY_WAKE_ON_NOTIFICATION = "wake_on_notification"; private static final String KEY_NOTIFICATION_COLOR = "notification_color"; private CheckBoxPreference mShowTextPref; @@ -58,77 +60,83 @@ public class ActiveNotificationSettings extends SettingsPreferenceFragment imple private ListPreference mDisplayTimeout; private ListPreference mProximityThreshold; private SeekBarPreference mOffsetTop; + private CheckBoxPreference mWakeOnNotification; private CheckBoxPreference mExpandedView; private CheckBoxPreference mForceExpandedView; - private CheckBoxPreference mWakeOnNotification; private NumberPickerPreference mNotificationsHeight; private ColorPickerPreference mNotificationColor; + private CheckBoxPreference mDismissAll; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.active_notification_settings); + ContentResolver cr = getContentResolver(); mShowTextPref = (CheckBoxPreference) findPreference(KEY_SHOW_TEXT); - mShowTextPref.setChecked((Settings.System.getInt(getContentResolver(), + mShowTextPref.setChecked((Settings.System.getInt(cr, Settings.System.ACTIVE_DISPLAY_TEXT, 0) == 1)); PreferenceScreen prefSet = getPreferenceScreen(); mRedisplayPref = (ListPreference) prefSet.findPreference(KEY_REDISPLAY); mRedisplayPref.setOnPreferenceChangeListener(this); - long timeout = Settings.System.getLong(getContentResolver(), + long timeout = Settings.System.getLong(cr, Settings.System.ACTIVE_DISPLAY_REDISPLAY, 0); mRedisplayPref.setValue(String.valueOf(timeout)); updateRedisplaySummary(timeout); - mShowDatePref = (CheckBoxPreference) findPreference(KEY_ACTIVE_DISPLAY_DOUBLE_TAP); - mShowDatePref.setChecked((Settings.System.getInt(getContentResolver(), + mShowDatePref = (CheckBoxPreference) findPreference(KEY_SHOW_DATE); + mShowDatePref.setChecked((Settings.System.getInt(cr, Settings.System.ACTIVE_DISPLAY_DOUBLE_TAP, 0) == 1)); - mAdDoubleTap = (CheckBoxPreference) findPreference(KEY_SHOW_DATE); - mAdDoubleTap.setChecked((Settings.System.getInt(getContentResolver(), + mAdDoubleTap = (CheckBoxPreference) findPreference(KEY_ACTIVE_DISPLAY_DOUBLE_TAP); + mAdDoubleTap.setChecked((Settings.System.getInt(cr, Settings.System.ACTIVE_DISPLAY_SHOW_DATE, 0) == 1)); mDisplayTimeout = (ListPreference) prefSet.findPreference(KEY_TIMEOUT); mDisplayTimeout.setOnPreferenceChangeListener(this); - timeout = Settings.System.getLong(getContentResolver(), + timeout = Settings.System.getLong(cr, Settings.System.ACTIVE_DISPLAY_TIMEOUT, 8000L); mDisplayTimeout.setValue(String.valueOf(timeout)); updateTimeoutSummary(timeout); + mWakeOnNotification = (CheckBoxPreference) prefSet.findPreference(KEY_WAKE_ON_NOTIFICATION); + mWakeOnNotification.setChecked(Settings.System.getInt(cr, + Settings.System.LOCKSCREEN_NOTIFICATIONS_WAKE_ON_NOTIFICATION, 0) == 1); + mProximityThreshold = (ListPreference) prefSet.findPreference(KEY_THRESHOLD); mProximityThreshold.setOnPreferenceChangeListener(this); - long threshold = Settings.System.getLong(getContentResolver(), + long threshold = Settings.System.getLong(cr, Settings.System.ACTIVE_DISPLAY_THRESHOLD, 5000L); mProximityThreshold.setValue(String.valueOf(threshold)); updateThresholdSummary(threshold); mOffsetTop = (SeekBarPreference) findPreference(KEY_OFFSET_TOP); - mOffsetTop.setProgress((int)(Settings.System.getFloat(getContentResolver(), + mOffsetTop.setProgress((int)(Settings.System.getFloat(cr, Settings.System.LOCKSCREEN_NOTIFICATIONS_OFFSET_TOP, 0.3f) * 100)); mOffsetTop.setTitle(getResources().getText(R.string.offset_top) + " " + mOffsetTop.getProgress() + "%"); mOffsetTop.setOnPreferenceChangeListener(this); mExpandedView = (CheckBoxPreference) findPreference(KEY_EXPANDED_VIEW); - mExpandedView.setChecked(Settings.System.getInt(getContentResolver(), + mExpandedView.setChecked(Settings.System.getInt(cr, Settings.System.LOCKSCREEN_NOTIFICATIONS_EXPANDED_VIEW, 1) == 1); mForceExpandedView = (CheckBoxPreference) findPreference(KEY_FORCE_EXPANDED_VIEW); - mForceExpandedView.setChecked(Settings.System.getInt(getContentResolver(), + mForceExpandedView.setChecked(Settings.System.getInt(cr, Settings.System.LOCKSCREEN_NOTIFICATIONS_FORCE_EXPANDED_VIEW, 0) == 1); - mWakeOnNotification = (CheckBoxPreference) findPreference(KEY_WAKE_ON_NOTIFICATION); - mWakeOnNotification.setChecked(Settings.System.getInt(getContentResolver(), - Settings.System.LOCKSCREEN_NOTIFICATIONS_WAKE_ON_NOTIFICATION, 0) == 1); + mDismissAll = (CheckBoxPreference) prefSet.findPreference(KEY_DISMISS_ALL); + mDismissAll.setChecked(Settings.System.getInt(cr, + Settings.System.LOCKSCREEN_NOTIFICATIONS_DISMISS_ALL, 1) == 1); mNotificationsHeight = (NumberPickerPreference) findPreference(KEY_NOTIFICATIONS_HEIGHT); - mNotificationsHeight.setValue(Settings.System.getInt(getContentResolver(), + mNotificationsHeight.setValue(Settings.System.getInt(cr, Settings.System.LOCKSCREEN_NOTIFICATIONS_HEIGHT, 4)); mNotificationColor = (ColorPickerPreference) prefSet.findPreference(KEY_NOTIFICATION_COLOR); mNotificationColor.setAlphaSliderEnabled(true); - int color = Settings.System.getInt(getContentResolver(), + int color = Settings.System.getInt(cr, Settings.System.LOCKSCREEN_NOTIFICATIONS_COLOR, 0x55555555); String hexColor = String.format("#%08x", (0xffffffff & color)); mNotificationColor.setSummary(hexColor); @@ -154,10 +162,11 @@ public class ActiveNotificationSettings extends SettingsPreferenceFragment imple } private void updateEnabled() { - boolean Megadeth = Settings.System.getInt(getContentResolver(), + ContentResolver cr = getContentResolver(); + boolean Megadeth = Settings.System.getInt(cr, Settings.System.LOCKSCREEN_NOTIFICATIONS, 0) == 1; - boolean AmonAmarth = Settings.System.getInt(getContentResolver(), + boolean AmonAmarth = Settings.System.getInt(cr, Settings.System.ENABLE_ACTIVE_DISPLAY, 0) == 1; if (!AmonAmarth) { @@ -177,26 +186,31 @@ public class ActiveNotificationSettings extends SettingsPreferenceFragment imple } if (!Megadeth) { - mWakeOnNotification.setEnabled(false); mOffsetTop.setEnabled(false); mNotificationsHeight.setEnabled(false); mNotificationColor.setEnabled(false); mForceExpandedView.setEnabled(false); mExpandedView.setEnabled(false); + mDismissAll.setEnabled(false); } else { - mWakeOnNotification.setEnabled(true); mOffsetTop.setEnabled(true); mNotificationsHeight.setEnabled(true); mNotificationColor.setEnabled(true); mForceExpandedView.setEnabled(true); mExpandedView.setEnabled(true); + mDismissAll.setEnabled(Settings.System.getInt(cr, + Settings.System.LOCKSCREEN_NOTIFICATIONS_HIDE_NON_CLEARABLE, 0) == 0); } if (AmonAmarth) { mWakeOnNotification.setEnabled(false); mWakeOnNotification.setSummary(R.string.wake_on_notification_disable); } else { - mWakeOnNotification.setEnabled(true); + if (!Megadeth) { + mWakeOnNotification.setEnabled(false); + } else { + mWakeOnNotification.setEnabled(true); + } mWakeOnNotification.setSummary(R.string.wake_on_notification_summary); } } @@ -206,18 +220,22 @@ public class ActiveNotificationSettings extends SettingsPreferenceFragment imple int timeout = Integer.valueOf((String) newValue); updateRedisplaySummary(timeout); return true; + } else if (preference == mNotificationsHeight) { Settings.System.putInt(getContentResolver(), Settings.System.LOCKSCREEN_NOTIFICATIONS_HEIGHT, (Integer)newValue); return true; + } else if (preference == mDisplayTimeout) { long timeout = Integer.valueOf((String) newValue); updateTimeoutSummary(timeout); return true; + } else if (preference == mProximityThreshold) { long threshold = Integer.valueOf((String) newValue); updateThresholdSummary(threshold); return true; + } else if (preference == mNotificationColor) { String hex = ColorPickerPreference.convertToARGB( Integer.valueOf(String.valueOf(newValue))); @@ -226,6 +244,7 @@ public class ActiveNotificationSettings extends SettingsPreferenceFragment imple Settings.System.putInt(getActivity().getContentResolver(), Settings.System.LOCKSCREEN_NOTIFICATIONS_COLOR, intHex); return true; + } else if (preference == mOffsetTop) { Settings.System.putFloat(getContentResolver(), Settings.System.LOCKSCREEN_NOTIFICATIONS_OFFSET_TOP, (Integer)newValue / 100f); @@ -245,30 +264,34 @@ public class ActiveNotificationSettings extends SettingsPreferenceFragment imple boolean value; if (preference == mShowTextPref) { - value = mShowTextPref.isChecked(); - Settings.System.putInt(getContentResolver(), - Settings.System.ACTIVE_DISPLAY_TEXT, - value ? 1 : 0); + Settings.System.putInt(getContentResolver(), Settings.System.ACTIVE_DISPLAY_TEXT, + mShowTextPref.isChecked() ? 1 : 0); + } else if (preference == mExpandedView) { Settings.System.putInt(getContentResolver(), Settings.System.LOCKSCREEN_NOTIFICATIONS_EXPANDED_VIEW, mExpandedView.isChecked() ? 1 : 0); mForceExpandedView.setEnabled(mExpandedView.isChecked()); + } else if (preference == mForceExpandedView) { Settings.System.putInt(getContentResolver(), Settings.System.LOCKSCREEN_NOTIFICATIONS_FORCE_EXPANDED_VIEW, mForceExpandedView.isChecked() ? 1 : 0); + + } else if (preference == mDismissAll) { + Settings.System.putInt(getContentResolver(), Settings.System.LOCKSCREEN_NOTIFICATIONS_DISMISS_ALL, + mDismissAll.isChecked() ? 1 : 0); + } else if (preference == mWakeOnNotification) { Settings.System.putInt(getContentResolver(), Settings.System.LOCKSCREEN_NOTIFICATIONS_WAKE_ON_NOTIFICATION, mWakeOnNotification.isChecked() ? 1 : 0); + } else if (preference == mShowDatePref) { - value = mShowDatePref.isChecked(); - Settings.System.putInt(getContentResolver(), - Settings.System.ACTIVE_DISPLAY_SHOW_DATE, - value ? 1 : 0); + Settings.System.putInt(getContentResolver(), Settings.System.ACTIVE_DISPLAY_SHOW_DATE, + mShowDatePref.isChecked() ? 1 : 0); + } else if (preference == mAdDoubleTap) { - value = mAdDoubleTap.isChecked(); - Settings.System.putInt(getContentResolver(), - Settings.System.ACTIVE_DISPLAY_DOUBLE_TAP, - value ? 1 : 0); + Settings.System.putInt(getContentResolver(), Settings.System.ACTIVE_DISPLAY_DOUBLE_TAP, + mAdDoubleTap.isChecked() ? 1 : 0); + } else { return super.onPreferenceTreeClick(preferenceScreen, preference); } diff --git a/src/com/android/settings/vanir/ActiveNotifications.java b/src/com/android/settings/vanir/ActiveNotifications.java index 268478fff22..68d58d570f4 100644 --- a/src/com/android/settings/vanir/ActiveNotifications.java +++ b/src/com/android/settings/vanir/ActiveNotifications.java @@ -46,7 +46,6 @@ public class ActiveNotifications extends SettingsPreferenceFragment implements private static final String KEY_POCKET_MODE = "pocket_mode"; private static final String KEY_HIDE_LOW_PRIORITY = "hide_low_priority"; private static final String KEY_HIDE_NON_CLEARABLE = "hide_non_clearable"; - private static final String KEY_DISMISS_ALL = "dismiss_all"; private static final String KEY_PRIVACY_MODE = "privacy_mode"; private static final String KEY_QUIET_HOURS = "quiet_hours"; private static final String KEY_ADDITIONAL = "additional_options"; @@ -65,7 +64,6 @@ public class ActiveNotifications extends SettingsPreferenceFragment implements private ListPreference mPocketModePref; private CheckBoxPreference mHideLowPriority; private CheckBoxPreference mHideNonClearable; - private CheckBoxPreference mDismissAll; private AppMultiSelectListPreference mExcludedAppsPref; private AppMultiSelectListPreference mNotifAppsPref; private CheckBoxPreference mPrivacyMode; @@ -140,10 +138,6 @@ public class ActiveNotifications extends SettingsPreferenceFragment implements mHideNonClearable.setChecked(Settings.System.getInt(cr, Settings.System.LOCKSCREEN_NOTIFICATIONS_HIDE_NON_CLEARABLE, 0) == 1); - mDismissAll = (CheckBoxPreference) prefs.findPreference(KEY_DISMISS_ALL); - mDismissAll.setChecked(Settings.System.getInt(cr, - Settings.System.LOCKSCREEN_NOTIFICATIONS_DISMISS_ALL, 1) == 1); - mPrivacyMode = (CheckBoxPreference) prefs.findPreference(KEY_PRIVACY_MODE); mPrivacyMode.setChecked(Settings.System.getInt(cr, Settings.System.ACTIVE_NOTIFICATIONS_PRIVACY_MODE, 0) == 1); @@ -188,7 +182,6 @@ public class ActiveNotifications extends SettingsPreferenceFragment implements mEnabledPref.setEnabled(mActiveNotifications); mHideLowPriority.setEnabled(mActiveNotifications); mHideNonClearable.setEnabled(mActiveNotifications); - mDismissAll.setEnabled(!mHideNonClearable.isChecked() && mActiveNotifications); mQuietHours.setEnabled(mActiveNotifications); mPrivacyMode.setEnabled(mActiveNotifications); mAdditional.setEnabled(mActiveNotifications); @@ -198,26 +191,27 @@ public class ActiveNotifications extends SettingsPreferenceFragment implements @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { - ContentResolver cr = getActivity().getContentResolver(); + ContentResolver cr = getContentResolver(); if (preference == mEnabledPref) { - Settings.System.putInt(getContentResolver(), + Settings.System.putInt(cr, Settings.System.ENABLE_ACTIVE_DISPLAY, mEnabledPref.isChecked() ? 1 : 0); + } else if (preference == mLockNotif) { Settings.System.putInt(getContentResolver(), Settings.System.LOCKSCREEN_NOTIFICATIONS, mLockNotif.isChecked() ? 1 : 0); + } else if (preference == mHideLowPriority) { Settings.System.putInt(cr, Settings.System.ACTIVE_NOTIFICATIONS_HIDE_LOW_PRIORITY, mHideLowPriority.isChecked() ? 1 : 0); + } else if (preference == mHideNonClearable) { Settings.System.putInt(cr, Settings.System.LOCKSCREEN_NOTIFICATIONS_HIDE_NON_CLEARABLE, mHideNonClearable.isChecked() ? 1 : 0); - mDismissAll.setEnabled(!mHideNonClearable.isChecked()); - } else if (preference == mDismissAll) { - Settings.System.putInt(cr, Settings.System.LOCKSCREEN_NOTIFICATIONS_DISMISS_ALL, - mDismissAll.isChecked() ? 1 : 0); + } else if (preference == mPrivacyMode) { Settings.System.putInt(cr, Settings.System.ACTIVE_NOTIFICATIONS_PRIVACY_MODE, mPrivacyMode.isChecked() ? 1 : 0); + } else if (preference == mQuietHours) { Settings.System.putInt(cr, Settings.System.ACTIVE_NOTIFICATIONS_QUIET_HOURS, mQuietHours.isChecked() ? 1 : 0); |
