Cherish:Extended Volume panel [2/2]

Updated for androidx support
This commit is contained in:
alexxxdev
2019-09-08 11:31:06 +07:00
committed by Hung Phan
parent 58937729f4
commit eff358c880
10 changed files with 174 additions and 10 deletions

13
res/drawable/ic_alarm.xml Normal file
View File

@@ -0,0 +1,13 @@
<vector android:height="24dp" android:viewportHeight="58.153"
android:viewportWidth="58.153" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M40.076,29.153h-7.142c-0.364,-1.399 -1.459,-2.494 -2.858,-2.858V16.153c0,-0.553 -0.448,-1 -1,-1s-1,0.447 -1,1v10.142c-1.72,0.447 -3,1.999 -3,3.858c0,2.206 1.794,4 4,4c1.858,0 3.411,-1.28 3.858,-3h7.142c0.552,0 1,-0.447 1,-1S40.629,29.153 40.076,29.153zM29.076,32.153c-1.103,0 -2,-0.897 -2,-2s0.897,-2 2,-2s2,0.897 2,2S30.179,32.153 29.076,32.153z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M50.188,9.764l4.096,4.096c0.188,0.188 0.442,0.293 0.707,0.293s0.52,-0.105 0.707,-0.293c3.167,-3.166 3.167,-8.319 0,-11.485s-8.319,-3.166 -11.485,0c-0.188,0.188 -0.293,0.441 -0.293,0.707s0.105,0.52 0.293,0.707l4.561,4.561l-1.699,1.699c-4.78,-4.284 -11.089,-6.896 -17.998,-6.896s-13.218,2.612 -17.998,6.896L9.379,8.35l4.561,-4.561c0.188,-0.188 0.293,-0.441 0.293,-0.707s-0.105,-0.52 -0.293,-0.707c-3.166,-3.166 -8.318,-3.166 -11.485,0s-3.167,8.319 0,11.485c0.188,0.188 0.442,0.293 0.707,0.293s0.52,-0.105 0.707,-0.293l4.096,-4.096l1.676,1.676c-4.679,4.857 -7.565,11.453 -7.565,18.713c0,9.898 5.357,18.564 13.321,23.265l-3.028,3.028c-0.391,0.391 -0.391,1.023 0,1.414c0.195,0.195 0.451,0.293 0.707,0.293s0.512,-0.098 0.707,-0.293l3.45,-3.45c3.578,1.754 7.597,2.743 11.843,2.743s8.265,-0.989 11.843,-2.743l3.45,3.45c0.195,0.195 0.451,0.293 0.707,0.293s0.512,-0.098 0.707,-0.293c0.391,-0.391 0.391,-1.023 0,-1.414l-3.028,-3.028c7.964,-4.701 13.321,-13.367 13.321,-23.265c0,-7.26 -2.886,-13.856 -7.565,-18.713L50.188,9.764zM54.283,3.789c2.146,2.146 2.362,5.502 0.649,7.893l-8.541,-8.542C48.781,1.427 52.136,1.642 54.283,3.789zM3.22,11.681C1.507,9.291 1.723,5.935 3.869,3.789s5.502,-2.361 7.892,-0.649L3.22,11.681zM29.076,55.153c-13.785,0 -25,-11.215 -25,-25s11.215,-25 25,-25s25,11.215 25,25S42.862,55.153 29.076,55.153z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M29.076,10.032c0.552,0 1,-0.447 1,-1v-1c0,-0.553 -0.448,-1 -1,-1s-1,0.447 -1,1v1C28.076,9.584 28.524,10.032 29.076,10.032z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M29.076,50.032c-0.552,0 -1,0.447 -1,1v1c0,0.553 0.448,1 1,1s1,-0.447 1,-1v-1C30.076,50.479 29.629,50.032 29.076,50.032z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M50.076,31.032h1c0.552,0 1,-0.447 1,-1s-0.448,-1 -1,-1h-1c-0.552,0 -1,0.447 -1,1S49.524,31.032 50.076,31.032z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M8.076,29.032h-1c-0.552,0 -1,0.447 -1,1s0.448,1 1,1h1c0.552,0 1,-0.447 1,-1S8.629,29.032 8.076,29.032z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M43.926,13.768l-0.707,0.707c-0.391,0.391 -0.391,1.023 0,1.414c0.195,0.195 0.451,0.293 0.707,0.293s0.512,-0.098 0.707,-0.293l0.707,-0.707c0.391,-0.391 0.391,-1.023 0,-1.414S44.316,13.377 43.926,13.768z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M13.52,44.174l-0.707,0.707c-0.391,0.391 -0.391,1.023 0,1.414c0.195,0.195 0.451,0.293 0.707,0.293s0.512,-0.098 0.707,-0.293l0.707,-0.707c0.391,-0.391 0.391,-1.023 0,-1.414S13.911,43.784 13.52,44.174z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M44.633,44.174c-0.391,-0.391 -1.023,-0.391 -1.414,0s-0.391,1.023 0,1.414l0.707,0.707c0.195,0.195 0.451,0.293 0.707,0.293s0.512,-0.098 0.707,-0.293c0.391,-0.391 0.391,-1.023 0,-1.414L44.633,44.174z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M14.227,13.768c-0.391,-0.391 -1.023,-0.391 -1.414,0s-0.391,1.023 0,1.414l0.707,0.707c0.195,0.195 0.451,0.293 0.707,0.293s0.512,-0.098 0.707,-0.293c0.391,-0.391 0.391,-1.023 0,-1.414L14.227,13.768z"/>
</vector>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="53.972"
android:viewportWidth="53.972" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M40.533,14.387L26.146,0v24L14.853,12.707l-1.414,1.414l12.707,12.707V27L13.439,39.707l1.414,1.414l11.293,-11.293v0.144v24l14.387,-15.585l-11.52,-11.52L40.533,14.387zM28.146,4.828l9.613,9.613l-9.613,10.415V4.828zM28.146,48.856V28.828l9.613,9.613L28.146,48.856z"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:attr/colorControlNormal"
android:pathData="M13,3C11.895,3 11,3.895 11,5L11,8L11,14.541A4,4 0,0 0,9 14A4,4 0,0 0,5 18A4,4 0,0 0,9 22A4,4 0,0 0,13 18L13,8L16.5,8C17.881,8 19,6.881 19,5.5C19,4.119 17.881,3 16.5,3L13,3z"/>
</vector>

