Merge "Properly show/hide advanced settings" into oc-mr1-dev am: 12c9d6d65a
am: fa3fa3483e
Change-Id: I9cab11035c64975b45e1c3d99bd707a07b6c693e
This commit is contained in:
@@ -365,17 +365,17 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
|
|||||||
} else {
|
} else {
|
||||||
setVisible(mAdvanced, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN));
|
setVisible(mAdvanced, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN));
|
||||||
setVisible(mImportance, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN));
|
setVisible(mImportance, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN));
|
||||||
setVisible(mLights, checkCanBeVisible(
|
setVisible(mAdvanced, mLights, checkCanBeVisible(
|
||||||
NotificationManager.IMPORTANCE_DEFAULT) && canPulseLight());
|
NotificationManager.IMPORTANCE_DEFAULT) && canPulseLight());
|
||||||
setVisible(mVibrate, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT));
|
setVisible(mVibrate, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT));
|
||||||
setVisible(mRingtone, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT));
|
setVisible(mRingtone, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT));
|
||||||
}
|
}
|
||||||
setVisible(mBadge, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN));
|
setVisible(mAdvanced, mBadge, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN));
|
||||||
setVisible(mPriority, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT)
|
setVisible(mAdvanced, mPriority, checkCanBeVisible(NotificationManager.IMPORTANCE_DEFAULT)
|
||||||
|| (checkCanBeVisible(NotificationManager.IMPORTANCE_LOW)
|
|| (checkCanBeVisible(NotificationManager.IMPORTANCE_LOW)
|
||||||
&& mDndVisualEffectsSuppressed));
|
&& mDndVisualEffectsSuppressed));
|
||||||
setVisible(mVisibilityOverride, checkCanBeVisible(NotificationManager.IMPORTANCE_LOW)
|
setVisible(mAdvanced, mVisibilityOverride, isLockScreenSecure()
|
||||||
&& isLockScreenSecure());
|
&&checkCanBeVisible(NotificationManager.IMPORTANCE_LOW));
|
||||||
setVisible(mBlockedDesc, mChannel.getImportance() == IMPORTANCE_NONE);
|
setVisible(mBlockedDesc, mChannel.getImportance() == IMPORTANCE_NONE);
|
||||||
if (mAppLink != null) {
|
if (mAppLink != null) {
|
||||||
setVisible(mAppLink, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN));
|
setVisible(mAppLink, checkCanBeVisible(NotificationManager.IMPORTANCE_MIN));
|
||||||
|
@@ -205,12 +205,16 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void setVisible(Preference p, boolean visible) {
|
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 (isVisible == visible) return;
|
||||||
if (visible) {
|
if (visible) {
|
||||||
getPreferenceScreen().addPreference(p);
|
parent.addPreference(p);
|
||||||
} else {
|
} else {
|
||||||
getPreferenceScreen().removePreference(p);
|
parent.removePreference(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user