Introduce IMPORTANCE_MIN.

Bug: 22960980
Change-Id: Ia3876e0b3b5dae19553fd467313b46408fcbb0f4
This commit is contained in:
Julia Reynolds
2016-02-25 09:35:44 -05:00
parent d4559a8035
commit 518b93f565
4 changed files with 20 additions and 10 deletions

View File

@@ -5946,17 +5946,20 @@
<!-- [CHAR LIMIT=100] Notification Importance slider: blocked importance level description --> <!-- [CHAR LIMIT=100] Notification Importance slider: blocked importance level description -->
<string name="notification_importance_blocked">Blocked: Never show these notifications</string> <string name="notification_importance_blocked">Blocked: Never show these notifications</string>
<!-- [CHAR LIMIT=100] Notification Importance slider: min importance level description -->
<string name="notification_importance_min">Min: Silently show at the bottom of the notification list</string>
<!-- [CHAR LIMIT=100] Notification Importance slider: low importance level description --> <!-- [CHAR LIMIT=100] Notification Importance slider: low importance level description -->
<string name="notification_importance_low">Low: Silently show at the bottom of the notification list</string> <string name="notification_importance_low">Low: Silently show these notifications</string>
<!-- [CHAR LIMIT=100] Notification Importance slider: normal importance level description --> <!-- [CHAR LIMIT=100] Notification Importance slider: normal importance level description -->
<string name="notification_importance_default">Normal: Silently show these notifications</string> <string name="notification_importance_default">Normal: Allow these notification to make sounds</string>
<!-- [CHAR LIMIT=100] Notification Importance slider: high importance level description --> <!-- [CHAR LIMIT=100] Notification Importance slider: high importance level description -->
<string name="notification_importance_high">High: Show at the top of the notifications list and allow sound</string> <string name="notification_importance_high">High: Peek onto the screen and allow sound and allow sound</string>
<!-- [CHAR LIMIT=100] Notification Importance slider: max importance level description --> <!-- [CHAR LIMIT=100] Notification Importance slider: max importance level description -->
<string name="notification_importance_max">Urgent: Peek onto the screen and allow sound</string> <string name="notification_importance_max">Urgent: Show at the top of the notifications list, peek onto the screen and allow sound</string>
<!-- [CHAR LIMIT=60] Notification importance reset button --> <!-- [CHAR LIMIT=60] Notification importance reset button -->
<string name="importance_reset">Reset</string> <string name="importance_reset">Reset</string>

View File

@@ -106,12 +106,12 @@ public class AppNotificationSettings extends NotificationSettingsBase {
final boolean allowPrivate = getLockscreenAllowPrivateNotifications(); final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
if (getPreferenceScreen().findPreference(mBlock.getKey()) != null) { if (getPreferenceScreen().findPreference(mBlock.getKey()) != null) {
setVisible(mSilent, checkCanBeVisible(Ranking.IMPORTANCE_LOW, importance)); setVisible(mSilent, checkCanBeVisible(Ranking.IMPORTANCE_MIN, importance));
mSilent.setChecked(importance == Ranking.IMPORTANCE_DEFAULT); mSilent.setChecked(importance == Ranking.IMPORTANCE_LOW);
} }
setVisible(mPriority, checkCanBeVisible(Ranking.IMPORTANCE_LOW, importance) setVisible(mPriority, checkCanBeVisible(Ranking.IMPORTANCE_DEFAULT, importance)
&& !mDndVisualEffectsSuppressed); && !mDndVisualEffectsSuppressed);
setVisible(mSensitive, checkCanBeVisible(Ranking.IMPORTANCE_HIGH, importance) setVisible(mSensitive, checkCanBeVisible(Ranking.IMPORTANCE_MIN, importance)
&& lockscreenSecure && lockscreenNotificationsEnabled && allowPrivate); && lockscreenSecure && lockscreenNotificationsEnabled && allowPrivate);
} }

View File

@@ -175,7 +175,7 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
mImportanceTitle.setSummary(getProgressSummary(importance)); mImportanceTitle.setSummary(getProgressSummary(importance));
mImportance.setSystemApp(isSystemApp); mImportance.setSystemApp(isSystemApp);
mImportance.setMinimumProgress( mImportance.setMinimumProgress(
isSystemApp ? Ranking.IMPORTANCE_LOW : Ranking.IMPORTANCE_NONE); isSystemApp ? Ranking.IMPORTANCE_MIN : Ranking.IMPORTANCE_NONE);
mImportance.setMax(Ranking.IMPORTANCE_MAX); mImportance.setMax(Ranking.IMPORTANCE_MAX);
mImportance.setProgress(importance); mImportance.setProgress(importance);
mImportance.setCallback(new ImportanceSeekBarPreference.Callback() { mImportance.setCallback(new ImportanceSeekBarPreference.Callback() {
@@ -230,7 +230,7 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean silenced = (Boolean) newValue; final boolean silenced = (Boolean) newValue;
final int importance = final int importance =
silenced ? Ranking.IMPORTANCE_DEFAULT : Ranking.IMPORTANCE_UNSPECIFIED; silenced ? Ranking.IMPORTANCE_LOW : Ranking.IMPORTANCE_UNSPECIFIED;
mBackend.setImportance(mPkgInfo.packageName, mUid, importance); mBackend.setImportance(mPkgInfo.packageName, mUid, importance);
updateDependents(importance); updateDependents(importance);
return true; return true;
@@ -244,6 +244,8 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
switch (progress) { switch (progress) {
case Ranking.IMPORTANCE_NONE: case Ranking.IMPORTANCE_NONE:
return mContext.getString(R.string.notification_importance_blocked); return mContext.getString(R.string.notification_importance_blocked);
case Ranking.IMPORTANCE_MIN:
return mContext.getString(R.string.notification_importance_min);
case Ranking.IMPORTANCE_LOW: case Ranking.IMPORTANCE_LOW:
return mContext.getString(R.string.notification_importance_low); return mContext.getString(R.string.notification_importance_low);
case Ranking.IMPORTANCE_DEFAULT: case Ranking.IMPORTANCE_DEFAULT:

View File

@@ -109,6 +109,11 @@ public class NotificationStation extends SettingsPreferenceFragment {
public void onNotificationRankingUpdate(RankingMap ranking) { public void onNotificationRankingUpdate(RankingMap ranking) {
mRanking = ranking; mRanking = ranking;
} }
@Override
public void onListenerConnected() {
mRanking = getCurrentRanking();
}
}; };
private Context mContext; private Context mContext;