View File

@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="55"
android:viewportWidth="55" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M54.5,10c0,-5.514 -4.486,-10 -10,-10c-4.469,0 -8.261,2.948 -9.539,7H5.735C2.849,7 0.5,9.349 0.5,12.235v37.529C0.5,52.651 2.849,55 5.735,55h37.529c2.887,0 5.235,-2.349 5.235,-5.235V19.159C52.027,17.612 54.5,14.091 54.5,10zM46.5,49.765c0,1.784 -1.451,3.235 -3.235,3.235H5.735C3.951,53 2.5,51.549 2.5,49.765V12.235C2.5,10.451 3.951,9 5.735,9h28.815C34.518,9.329 34.5,9.662 34.5,10c0,5.514 4.486,10 10,10c0.685,0 1.354,-0.07 2,-0.202V49.765zM47.154,17.538c-0.198,0.07 -0.398,0.13 -0.599,0.185c-0.036,0.01 -0.073,0.019 -0.109,0.028c-0.177,0.045 -0.355,0.084 -0.534,0.117c-0.092,0.017 -0.186,0.029 -0.279,0.043c-0.134,0.02 -0.269,0.04 -0.403,0.053C44.989,17.985 44.746,18 44.5,18c-4.411,0 -8,-3.589 -8,-8c0,-0.58 0.069,-1.177 0.206,-1.777C37.517,4.665 40.7,2 44.5,2c4.411,0 8,3.589 8,8C52.5,13.48 50.262,16.44 47.154,17.538z"/>
</vector>

View File

