From fe6c6f31fc807aa221fa6f46d12d303dfe411d24 Mon Sep 17 00:00:00 2001 From: Luis Vidal Date: Wed, 11 May 2016 16:58:54 -0700 Subject: Profiles: Disable notification item if ringtone & notification volumes are linked The notification item will be disabled if the notification and ringtone volumes are linked. This is to keep consistency with the sound settings Change-Id: Ibbe7612eae5e9b7b18d63450ab8331f02becf5ca TICKET: CYNGNOS-958 --- .../settings/profiles/actions/item/VolumeStreamItem.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/com/android/settings/profiles') diff --git a/src/com/android/settings/profiles/actions/item/VolumeStreamItem.java b/src/com/android/settings/profiles/actions/item/VolumeStreamItem.java index 9bcf2ef..f4d76c7 100644 --- a/src/com/android/settings/profiles/actions/item/VolumeStreamItem.java +++ b/src/com/android/settings/profiles/actions/item/VolumeStreamItem.java @@ -17,6 +17,7 @@ package com.android.settings.profiles.actions.item; import android.content.Context; import android.media.AudioManager; +import android.provider.Settings; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -30,6 +31,7 @@ import com.android.settings.profiles.actions.ItemListAdapter; public class VolumeStreamItem implements Item { private int mStreamId; private StreamSettings mStreamSettings; + private boolean mEnabled; public VolumeStreamItem(int streamId, StreamSettings streamSettings) { mStreamId = streamId; @@ -43,7 +45,7 @@ public class VolumeStreamItem implements Item { @Override public boolean isEnabled() { - return true; + return mEnabled; } @Override @@ -72,6 +74,15 @@ public class VolumeStreamItem implements Item { desc.setText(context.getString(R.string.profile_action_none)); } + final boolean volumeLinkNotification = Settings.Secure.getInt(context + .getContentResolver(), Settings.Secure.VOLUME_LINK_NOTIFICATION, 1) == 1; + mEnabled = true; + if (mStreamId == AudioManager.STREAM_NOTIFICATION && volumeLinkNotification) { + mEnabled = false; + text.setEnabled(false); + desc.setEnabled(false); + } + return view; } -- cgit v1.1