Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 514748d2 authored by Luis Vidal's avatar Luis Vidal
Browse files

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
(cherry picked from commit fe6c6f31)
parent 57805bbc
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -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;
    }