@@ -1,10 +1,6 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FF000000"
android:pathData="M23.71 16.67C20.66 13.78 16.54 12 12 12S3.34 13.78.29 16.67c-.18.18-.29.43-.29.71 0 .28.11.53.29.71l2.48 2.48c.18.18.43.29.71.29.27 0 .52-.11.7-.28.79-.74 1.69-1.36 2.66-1.85.33-.16.56-.5.56-.9v-3.1c1.45-.48 3-.73 4.6-.73s3.15.25 4.6.72v3.1c0 .39.23.74.56.9.98.49 1.87 1.12 2.66 1.85.18.18.43.28.7.28.28 0 .53-.11.71-.29l2.48-2.48c.18-.18.29-.43.29-.71a.99.99 0 0 0-.29-.7zM21.16 6.26l-1.41-1.41-3.56 3.55 1.41 1.41s3.45-3.52 3.56-3.55zM13 2h-2v5h2V2zM6.4 9.81L7.81 8.4 4.26 4.84 2.84 6.26c.11.03 3.56 3.55 3.56 3.55z" />
</vector>
<vector android:height="24dp" android:viewportHeight="211.621"
android:viewportWidth="211.621" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M180.948,27.722C163.07,9.844 139.299,-0.001 114.017,0c-4.143,0 -7.5,3.358 -7.5,7.5c0,4.142 3.358,7.5 7.5,7.5c21.276,-0.001 41.279,8.284 56.324,23.329c15.046,15.045 23.331,35.049 23.33,56.326c0,4.142 3.357,7.5 7.5,7.5c4.142,0 7.5,-3.358 7.5,-7.499C208.672,69.371 198.827,45.6 180.948,27.722z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M150.096,94.656c0,4.142 3.358,7.5 7.501,7.499c4.142,0 7.499,-3.358 7.499,-7.5c-0.002,-28.16 -22.916,-51.073 -51.078,-51.077c-0.001,0 0,0 -0.001,0c-4.142,0 -7.499,3.357 -7.5,7.499c0,4.142 3.357,7.5 7.499,7.501C133.909,58.581 150.094,74.765 150.096,94.656z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M133.5,132.896c-11.432,-0.592 -17.256,7.91 -20.049,11.994c-2.339,3.419 -1.463,8.086 1.956,10.425c3.419,2.339 8.086,1.463 10.425,-1.956c3.3,-4.825 4.795,-5.584 6.823,-5.488c6.491,0.763 32.056,19.497 34.616,25.355c0.642,1.725 0.618,3.416 -0.071,5.473c-2.684,7.966 -7.127,13.564 -12.851,16.188c-5.438,2.493 -12.105,2.267 -19.276,-0.651c-26.777,-10.914 -50.171,-26.145 -69.531,-45.271c-0.008,-0.008 -0.016,-0.015 -0.023,-0.023c-19.086,-19.341 -34.289,-42.705 -45.185,-69.441c-2.919,-7.177 -3.145,-13.845 -0.652,-19.282c2.624,-5.724 8.222,-10.167 16.181,-12.848c2.064,-0.692 3.752,-0.714 5.461,-0.078c5.879,2.569 24.612,28.133 25.368,34.551c0.108,2.104 -0.657,3.598 -5.478,6.892c-3.42,2.336 -4.299,7.003 -1.962,10.423c2.336,3.42 7.002,4.298 10.423,1.962c4.086,-2.79 12.586,-8.598 11.996,-20.069C81.021,69.07 57.713,37.339 46.576,33.244c-4.953,-1.846 -10.163,-1.878 -15.491,-0.09C19.097,37.191 10.439,44.389 6.047,53.969c-4.26,9.294 -4.125,20.077 0.395,31.189c11.661,28.612 27.976,53.647 48.491,74.412c0.05,0.051 0.101,0.101 0.153,0.15c20.75,20.477 45.756,36.762 74.33,48.409c5.722,2.327 11.357,3.492 16.746,3.492c5.074,0 9.932,-1.032 14.438,-3.098c9.581,-4.391 16.778,-13.048 20.818,-25.044c1.784,-5.318 1.755,-10.526 -0.077,-15.456C177.232,156.856 145.501,133.548 133.5,132.896z"/>
</vector>

