Loading res/xml/upgraded_channel_notification_settings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ settings:useAdditionalSummary="true" /> <PreferenceCategory android:key="advanced" android:title="@string/advanced_apps"> <!-- Visibility Override --> Loading src/com/android/settings/notification/ChannelNotificationSettings.java +10 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.Bundle; import android.os.AsyncTask; import android.provider.Settings; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceGroup; import android.text.TextUtils; import android.text.BidiFormatter; import android.text.SpannableStringBuilder; Loading Loading @@ -57,6 +58,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { private static final String KEY_VIBRATE = "vibrate"; private static final String KEY_RINGTONE = "ringtone"; private static final String KEY_IMPORTANCE = "importance"; private static final String KEY_ADVANCED = "advanced"; private Preference mImportance; private RestrictedSwitchPreference mLights; Loading @@ -65,6 +67,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { private FooterPreference mFooter; private NotificationChannelGroup mChannelGroup; private EntityHeaderController mHeaderPref; private PreferenceGroup mAdvanced; @Override public int getMetricsCategory() { Loading Loading @@ -129,6 +132,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { setupVibrate(); setupRingtone(); setupImportance(); mAdvanced = (PreferenceGroup) findPreference(KEY_ADVANCED); } private void addHeaderPref() { Loading Loading @@ -373,18 +377,19 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { if (mShowLegacyChannelConfig) { setVisible(mImportanceToggle, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); } else { setVisible(mAdvanced, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); setVisible(mImportance, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); setVisible(mLights, checkCanBeVisible( setVisible(mAdvanced, mLights, checkCanBeVisible( NotificationManager.IMPORTANCE_DEFAULT) && canPulseLight()); setVisible(mVibrate, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT)); setVisible(mRingtone, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT)); } setVisible(mBadge, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); setVisible(mPriority, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT) setVisible(mAdvanced, mBadge, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); setVisible(mAdvanced, mPriority, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT) || (checkCanBeVisible(NotificationManager.IMPORTANCE_LOW) && mDndVisualEffectsSuppressed)); setVisible(mVisibilityOverride, checkCanBeVisible(NotificationManager.IMPORTANCE_LOW) && isLockScreenSecure()); setVisible(mAdvanced, mVisibilityOverride, isLockScreenSecure() &&checkCanBeVisible(NotificationManager.IMPORTANCE_LOW)); setVisible(mBlockedDesc, mChannel.getImportance() == IMPORTANCE_NONE); if (mAppLink != null) { setVisible(mAppLink, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); Loading src/com/android/settings/notification/NotificationSettingsBase.java +8 −3 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import android.provider.Settings; import android.service.notification.NotificationListenerService; import android.support.v7.preference.DropDownPreference; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceGroup; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; Loading Loading @@ -195,12 +196,16 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen } protected void setVisible(Preference p, boolean visible) { final boolean isVisible = getPreferenceScreen().findPreference(p.getKey()) != null; setVisible(getPreferenceScreen(), p, visible); } protected void setVisible(PreferenceGroup parent, Preference p, boolean visible) { final boolean isVisible = parent.findPreference(p.getKey()) != null; if (isVisible == visible) return; if (visible) { getPreferenceScreen().addPreference(p); parent.addPreference(p); } else { getPreferenceScreen().removePreference(p); parent.removePreference(p); } } Loading Loading
res/xml/upgraded_channel_notification_settings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ settings:useAdditionalSummary="true" /> <PreferenceCategory android:key="advanced" android:title="@string/advanced_apps"> <!-- Visibility Override --> Loading
src/com/android/settings/notification/ChannelNotificationSettings.java +10 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.Bundle; import android.os.AsyncTask; import android.provider.Settings; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceGroup; import android.text.TextUtils; import android.text.BidiFormatter; import android.text.SpannableStringBuilder; Loading Loading @@ -57,6 +58,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { private static final String KEY_VIBRATE = "vibrate"; private static final String KEY_RINGTONE = "ringtone"; private static final String KEY_IMPORTANCE = "importance"; private static final String KEY_ADVANCED = "advanced"; private Preference mImportance; private RestrictedSwitchPreference mLights; Loading @@ -65,6 +67,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { private FooterPreference mFooter; private NotificationChannelGroup mChannelGroup; private EntityHeaderController mHeaderPref; private PreferenceGroup mAdvanced; @Override public int getMetricsCategory() { Loading Loading @@ -129,6 +132,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { setupVibrate(); setupRingtone(); setupImportance(); mAdvanced = (PreferenceGroup) findPreference(KEY_ADVANCED); } private void addHeaderPref() { Loading Loading @@ -373,18 +377,19 @@ public class ChannelNotificationSettings extends NotificationSettingsBase { if (mShowLegacyChannelConfig) { setVisible(mImportanceToggle, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); } else { setVisible(mAdvanced, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); setVisible(mImportance, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); setVisible(mLights, checkCanBeVisible( setVisible(mAdvanced, mLights, checkCanBeVisible( NotificationManager.IMPORTANCE_DEFAULT) && canPulseLight()); setVisible(mVibrate, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT)); setVisible(mRingtone, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT)); } setVisible(mBadge, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); setVisible(mPriority, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT) setVisible(mAdvanced, mBadge, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); setVisible(mAdvanced, mPriority, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT) || (checkCanBeVisible(NotificationManager.IMPORTANCE_LOW) && mDndVisualEffectsSuppressed)); setVisible(mVisibilityOverride, checkCanBeVisible(NotificationManager.IMPORTANCE_LOW) && isLockScreenSecure()); setVisible(mAdvanced, mVisibilityOverride, isLockScreenSecure() &&checkCanBeVisible(NotificationManager.IMPORTANCE_LOW)); setVisible(mBlockedDesc, mChannel.getImportance() == IMPORTANCE_NONE); if (mAppLink != null) { setVisible(mAppLink, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN)); Loading
src/com/android/settings/notification/NotificationSettingsBase.java +8 −3 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import android.provider.Settings; import android.service.notification.NotificationListenerService; import android.support.v7.preference.DropDownPreference; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceGroup; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; Loading Loading @@ -195,12 +196,16 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen } protected void setVisible(Preference p, boolean visible) { final boolean isVisible = getPreferenceScreen().findPreference(p.getKey()) != null; setVisible(getPreferenceScreen(), p, visible); } protected void setVisible(PreferenceGroup parent, Preference p, boolean visible) { final boolean isVisible = parent.findPreference(p.getKey()) != null; if (isVisible == visible) return; if (visible) { getPreferenceScreen().addPreference(p); parent.addPreference(p); } else { getPreferenceScreen().removePreference(p); parent.removePreference(p); } } Loading