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

Commit f89ae86a authored by Bruno Martins's avatar Bruno Martins
Browse files

Settings: Add switch for linked ring and media notification volumes



Author: Dan Pasanen <dan.pasanen@gmail.com>
Date:   Wed Oct 30 09:22:30 2019 -0500

    VolumePanel: fix showing notification volume slider when unlinked

    * volume_link_notification lives in Settings.Secure not LineageSettings.Secure
    * Set max panel slices to 6. We could have up to 5 volumes to control and
      MEDIA_OUTPUT_INDICATOR_SLICE_URI counts as one slice as well.

    Change-Id: I0a4c7db1c92e778fba669931259cd52164b1df65

Settings: Use correct icon for ring volume

Author: Han Wang <416810799@qq.com>
Date:   Tue Aug 4 13:33:45 2020 +0200

    Settings: Fix icon size for ring volume

    Change-Id: Idc62abbaea8d4d4ccb72f4a9f395ce0f861dc705

    Change-Id: If145262562c1409cd8a6cb79ba46b6646c75d1a8
    Signed-off-by: default avatarPMS22 <prathams99@rediff.com>

Change-Id: I900af398f566a5415c44fe883cc214985f4e9cd4
parent 4a425bee
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2016 The CyanogenMod Project
     Copyright (C) 2018 The LineageOS Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="?android:attr/colorControlNormal">

    <path
        android:fillColor="@android:color/black"
        android:pathData="M10,21H14A2,2 0 0,1 12,23A2,2 0 0,1 10,21M21,19V20H3V19L5,17V11C5,7.9 7.03,5.17 10,4.29C10,4.19 10,4.1 10,4A2,2 0 0,1 12,2A2,2 0 0,1 14,4C14,4.1 14,4.19 14,4.29C16.97,5.17 19,7.9 19,11V17L21,19M17,11A5,5 0 0,0 12,6A5,5 0 0,0 7,11V18H17V11M19.75,3.19L18.33,4.61C20.04,6.3 21,8.6 21,11H23C23,8.07 21.84,5.25 19.75,3.19M1,11H3C3,8.6 3.96,6.3 5.67,4.61L4.25,3.19C2.16,5.25 1,8.07 1,11Z" />
</vector>
+3 −0
Original line number Diff line number Diff line
@@ -18,4 +18,7 @@
    <!-- Backup Transport selection settings menu and activity title -->
    <string name="backup_transport_setting_label">Change backup provider</string>
    <string name="backup_transport_title">Select backup provider</string>

    <!-- Volume link notification -->
    <string name="volume_link_notification_title">Link ring &amp; notification volumes</string>
</resources>
+9 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@
    <!-- Ring volume -->
    <com.android.settings.notification.VolumeSeekBarPreference
        android:key="ring_volume"
        android:icon="@drawable/ic_notifications"
        android:icon="@drawable/ic_audio_ring"
        android:title="@string/ring_volume_option_title"
        android:order="-160"
        settings:controller="com.android.settings.notification.RingVolumePreferenceController"/>
@@ -89,6 +89,14 @@
        android:order="-140"
        settings:controller="com.android.settings.notification.NotificationVolumePreferenceController"/>

    <!-- Link ringtone and notification volumes -->
    <lineageos.preference.SecureSettingSwitchPreference
        android:key="volume_link_notification"
        android:title="@string/volume_link_notification_title"
        android:defaultValue="true"
        android:order="-138"
        settings:controller="com.android.settings.notification.LinkedVolumesPreferenceController"/>

    <!-- TODO(b/174964721): make this a PrimarySwitchPreference -->
    <!-- Interruptions -->
    <com.android.settingslib.RestrictedPreference
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The LineageOS Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.notification;

import android.content.Context;

import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;

public class LinkedVolumesPreferenceController extends BasePreferenceController {
    public LinkedVolumesPreferenceController(Context context, String key) {
        super(context, key);
    }

    @Override
    public int getAvailabilityStatus() {
        return Utils.isVoiceCapable(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
    }
}
+15 −2
Original line number Diff line number Diff line
@@ -35,8 +35,7 @@ public class NotificationVolumePreferenceController extends
    @Override
    public int getAvailabilityStatus() {
        return mContext.getResources().getBoolean(R.bool.config_show_notification_volume)
                && !Utils.isVoiceCapable(mContext) && !mHelper.isSingleVolume()
                ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
                && !mHelper.isSingleVolume() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
    }

    @Override
@@ -64,4 +63,18 @@ public class NotificationVolumePreferenceController extends
        return R.drawable.ic_notifications_off_24dp;
    }

    @Override
    protected void updatePreferenceIcon() {
        if (mPreference != null) {
            if (mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
                mMuteIcon = R.drawable.ic_volume_ringer_vibrate;
                mPreference.showIcon(R.drawable.ic_volume_ringer_vibrate);
            } else if (mRingerMode == AudioManager.RINGER_MODE_SILENT) {
                mMuteIcon = R.drawable.ic_notifications_off_24dp;
                mPreference.showIcon(R.drawable.ic_notifications_off_24dp);
            } else {
                mPreference.showIcon(R.drawable.ic_notifications);
            }
        }
    }
}
Loading