View File

@@ -0,0 +1,5 @@
<vector android:height="24dp" android:viewportHeight="58"
android:viewportWidth="58" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M44,28c-0.552,0 -1,0.447 -1,1v6c0,7.72 -6.28,14 -14,14s-14,-6.28 -14,-14v-6c0,-0.553 -0.448,-1 -1,-1s-1,0.447 -1,1v6c0,8.485 6.644,15.429 15,15.949V56h-5c-0.552,0 -1,0.447 -1,1s0.448,1 1,1h12c0.552,0 1,-0.447 1,-1s-0.448,-1 -1,-1h-5v-5.051c8.356,-0.52 15,-7.465 15,-15.949v-6C45,28.447 44.552,28 44,28z"/>
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M29,46c6.065,0 11,-4.935 11,-11V11c0,-6.065 -4.935,-11 -11,-11S18,4.935 18,11v24C18,41.065 22.935,46 29,46zM20,11c0,-4.963 4.038,-9 9,-9s9,4.037 9,9v24c0,4.963 -4.038,9 -9,9s-9,-4.037 -9,-9V11z"/>
</vector>

View File

@@ -513,4 +513,13 @@
<string name="theming_settings_dashboard_icons_default_accent2">Accent background</string>
<string name="theming_settings_dashboard_icons_plain">Plain</string>
<string name="theming_settings_dashboard_icons_plain_accent">Plain accent</string>
<!-- Audio Panel view -->
<string name="audio_panel_view">Volume panel</string>
<string name="audio_panel_view_media_title">Media</string>
<string name="audio_panel_view_ringer_title">Ring</string>
<string name="audio_panel_view_notification_title">Notification</string>
<string name="audio_panel_view_alarm_title">Alarm</string>
<string name="audio_panel_view_voice_title">Voice</string>
<string name="audio_panel_view_bt_sco_title">Bluetooth</string>
</resources>

57
res/xml/audio_panel.xml Normal file
View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 gzosp
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.
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="button_settings"
android:title="@string/audio_panel_view">
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="audio_panel_view_media"
android:icon="@drawable/ic_music"
android:title="@string/audio_panel_view_media_title"
android:defaultValue="true"
android:enabled="false"/>
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="audio_panel_view_ringer"
android:icon="@drawable/ic_ring"
android:title="@string/audio_panel_view_ringer_title"
android:defaultValue="false"/>
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="audio_panel_view_notification"
android:icon="@drawable/ic_notification"
android:title="@string/audio_panel_view_notification_title"
android:defaultValue="false"/>
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="audio_panel_view_alarm"
android:icon="@drawable/ic_alarm"
android:title="@string/audio_panel_view_alarm_title"
android:defaultValue="false"/>
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="audio_panel_view_voice"
android:icon="@drawable/ic_voice"
android:title="@string/audio_panel_view_voice_title"
android:defaultValue="false"/>
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="audio_panel_view_bt_sco"
android:icon="@drawable/ic_bluetooth"
android:title="@string/audio_panel_view_bt_sco_title"
android:defaultValue="false"/>
</PreferenceScreen>

View File

@@ -68,5 +68,11 @@
android:title="@string/incall_feeedback_vibrate_title"
android:defaultValue="false"
settings:controller="com.cherish.settings.fragments.IncallFeedbackPreferenceController" />
<Preference
android:key="audio_panel"
android:icon="@drawable/ic_music"
android:fragment="com.cherish.settings.fragments.AudioPanelSettings"
android:title="@string/audio_panel_view" />
</PreferenceScreen>

View File

@@ -0,0 +1,61 @@
/*
* Copyright (C) 2014-2016 The Dirty Unicorns 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.cherish.settings.fragments;
import android.content.Context;
import android.content.ContentResolver;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.SwitchPreference;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.Utils;
public class AudioPanelSettings extends SettingsPreferenceFragment implements
Preference.OnPreferenceChangeListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.audio_panel);
}
@Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
}
@Override
public void onResume() {
super.onResume();
}
public boolean onPreferenceChange(Preference preference, Object objValue) {
return true;
}
}