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 -->
<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 -->
<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 -->
<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 -->
<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 -->
<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 -->
<string name="importance_reset">Reset</string>

View File

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

View File

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

View File

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