Cherish: Revamp UI Completely

Signed-off-by: Louis1977 <luisgonzales272@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
LouisG1977
2021-04-08 22:46:24 -06:00
committed by Hưng Phan
parent 5ad4c1e9f3
commit 40d5a07d9a
21 changed files with 684 additions and 293 deletions

View File

@@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp" android:height="30dp"
android:width="24dp" android:width="30dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path android:fillColor="#d22858" android:pathData="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z" /> <path android:fillColor="?android:attr/colorAccent" android:pathData="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z" />
</vector> </vector>

View File

@@ -1,9 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp" android:height="30dp"
android:width="24dp" android:width="30dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24" android:viewportHeight="24">
android:tint="#ff8a27">
<path android:fillColor="#ff8a27" android:pathData="M4,2A2,2 0 0,0 2,4V14H4V4H14V2H4M8,6A2,2 0 0,0 6,8V18H8V8H18V6H8M20,12V20H12V12H20M20,10H12A2,2 0 0,0 10,12V20A2,2 0 0,0 12,22H20A2,2 0 0,0 22,20V12A2,2 0 0,0 20,10M14,13V19L18,16L14,13Z" /> <path
android:fillColor="?android:attr/colorAccent"
android:pathData="M4.2,3C3.57,3 3.05,3.5 3,4.11C3,8.66 3,13.24 3,17.8C3,18.46 3.54,19 4.2,19C4.31,19 4.42,19 4.53,18.95C8.5,16.84 12.56,14.38 16.5,12.08C16.94,11.89 17.21,11.46 17.21,11C17.21,10.57 17,10.17 16.6,9.96C12.5,7.56 8.21,5.07 4.53,3.05C4.42,3 4.31,3 4.2,3M19.87,6C19.76,6 19.65,6 19.54,6.05C18.6,6.57 17.53,7.18 16.5,7.75C16.85,7.95 17.19,8.14 17.5,8.33C18.5,8.88 19.07,9.9 19.07,11V11C19.07,12.18 18.38,13.27 17.32,13.77C15.92,14.59 12.92,16.36 11.32,17.29C14.07,18.89 16.82,20.5 19.54,21.95C19.65,22 19.76,22 19.87,22C20.54,22 21.07,21.46 21.07,20.8C21.07,16.24 21.08,11.66 21.07,7.11C21,6.5 20.5,6 19.87,6Z" />
</vector> </vector>

View File

@@ -1,7 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp" android:height="30dp"
android:width="24dp" android:width="30dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path android:fillColor="#1a73e8" android:pathData="M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7Z" />
<path
android:pathData="M0,0h24v24H0V0z" />
<path
android:fillColor="?android:attr/colorAccent"
android:pathData="M13,4v2.67l-1,1l-1-1V4H13 M20,11v2h-2.67l-1-1l1-1H20 M6.67,11l1,1l-1,1H4v-2H6.67 M12,16.33l1,1V20h-2v-2.67L12,16.33 M15,2H9v5.5l3,3l3-3V2L15,2z M22,9h-5.5l-3,3l3,3H22V9L22,9z M7.5,9H2v6h5.5l3-3L7.5,9L7.5,9z M12,13.5l-3,3V22h6v-5.5L12,13.5 L12,13.5z" />
</vector> </vector>

View File

@@ -1,7 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp" android:height="30dp"
android:width="24dp" android:width="30dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path android:fillColor="#1ab8b7" android:pathData="M18,20V10H6V20H18M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10A2,2 0 0,1 6,8H15V6A3,3 0 0,0 12,3A3,3 0 0,0 9,6H7A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,17A2,2 0 0,1 10,15A2,2 0 0,1 12,13A2,2 0 0,1 14,15A2,2 0 0,1 12,17Z" />
<path
android:fillColor="?android:attr/colorAccent"
android:pathData="M12,17C10.89,17 10,16.1 10,15C10,13.89 10.89,13 12,13A2,2 0 0,1 14,15A2,2 0 0,1 12,17M18,20V10H6V20H18M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10C4,8.89 4.89,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z" />
</vector> </vector>

View File

@@ -1,19 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="30dp"
android:height="24dp" android:width="30dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24" android:viewportHeight="24">
android:tint="#7eb519">
<path <path
android:pathData="M0,0h24v24H0V0z" /> android:pathData="M0,0h24v24H0V0z" />
<path <path
android:fillColor="#7eb519" android:fillColor="?android:attr/colorAccent"
android:pathData="M7,18c-2.21,0-4-1.79-4-4s1.79-4,4-4s4,1.79,4,4S9.21,18,7,18z M7,12c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S8.1,12,7,12z" /> android:pathData="M7,18c-2.21,0-4-1.79-4-4s1.79-4,4-4s4,1.79,4,4S9.21,18,7,18z M7,12c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S8.1,12,7,12z" />
<path <path
android:fillColor="#7eb519" android:fillColor="?android:attr/colorAccent"
android:pathData="M11,10c-2.21,0-4-1.79-4-4s1.79-4,4-4s4,1.79,4,4S13.21,10,11,10z M11,4C9.9,4,9,4.9,9,6s0.9,2,2,2s2-0.9,2-2S12.1,4,11,4 z" /> android:pathData="M11,10c-2.21,0-4-1.79-4-4s1.79-4,4-4s4,1.79,4,4S13.21,10,11,10z M11,4C9.9,4,9,4.9,9,6s0.9,2,2,2s2-0.9,2-2S12.1,4,11,4 z" />
<path <path
android:fillColor="#7eb519" android:fillColor="?android:attr/colorAccent"
android:pathData="M16.6,21.6c-2.21,0-4-1.79-4-4s1.79-4,4-4s4,1.79,4,4S18.81,21.6,16.6,21.6z M16.6,15.6c-1.1,0-2,0.9-2,2s0.9,2,2,2 s2-0.9,2-2S17.7,15.6,16.6,15.6z" /> android:pathData="M16.6,21.6c-2.21,0-4-1.79-4-4s1.79-4,4-4s4,1.79,4,4S18.81,21.6,16.6,21.6z M16.6,15.6c-1.1,0-2,0.9-2,2s0.9,2,2,2 s2-0.9,2-2S17.7,15.6,16.6,15.6z" />
</vector> </vector>

View File

@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp" android:height="30dp"
android:width="24dp" android:width="30dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24" android:viewportHeight="24">
android:tint="#b81a7b">
<path android:fillColor="#b81a7b" android:pathData="M16,17H7V10.5C7,8 9,6 11.5,6C14,6 16,8 16,10.5M18,16V10.5C18,7.43 15.86,4.86 13,4.18V3.5A1.5,1.5 0 0,0 11.5,2A1.5,1.5 0 0,0 10,3.5V4.18C7.13,4.86 5,7.43 5,10.5V16L3,18V19H20V18M11.5,22A2,2 0 0,0 13.5,20H9.5A2,2 0 0,0 11.5,22Z" /> <path
android:fillColor="?android:attr/colorAccent"
android:pathData="M16,17H7V10.5C7,8 9,6 11.5,6C14,6 16,8 16,10.5M18,16V10.5C18,7.43 15.86,4.86 13,4.18V3.5A1.5,1.5 0 0,0 11.5,2A1.5,1.5 0 0,0 10,3.5V4.18C7.13,4.86 5,7.43 5,10.5V16L3,18V19H20V18M11.5,22A2,2 0 0,0 13.5,20H9.5A2,2 0 0,0 11.5,22Z" />
</vector> </vector>

View File

@@ -1,7 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp" android:height="30dp"
android:width="24dp" android:width="30dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path android:fillColor="#f9b652" android:pathData="M13,3H11V13H13V3M17.83,5.17L16.41,6.59C18.05,7.91 19,9.9 19,12A7,7 0 0,1 12,19C8.14,19 5,15.88 5,12C5,9.91 5.95,7.91 7.58,6.58L6.17,5.17C2.38,8.39 1.92,14.07 5.14,17.86C8.36,21.64 14.04,22.1 17.83,18.88C19.85,17.17 21,14.65 21,12C21,9.37 19.84,6.87 17.83,5.17Z" /> <path
android:fillColor="?android:attr/colorAccent"
android:pathData="M15,24H17V22H15M16.56,4.44L15.11,5.89C16.84,6.94 18,8.83 18,11A6,6 0 0,1 12,17A6,6 0 0,1 6,11C6,8.83 7.16,6.94 8.88,5.88L7.44,4.44C5.36,5.88 4,8.28 4,11A8,8 0 0,0 12,19A8,8 0 0,0 20,11C20,8.28 18.64,5.88 16.56,4.44M13,2H11V12H13M11,24H13V22H11M7,24H9V22H7V24Z" />
</vector> </vector>

View File

@@ -1,7 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp" android:height="30dp"
android:width="24dp" android:width="30dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path android:fillColor="#48ab52" android:pathData="M12,8A4,4 0 0,1 16,12A4,4 0 0,1 12,16A4,4 0 0,1 8,12A4,4 0 0,1 12,8M12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12A2,2 0 0,0 12,10M10,22C9.75,22 9.54,21.82 9.5,21.58L9.13,18.93C8.5,18.68 7.96,18.34 7.44,17.94L4.95,18.95C4.73,19.03 4.46,18.95 4.34,18.73L2.34,15.27C2.21,15.05 2.27,14.78 2.46,14.63L4.57,12.97L4.5,12L4.57,11L2.46,9.37C2.27,9.22 2.21,8.95 2.34,8.73L4.34,5.27C4.46,5.05 4.73,4.96 4.95,5.05L7.44,6.05C7.96,5.66 8.5,5.32 9.13,5.07L9.5,2.42C9.54,2.18 9.75,2 10,2H14C14.25,2 14.46,2.18 14.5,2.42L14.87,5.07C15.5,5.32 16.04,5.66 16.56,6.05L19.05,5.05C19.27,4.96 19.54,5.05 19.66,5.27L21.66,8.73C21.79,8.95 21.73,9.22 21.54,9.37L19.43,11L19.5,12L19.43,13L21.54,14.63C21.73,14.78 21.79,15.05 21.66,15.27L19.66,18.73C19.54,18.95 19.27,19.04 19.05,18.95L16.56,17.95C16.04,18.34 15.5,18.68 14.87,18.93L14.5,21.58C14.46,21.82 14.25,22 14,22H10M11.25,4L10.88,6.61C9.68,6.86 8.62,7.5 7.85,8.39L5.44,7.35L4.69,8.65L6.8,10.2C6.4,11.37 6.4,12.64 6.8,13.8L4.68,15.36L5.43,16.66L7.86,15.62C8.63,16.5 9.68,17.14 10.87,17.38L11.24,20H12.76L13.13,17.39C14.32,17.14 15.37,16.5 16.14,15.62L18.57,16.66L19.32,15.36L17.2,13.81C17.6,12.64 17.6,11.37 17.2,10.2L19.31,8.65L18.56,7.35L16.15,8.39C15.38,7.5 14.32,6.86 13.12,6.62L12.75,4H11.25Z" />
<path
android:pathData="M0,0h24v24H0V0z" />
<path
android:fillColor="?android:attr/colorAccent"
android:pathData="M 2 16 H 22 V 18 H 2 V 16 Z" />
<path
android:fillColor="?android:attr/colorAccent"
android:pathData="M4,14h16c1.1,0,2-0.9,2-2V4c0-1.1-0.9-2-2-2H4C2.9,2,2,2.9,2,4v8C2,13.1,2.9,14,4,14z M4,4h16v8H4V4z" />
<path
android:fillColor="?android:attr/colorAccent"
android:pathData="M 2 20 H 22 V 22 H 2 V 20 Z" />
</vector> </vector>

View File

@@ -1,7 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp" android:height="30dp"
android:width="24dp" android:width="30dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path android:fillColor="#7545ff" android:pathData="M1,21H21V1M19,5.83V19H16V8.83" />
<path
android:fillColor="?android:attr/colorAccent"
android:pathData="M4,4H20A1,1 0 0,1 21,5V9A1,1 0 0,1 20,10H4A1,1 0 0,1 3,9V5A1,1 0 0,1 4,4M9,8H10V6H9V8M5,6V8H7V6H5M8,16H11V13H13V16H16V18H13V21H11V18H8V16Z" />
</vector> </vector>

View File

@@ -1,21 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <?xml version="1.0" encoding="utf-8"?>
android:width="24dp" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp" android:height="30dp"
android:viewportWidth="512" android:width="30dp"
android:viewportHeight="512"> android:viewportWidth="24"
android:viewportHeight="24">
<path <path
android:fillColor="#e83f1a" android:fillColor="?android:attr/colorAccent"
android:pathData="M387.9,123.9c-42.3,-42.2 -100.9,-61.7 -160.5,-53.5c-73.8,10.1 -136.5,65.4 -156,137.3l-0.6,2.3c-5.3,20.3 -0.8,41.6 12.2,58.3c13.5,17.4 35.5,27.5 56.9,27.6c6.1,0.1 12.3,0.7 18.4,2.1c27.4,6.2 49.9,28.8 56.1,56.1c1.4,6.1 2.1,12.3 2,18.3c-0.1,22.1 10.2,43.4 27.6,56.9c12.1,9.4 26.6,14.3 41.4,14.3c5.7,0 11.4,-0.7 17,-2.2l2.1,-0.5c72.3,-19.7 127.5,-82.6 137.5,-156.4C449.8,224.6 430.2,166.1 387.9,123.9zM404.6,279.3c-8,59.1 -52.3,109.5 -111.8,125.7c-12.3,3.2 -21.5,-2.1 -25.9,-5.5c-8.3,-6.4 -13.1,-16.5 -13.1,-27.1c0,-8.9 -1,-17.9 -2.9,-26.8c-9.5,-41.8 -42.6,-74.9 -84.4,-84.4c-8.7,-2 -17.6,-3 -26.3,-3c-0.3,0 -0.5,0 -0.8,0c-10.5,0 -20.5,-4.9 -26.9,-13.1c-3.4,-4.4 -8.7,-13.6 -5.1,-27.4c15.7,-57.9 66,-102.3 125,-110.3c48,-6.6 95,9.1 129,42.9C395.3,184.3 411,231.3 404.6,279.3z" /> android:pathData="M7.5,2C5.71,3.15 4.5,5.18 4.5,7.5C4.5,9.82 5.71,11.85 7.53,13C4.46,13 2,10.54 2,7.5A5.5,5.5 0 0,1 7.5,2M19.07,3.5L20.5,4.93L4.93,20.5L3.5,19.07L19.07,3.5M12.89,5.93L11.41,5L9.97,6L10.39,4.3L9,3.24L10.75,3.12L11.33,1.47L12,3.1L13.73,3.13L12.38,4.26L12.89,5.93M9.59,9.54L8.43,8.81L7.31,9.59L7.65,8.27L6.56,7.44L7.92,7.35L8.37,6.06L8.88,7.33L10.24,7.36L9.19,8.23L9.59,9.54M19,13.5A5.5,5.5 0 0,1 13.5,19C12.28,19 11.15,18.6 10.24,17.93L17.93,10.24C18.6,11.15 19,12.28 19,13.5M14.6,20.08L17.37,18.93L17.13,22.28L14.6,20.08M18.93,17.38L20.08,14.61L22.28,17.15L18.93,17.38M20.08,12.42L18.94,9.64L22.28,9.88L20.08,12.42M9.63,18.93L12.4,20.08L9.87,22.27L9.63,18.93Z" />
<path
android:fillColor="#e83f1a"
android:pathData="M252.1,124.8h-14.9c-10.4,0 -18.8,8.4 -18.8,18.8s8.4,18.8 18.8,18.8h14.9c10.4,0 18.8,-8.4 18.8,-18.8S262.5,124.8 252.1,124.8z" />
<path
android:fillColor="#e83f1a"
android:pathData="M312.3,199.8h14.9c10.4,0 18.8,-8.4 18.8,-18.8s-8.4,-18.8 -18.8,-18.8h-14.9c-10.4,0 -18.8,8.4 -18.8,18.8S301.9,199.8 312.3,199.8z" />
<path
android:fillColor="#e83f1a"
android:pathData="M331,256c0,10.4 8.4,18.8 18.8,18.8h14.9c10.4,0 18.8,-8.4 18.8,-18.8c0,-10.4 -8.4,-18.8 -18.8,-18.8h-14.9C339.4,237.3 331,245.6 331,256z" />
<path
android:fillColor="#e83f1a"
android:pathData="M327.1,312.3h-14.9c-10.4,0 -18.8,8.4 -18.8,18.8c0,10.4 8.4,18.8 18.8,18.8h14.9c10.4,0 18.8,-8.4 18.8,-18.8C345.9,320.6 337.5,312.3 327.1,312.3z" />
</vector> </vector>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 crDroid Android 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="24.0dp"
android:height="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0" >
<path
android:fillColor="?android:attr/colorControlNormal"
android:pathData="M14.102040767669678,13 H0.10204076766967773 V11 H14.102040767669678 V13 z" />
</vector>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 crDroid Android 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="24.0dp"
android:height="24.0dp"
android:viewportWidth="48.0"
android:viewportHeight="48.0" >
<path
android:fillColor="?android:attr/colorControlNormal"
android:pathData="M38.0,26.0L26.0,26.0l0.0,12.0l-4.0,0.0L22.0,26.0L10.0,26.0l0.0,-4.0l12.0,0.0L22.0,10.0l4.0,0.0l0.0,12.0l12.0,0.0l0.0,4.0z" />
</vector>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2018 crDroid Android 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.0"
android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal" >
<path
android:fillColor="#FFFFFFFF"
android:pathData="M14.123456746339798,12.042328000068665 c0,-0.7430335164070133 -0.6079365134239197,-1.3509700298309326 -1.3509700298309326,-1.3509700298309326 s-1.3509700298309326,0.6079365134239197 -1.3509700298309326,1.3509700298309326 s0.6079365134239197,1.3509700298309326 1.3509700298309326,1.3509700298309326 s1.3509700298309326,-0.6079365134239197 1.3509700298309326,-1.3509700298309326 zM12.772486716508865,5.962962865829468 c-3.3571605241298674,0 -6.079365134239197,2.7222046101093293 -6.079365134239197,6.079365134239197 L4.66666653752327,12.042328000068665 l2.7019400596618652,2.7019400596618652 l2.7019400596618652,-2.7019400596618652 L8.044091612100601,12.042328000068665 c0,-2.6141270077228547 2.1142680966854095,-4.728395104408264 4.728395104408264,-4.728395104408264 s4.728395104408264,2.1142680966854095 4.728395104408264,4.728395104408264 s-2.1142680966854095,4.728395104408264 -4.728395104408264,4.728395104408264 c-1.0199823725223542,0 -1.965661393404007,-0.3309876573085789 -2.742469160556793,-0.8781305193901066 l-0.9591887211799618,0.9726984214782719 C10.097566057443618,17.648853623867033 11.380987585783004,18.12169313430786 12.772486716508865,18.12169313430786 c3.3571605241298674,0 6.079365134239197,-2.7222046101093293 6.079365134239197,-6.079365134239197 s-2.7222046101093293,-6.079365134239197 -6.079365134239197,-6.079365134239197 z" />
</vector>

View File

@@ -14,79 +14,66 @@
limitations under the License. limitations under the License.
--> -->
<LinearLayout <androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/prefCard"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="75dp"
android:minHeight="?android:attr/listPreferredItemHeightSmall" android:clickable="true"
android:gravity="center_vertical" android:focusable="true"
android:paddingStart="?android:attr/listPreferredItemPaddingStart" card_view:cardCornerRadius="12dp"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" card_view:cardElevation="4dp"
android:clickable="false" android:layout_marginTop="16dp"
android:orientation="horizontal"> android:layout_marginHorizontal="32dp"
android:foreground="?android:attr/selectableItemBackground">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:id="@+id/text_container" android:id="@+id/icon_frame"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:paddingStart="16dp"
android:minWidth="44dp" android:layout_height="match_parent"
android:gravity="center" android:gravity="center_vertical">
android:orientation="horizontal"
android:paddingEnd="12dp" <ImageView
android:paddingTop="4dp" android:id="@android:id/icon"
android:paddingBottom="4dp"> android:layout_width="44dp"
<TextView android:layout_height="44dp"
android:id="@+id/seekBarPrefValue" android:scaleType="center" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="center"
android:singleLine="true"
android:ellipsize="end"
android:textAppearance="@android:style/TextAppearance.Material.Body1"
android:textColor="?android:attr/textColorSecondary"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="vertical" android:gravity="center"
android:layout_marginTop="8dip" android:layout_centerInParent="true"
android:layout_marginBottom="8dip"> android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView <TextView
android:id="@android:id/title" android:id="@android:id/title"
android:layout_width="0dp" android:layout_width="180dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="16dp"
android:singleLine="true"
android:textAppearance="@android:style/TextAppearance.Material.Subhead"
android:textColor="?android:attr/textColorPrimary"
android:ellipsize="marquee" android:ellipsize="marquee"
android:fadingEdge="horizontal"/> android:gravity="center"
<!-- Preference should place its actual preference widget here. --> android:marqueeRepeatLimit="marquee_forever"
<LinearLayout android:singleLine="true"
android:id="@android:id/widget_frame" android:textStyle="bold"
android:layout_width="wrap_content" android:textSize="16sp"/>
android:layout_height="match_parent"
android:gravity="end|center_vertical"
android:paddingStart="16dp"
android:orientation="vertical"/>
</LinearLayout>
<FrameLayout <TextView
android:layout_width="match_parent" android:id="@android:id/summary"
android:layout_width="180dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp"> android:ellipsize="marquee"
android:gravity="center"
<LinearLayout android:id="@+id/seekBarPrefBarContainer" android:marqueeRepeatLimit="marquee_forever"
android:layout_gravity="center_vertical" android:singleLine="true"
android:layout_width="match_parent" android:textSize="12sp" />
android:layout_height="wrap_content" />
</FrameLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout>
</LinearLayout> </androidx.cardview.widget.CardView>

View File

@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014-2016 The Android Open Source 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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:gravity="center_vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:background="?android:attr/activatedBackgroundIndicator"
android:clipToPadding="false">
<LinearLayout
android:id="@android:id/icon_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="-4dp"
android:minWidth="60dp"
android:gravity="start|center_vertical"
android:orientation="horizontal"
android:paddingEnd="12dp"
android:paddingTop="4dp"
android:paddingBottom="4dp">
<com.android.internal.widget.PreferenceImageView
android:id="@android:id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="48dp"
android:maxHeight="48dp" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<TextView
android:id="@android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceListItem"
android:ellipsize="marquee" />
<TextView
android:id="@android:id/summary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@android:id/title"
android:layout_alignStart="@android:id/title"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="10"
android:ellipsize="end" />
<RelativeLayout
android:id="@+id/value_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_below="@android:id/summary"
android:layout_alignStart="@android:id/title" >
<TextView
android:id="@+id/value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:attr/textColorSecondary"
android:maxLines="1"
android:ellipsize="end" />
<ImageView
android:id="@+id/reset"
android:src="@drawable/ic_custom_seekbar_reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_toEndOf="@id/value"
android:layout_centerVertical="true" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/seekbar_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/value_frame"
android:layout_alignStart="@android:id/title" >
<ImageView
android:id="@+id/minus"
android:src="@drawable/ic_custom_seekbar_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true" />
<ImageView
android:id="@+id/plus"
android:src="@drawable/ic_custom_seekbar_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true" />
<LinearLayout
android:id="@+id/seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="3dp"
android:layout_toEndOf="@id/minus"
android:layout_toStartOf="@id/plus"
android:layout_centerVertical="true" />
</RelativeLayout>
</RelativeLayout>
<!-- Preference should place its actual preference widget here. -->
<LinearLayout android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="end|center_vertical"
android:paddingStart="16dp"
android:orientation="vertical" />
</LinearLayout>

View File

@@ -20,6 +20,8 @@
<attr name="min" format="integer" /> <attr name="min" format="integer" />
<attr name="units" format="string|reference" /> <attr name="units" format="string|reference" />
<attr name="defaultText" format="string|reference" /> <attr name="defaultText" format="string|reference" />
<attr name="showSign" format="boolean" />
<attr name="continuousUpdates" format="boolean" />
</declare-styleable> </declare-styleable>
<!-- Value to pass to callback when restore button is pressed --> <!-- Value to pass to callback when restore button is pressed -->

View File

@@ -27,6 +27,7 @@
<color name="cherish_notification_settings_background">#ffc9e6</color> <color name="cherish_notification_settings_background">#ffc9e6</color>
<color name="cherish_misc_settings_background">#dfedc6</color> <color name="cherish_misc_settings_background">#dfedc6</color>
<color name="cherish_about_settings_background">#edc6d1</color> <color name="cherish_about_settings_background">#edc6d1</color>
<color name="disabled_text_color">#66000000</color>
<!-- FOD icon picker --> <!-- FOD icon picker -->
<color name="fod_item_background_stroke_color">#d6d6d6</color> <color name="fod_item_background_stroke_color">#d6d6d6</color>

View File

@@ -1161,4 +1161,10 @@
<string name="media_category">Media Notification options</string> <string name="media_category">Media Notification options</string>
<string name="artwork_media_background_title">Artwork media background</string> <string name="artwork_media_background_title">Artwork media background</string>
<string name="artwork_media_background_summary">Set media artwork as notification media background</string> <string name="artwork_media_background_summary">Set media artwork as notification media background</string>
<!-- Custom seekbar -->
<string name="custom_seekbar_value">Value: <xliff:g id="v">%s</xliff:g></string>
<string name="custom_seekbar_default_value">Default</string>
<string name="custom_seekbar_default_value_to_set">Default value: <xliff:g id="v">%s</xliff:g>\nLong press to set</string>
<string name="custom_seekbar_default_value_is_set">Default value is set</string>
</resources> </resources>

View File

@@ -13,68 +13,69 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/cherish_settings_title" > android:title="@string/cherish_settings_title" >
<!-- Status Bar --> <!-- Status Bar -->
<Preference <com.cherish.settings.preferences.CherishPreference
android:key="statusbar_category" android:key="statusbar_category"
android:title="@string/statusbar_title" android:title="@string/statusbar_title"
android:summary="@string/statusbar_summary" android:summary="@string/statusbar_summary"
android:fragment="com.cherish.settings.fragments.StatusBarSettings" android:fragment="com.cherish.settings.fragments.StatusBarSettings"
android:icon="@drawable/ic_cherish_status_settings_background"/> android:icon="@drawable/ic_cherish_status_settings"/>
<!-- Quick Settings panel --> <!-- Quick Settings panel -->
<Preference <com.cherish.settings.preferences.CherishPreference
android:key="quicksettings_category" android:key="quicksettings_category"
android:title="@string/quicksettings_title" android:title="@string/quicksettings_title"
android:summary="@string/quicksettings_summary" android:summary="@string/quicksettings_summary"
android:fragment="com.cherish.settings.fragments.QuickSettings" android:fragment="com.cherish.settings.fragments.QuickSettings"
android:icon="@drawable/ic_cherish_quick_settings_background"/> android:icon="@drawable/ic_cherish_quick_settings"/>
<!-- Themes --> <!-- Themes -->
<Preference <com.cherish.settings.preferences.CherishPreference
android:key="theme_category" android:key="theme_category"
android:title="@string/theme_title" android:title="@string/theme_title"
android:summary="@string/theme_summary" android:summary="@string/theme_summary"
android:fragment="com.cherish.settings.fragments.ThemeSettings" android:fragment="com.cherish.settings.fragments.ThemeSettings"
android:icon="@drawable/ic_cherish_theme_settings_background"/> android:icon="@drawable/ic_cherish_theme_settings"/>
<!-- Buttons --> <!-- Buttons -->
<Preference <com.cherish.settings.preferences.CherishPreference
android:key="button_settings" android:key="button_settings"
android:title="@string/button_title" android:title="@string/button_title"
android:summary="@string/button_summary" android:summary="@string/button_summary"
android:icon="@drawable/ic_cherish_button_settings_background" android:icon="@drawable/ic_cherish_button_settings"
android:fragment="com.cherish.settings.fragments.ButtonSettings"/> android:fragment="com.cherish.settings.fragments.ButtonSettings"/>
<!-- Animations --> <!-- Animations -->
<Preference <com.cherish.settings.preferences.CherishPreference
android:key="animations_category" android:key="animations_category"
android:title="@string/animations_title" android:title="@string/animations_title"
android:summary="@string/animations_summary" android:summary="@string/animations_summary"
android:icon="@drawable/ic_cherish_animation_settings_background" android:icon="@drawable/ic_cherish_animation_settings"
android:fragment="com.cherish.settings.fragments.AnimationsSettings"/> android:fragment="com.cherish.settings.fragments.AnimationsSettings"/>
<!-- Lock Screen --> <!-- Lock Screen -->
<Preference <com.cherish.settings.preferences.CherishPreference
android:key="lockscreen_category" android:key="lockscreen_category"
android:title="@string/lockscreen_title" android:title="@string/lockscreen_title"
android:summary="@string/lockscreen_summary" android:summary="@string/lockscreen_summary"
android:fragment="com.cherish.settings.fragments.LockScreenSettings" android:fragment="com.cherish.settings.fragments.LockScreenSettings"
android:icon="@drawable/ic_cherish_lockscreen_settings_background"/> android:icon="@drawable/ic_cherish_lockscreen_settings"/>
<!-- Power Menu --> <!-- Power Menu -->
<Preference <com.cherish.settings.preferences.CherishPreference
android:key="powermenu__category" android:key="powermenu__category"
android:title="@string/powermenu_title" android:title="@string/powermenu_title"
android:summary="@string/powermenu_summary" android:summary="@string/powermenu_summary"
android:fragment="com.cherish.settings.fragments.PowerMenuSettings" android:fragment="com.cherish.settings.fragments.PowerMenuSettings"
android:icon="@drawable/ic_cherish_power_settings_background"/> android:icon="@drawable/ic_cherish_power_settings"/>
<!-- Recents --> <!-- Recents -->
<!-- <Preference <!-- <com.cherish.settings.preferences.CherishPreference
android:key="recents_category" android:key="recents_category"
android:title="@string/recents_title" android:title="@string/recents_title"
android:summary="@string/recents_summary" android:summary="@string/recents_summary"
@@ -82,28 +83,28 @@
android:icon="@drawable/ic_cherish_recent_settings_background"/> --> android:icon="@drawable/ic_cherish_recent_settings_background"/> -->
<!-- Notifications --> <!-- Notifications -->
<Preference <com.cherish.settings.preferences.CherishPreference
android:key="notifications_category" android:key="notifications_category"
android:title="@string/notifications_title" android:title="@string/notifications_title"
android:summary="@string/notifications_summary" android:summary="@string/notifications_summary"
android:fragment="com.cherish.settings.fragments.NotificationSettings" android:fragment="com.cherish.settings.fragments.NotificationSettings"
android:icon="@drawable/ic_cherish_notification_settings_background"/> android:icon="@drawable/ic_cherish_notification_settings"/>
<!-- Misc --> <!-- Misc -->
<Preference <com.cherish.settings.preferences.CherishPreference
android:key="misc_category" android:key="misc_category"
android:title="@string/misc_title" android:title="@string/misc_title"
android:summary="@string/misc_summary" android:summary="@string/misc_summary"
android:fragment="com.cherish.settings.fragments.MiscSettings" android:fragment="com.cherish.settings.fragments.MiscSettings"
android:icon="@drawable/ic_cherish_misc_settings_background"/> android:icon="@drawable/ic_cherish_misc_settings"/>
<!-- About Team --> <!-- About Team -->
<Preference <com.cherish.settings.preferences.CherishPreference
android:key="about_category" android:key="about_category"
android:title="@string/about_cherish" android:title="@string/about_cherish"
android:summary="@string/about_summary" android:summary="@string/about_summary"
android:fragment="com.cherish.settings.fragments.About" android:fragment="com.cherish.settings.fragments.About"
android:icon="@drawable/ic_cherish_about_settings_background" /> android:icon="@drawable/ic_cherish_about_settings" />
<!-- Device Part --> <!-- Device Part -->

View File

@@ -0,0 +1,75 @@
/*
* Copyright (C) 2015 The Android Open Source 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.preferences;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import androidx.annotation.VisibleForTesting;
import androidx.core.content.res.TypedArrayUtils;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.Utils;
public class CherishPreference extends Preference {
private final View.OnClickListener mClickListener = v -> performClick(v);
private boolean mAllowDividerAbove;
private boolean mAllowDividerBelow;
public CherishPreference(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Preference);
mAllowDividerAbove = TypedArrayUtils.getBoolean(a, R.styleable.Preference_allowDividerAbove,
R.styleable.Preference_allowDividerAbove, false);
mAllowDividerBelow = TypedArrayUtils.getBoolean(a, R.styleable.Preference_allowDividerBelow,
R.styleable.Preference_allowDividerBelow, false);
a.recycle();
setLayoutResource(R.layout.preference_cherish_seekbar);
}
public CherishPreference(Context context, View view) {
super(context);
}
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
holder.itemView.setOnClickListener(mClickListener);
final boolean selectable = isSelectable();
holder.itemView.setFocusable(selectable);
holder.itemView.setClickable(selectable);
holder.setDividerAllowedAbove(mAllowDividerAbove);
holder.setDividerAllowedBelow(mAllowDividerBelow);
}
}

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2016 The Dirty Unicorns Project * Copyright (C) 2016-2019 crDroid Android Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -18,55 +18,60 @@ package com.cherish.settings.preferences;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import androidx.preference.*;
import androidx.core.content.res.TypedArrayUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.view.ViewParent; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ImageView;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.preference.*; import android.widget.Toast;
import com.android.settings.R; import com.android.settings.R;
public class CustomSeekBarPreference extends Preference implements SeekBar.OnSeekBarChangeListener { public class CustomSeekBarPreference extends Preference implements SeekBar.OnSeekBarChangeListener,
private final String TAG = getClass().getName(); View.OnClickListener, View.OnLongClickListener {
protected final String TAG = getClass().getName();
private static final String SETTINGS_NS = "http://schemas.android.com/apk/res/com.android.settings"; private static final String SETTINGS_NS = "http://schemas.android.com/apk/res/com.android.settings";
private static final String ANDROIDNS = "http://schemas.android.com/apk/res/android"; protected static final String ANDROIDNS = "http://schemas.android.com/apk/res/android";
private static final int DEFAULT_VALUE = 50;
private int mMin = 0; protected int mInterval = 1;
private int mInterval = 1; protected boolean mShowSign = false;
private int mCurrentValue; protected String mUnits = "";
private int mDefaultValue = -1; protected boolean mContinuousUpdates = false;
private int mMax = 255;
private String mUnits = "";
private String mDefaultText = "";
private SeekBar mSeekBar;
private TextView mTitle;
private TextView mStatusText;
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr, protected int mMinValue = 0;
int defStyleRes) { protected int mMaxValue = 100;
protected boolean mDefaultValueExists = false;
protected int mDefaultValue;
protected int mValue;
protected TextView mValueTextView;
protected ImageView mResetImageView;
protected ImageView mMinusImageView;
protected ImageView mPlusImageView;
protected SeekBar mSeekBar;
protected boolean mTrackingTouch = false;
protected int mTrackingValue;
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes); super(context, attrs, defStyleAttr, defStyleRes);
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.CustomSeekBarPreference);
mMax = attrs.getAttributeIntValue(ANDROIDNS, "max", 255); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomSeekBarPreference);
mMin = attrs.getAttributeIntValue(SETTINGS_NS, "min", 0); try {
mDefaultValue = attrs.getAttributeIntValue(ANDROIDNS, "defaultValue", -1); mShowSign = a.getBoolean(R.styleable.CustomSeekBarPreference_showSign, mShowSign);
if (mDefaultValue > mMax) { String units = a.getString(R.styleable.CustomSeekBarPreference_units);
mDefaultValue = mMax; if (units != null)
} mUnits = " " + units;
mUnits = getAttributeStringValue(attrs, SETTINGS_NS, "units", ""); mContinuousUpdates = a.getBoolean(R.styleable.CustomSeekBarPreference_continuousUpdates, mContinuousUpdates);
mDefaultText = getAttributeStringValue(attrs, SETTINGS_NS, "defaultText", "Def"); } finally {
a.recycle();
Integer id = a.getResourceId(R.styleable.CustomSeekBarPreference_units, 0);
if (id > 0) {
mUnits = context.getResources().getString(id);
}
id = a.getResourceId(R.styleable.CustomSeekBarPreference_defaultText, 0);
if (id > 0) {
mDefaultText = context.getResources().getString(id);
} }
try { try {
@@ -76,12 +81,21 @@ public class CustomSeekBarPreference extends Preference implements SeekBar.OnSee
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Invalid interval value", e); Log.e(TAG, "Invalid interval value", e);
} }
mMinValue = attrs.getAttributeIntValue(SETTINGS_NS, "min", mMinValue);
mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", mMaxValue);
if (mMaxValue < mMinValue)
mMaxValue = mMinValue;
String defaultValue = attrs.getAttributeValue(ANDROIDNS, "defaultValue");
mDefaultValueExists = defaultValue != null && !defaultValue.isEmpty();
if (mDefaultValueExists) {
mDefaultValue = getLimitedValue(Integer.parseInt(defaultValue));
mValue = mDefaultValue;
} else {
mValue = mMinValue;
}
a.recycle();
mSeekBar = new SeekBar(context, attrs); mSeekBar = new SeekBar(context, attrs);
mSeekBar.setMax(mMax - mMin); setLayoutResource(R.layout.preference_custom_seekbar);
mSeekBar.setOnSeekBarChangeListener(this);
setLayoutResource(R.layout.preference_cherish_seekbar);
} }
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) { public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) {
@@ -89,43 +103,23 @@ public class CustomSeekBarPreference extends Preference implements SeekBar.OnSee
} }
public CustomSeekBarPreference(Context context, AttributeSet attrs) { public CustomSeekBarPreference(Context context, AttributeSet attrs) {
this(context, attrs, 0); this(context, attrs, TypedArrayUtils.getAttr(context,
androidx.preference.R.attr.preferenceStyle,
android.R.attr.preferenceStyle));
} }
public CustomSeekBarPreference(Context context) { public CustomSeekBarPreference(Context context) {
this(context, null); this(context, null);
} }
private String getAttributeStringValue(AttributeSet attrs, String namespace, String name,
String defaultValue) {
String value = attrs.getAttributeValue(namespace, name);
if (value == null)
value = defaultValue;
return value;
}
@Override @Override
public void onDependencyChanged(Preference dependency, boolean disableDependent) { public void onBindViewHolder(PreferenceViewHolder holder) {
super.onDependencyChanged(dependency, disableDependent); super.onBindViewHolder(holder);
this.setShouldDisableView(true);
if (mTitle != null)
mTitle.setEnabled(!disableDependent);
if (mSeekBar != null)
mSeekBar.setEnabled(!disableDependent);
if (mStatusText != null)
mStatusText.setEnabled(!disableDependent);
}
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
super.onBindViewHolder(view);
try try
{ {
// move our seekbar to the new view we've been given // move our seekbar to the new view we've been given
ViewParent oldContainer = mSeekBar.getParent(); ViewParent oldContainer = mSeekBar.getParent();
ViewGroup newContainer = (ViewGroup) view.findViewById(R.id.seekBarPrefBarContainer); ViewGroup newContainer = (ViewGroup) holder.findViewById(R.id.seekbar);
if (oldContainer != newContainer) { if (oldContainer != newContainer) {
// remove the seekbar from the old view // remove the seekbar from the old view
if (oldContainer != null) { if (oldContainer != null) {
@@ -139,115 +133,212 @@ public class CustomSeekBarPreference extends Preference implements SeekBar.OnSee
} catch (Exception ex) { } catch (Exception ex) {
Log.e(TAG, "Error binding view: " + ex.toString()); Log.e(TAG, "Error binding view: " + ex.toString());
} }
mStatusText = (TextView) view.findViewById(R.id.seekBarPrefValue);
if (mCurrentValue == mDefaultValue) {
mStatusText.setText(mDefaultText);
} else {
mStatusText.setText(String.valueOf(mCurrentValue) + mUnits);
}
mSeekBar.setProgress(mCurrentValue - mMin);
mTitle = (TextView) view.findViewById(android.R.id.title);
view.setDividerAllowedAbove(false);
//view.setDividerAllowedBelow(false);
mSeekBar.setMax(getSeekValue(mMaxValue));
mSeekBar.setProgress(getSeekValue(mValue));
mSeekBar.setEnabled(isEnabled()); mSeekBar.setEnabled(isEnabled());
mValueTextView = (TextView) holder.findViewById(R.id.value);
mResetImageView = (ImageView) holder.findViewById(R.id.reset);
mMinusImageView = (ImageView) holder.findViewById(R.id.minus);
mPlusImageView = (ImageView) holder.findViewById(R.id.plus);
updateValueViews();
mSeekBar.setOnSeekBarChangeListener(this);
mResetImageView.setOnClickListener(this);
mMinusImageView.setOnClickListener(this);
mPlusImageView.setOnClickListener(this);
mResetImageView.setOnLongClickListener(this);
mMinusImageView.setOnLongClickListener(this);
mPlusImageView.setOnLongClickListener(this);
} }
public void setMax(int max) { protected int getLimitedValue(int v) {
mMax = max; return v < mMinValue ? mMinValue : (v > mMaxValue ? mMaxValue : v);
mSeekBar.setMax(mMax - mMin);
} }
public void setMin(int min) { protected int getSeekValue(int v) {
mMin = min; return 0 - Math.floorDiv(mMinValue - v, mInterval);
mSeekBar.setMax(mMax - mMin);
} }
public void setIntervalValue(int value) { protected String getTextValue(int v) {
mInterval = value; return (mShowSign && v > 0 ? "+" : "") + String.valueOf(v) + mUnits;
} }
public void setValue(int value) { protected void updateValueViews() {
mCurrentValue = value; if (mValueTextView != null) {
mValueTextView.setText(getContext().getString(R.string.custom_seekbar_value,
(!mTrackingTouch || mContinuousUpdates ? getTextValue(mValue) +
(mDefaultValueExists && mValue == mDefaultValue ? " (" +
getContext().getString(R.string.custom_seekbar_default_value) + ")" : "")
: getTextValue(mTrackingValue))));
}
if (mResetImageView != null) {
if (!mDefaultValueExists || mValue == mDefaultValue || mTrackingTouch)
mResetImageView.setVisibility(View.INVISIBLE);
else
mResetImageView.setVisibility(View.VISIBLE);
}
if (mMinusImageView != null) {
if (mValue == mMinValue || mTrackingTouch) {
mMinusImageView.setClickable(false);
mMinusImageView.setColorFilter(getContext().getColor(R.color.disabled_text_color),
PorterDuff.Mode.MULTIPLY);
} else {
mMinusImageView.setClickable(true);
mMinusImageView.clearColorFilter();
}
}
if (mPlusImageView != null) {
if (mValue == mMaxValue || mTrackingTouch) {
mPlusImageView.setClickable(false);
mPlusImageView.setColorFilter(getContext().getColor(R.color.disabled_text_color), PorterDuff.Mode.MULTIPLY);
} else {
mPlusImageView.setClickable(true);
mPlusImageView.clearColorFilter();
}
}
}
protected void changeValue(int newValue) {
// for subclasses
} }
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int newValue = progress + mMin; int newValue = getLimitedValue(mMinValue + (progress * mInterval));
if (newValue > mMax) if (mTrackingTouch && !mContinuousUpdates) {
newValue = mMax; mTrackingValue = newValue;
else if (newValue < mMin) updateValueViews();
newValue = mMin; } else if (mValue != newValue) {
else if (mInterval != 1 && newValue % mInterval != 0)
newValue = Math.round(((float) newValue) / mInterval) * mInterval;
// change rejected, revert to the previous value // change rejected, revert to the previous value
if (!callChangeListener(newValue)) { if (!callChangeListener(newValue)) {
seekBar.setProgress(mCurrentValue - mMin); mSeekBar.setProgress(getSeekValue(mValue));
return; return;
} }
// change accepted, store it // change accepted, store it
mCurrentValue = newValue; changeValue(newValue);
if (mStatusText != null) {
if (newValue == mDefaultValue) {
mStatusText.setText(mDefaultText);
} else {
mStatusText.setText(String.valueOf(newValue) + mUnits);
}
}
persistInt(newValue); persistInt(newValue);
mValue = newValue;
updateValueViews();
}
} }
@Override @Override
public void onStartTrackingTouch(SeekBar seekBar) { public void onStartTrackingTouch(SeekBar seekBar) {
mTrackingValue = mValue;
mTrackingTouch = true;
} }
@Override @Override
public void onStopTrackingTouch(SeekBar seekBar) { public void onStopTrackingTouch(SeekBar seekBar) {
mTrackingTouch = false;
if (!mContinuousUpdates)
onProgressChanged(mSeekBar, getSeekValue(mTrackingValue), false);
notifyChanged(); notifyChanged();
} }
@Override @Override
protected Object onGetDefaultValue(TypedArray ta, int index) { public void onClick(View v) {
int defaultValue = ta.getInt(index, DEFAULT_VALUE); int id = v.getId();
return defaultValue; if (id == R.id.reset) {
Toast.makeText(getContext(), getContext().getString(R.string.custom_seekbar_default_value_to_set, getTextValue(mDefaultValue)),
Toast.LENGTH_LONG).show();
} else if (id == R.id.minus) {
setValue(mValue - mInterval, true);
} else if (id == R.id.plus) {
setValue(mValue + mInterval, true);
} }
}
@Override
public boolean onLongClick(View v) {
int id = v.getId();
if (id == R.id.reset) {
setValue(mDefaultValue, true);
//Toast.makeText(getContext(), getContext().getString(R.string.custom_seekbar_default_value_is_set),
// Toast.LENGTH_LONG).show();
} else if (id == R.id.minus) {
setValue(mMaxValue - mMinValue > mInterval * 2 && mMaxValue + mMinValue < mValue * 2 ? Math.floorDiv(mMaxValue + mMinValue, 2) : mMinValue, true);
} else if (id == R.id.plus) {
setValue(mMaxValue - mMinValue > mInterval * 2 && mMaxValue + mMinValue > mValue * 2 ? -1 * Math.floorDiv(-1 * (mMaxValue + mMinValue), 2) : mMaxValue, true);
}
return true;
}
// dont need too much shit about initial and default values
// its all done in constructor already
@Override @Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) { protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
if (restoreValue) { if (restoreValue)
mCurrentValue = getPersistedInt(mCurrentValue); mValue = getPersistedInt(mValue);
}
else {
int temp = 0;
try {
temp = (Integer) defaultValue;
} catch (Exception ex) {
Log.e(TAG, "Invalid default value: " + defaultValue.toString());
}
persistInt(temp);
mCurrentValue = temp;
}
}
public void setDefaultValue(int value) {
mDefaultValue = value;
if (mDefaultValue > mMax) {
mDefaultValue = mMax;
}
if (mCurrentValue == mDefaultValue && mStatusText != null) {
mStatusText.setText(mDefaultText);
}
} }
@Override @Override
public void setEnabled(boolean enabled) { public void setDefaultValue(Object defaultValue) {
if (mSeekBar != null && mStatusText != null && mTitle != null) { if (defaultValue instanceof Integer)
mSeekBar.setEnabled(enabled); setDefaultValue((Integer) defaultValue, mSeekBar != null);
mStatusText.setEnabled(enabled); else
mTitle.setEnabled(enabled); setDefaultValue(defaultValue == null ? (String) null : defaultValue.toString(), mSeekBar != null);
} }
super.setEnabled(enabled);
public void setDefaultValue(int newValue, boolean update) {
newValue = getLimitedValue(newValue);
if (!mDefaultValueExists || mDefaultValue != newValue) {
mDefaultValueExists = true;
mDefaultValue = newValue;
if (update)
updateValueViews();
}
}
public void setDefaultValue(String newValue, boolean update) {
if (mDefaultValueExists && (newValue == null || newValue.isEmpty())) {
mDefaultValueExists = false;
if (update)
updateValueViews();
} else if (newValue != null && !newValue.isEmpty()) {
setDefaultValue(Integer.parseInt(newValue), update);
}
}
public void setMax(int max) {
mMaxValue = max;
mSeekBar.setMax(mMaxValue - mMinValue);
}
public void setMin(int min) {
mMinValue = min;
mSeekBar.setMax(mMaxValue - mMinValue);
}
public void setValue(int newValue) {
mValue = getLimitedValue(newValue);
if (mSeekBar != null) mSeekBar.setProgress(getSeekValue(mValue));
}
public void setValue(int newValue, boolean update) {
newValue = getLimitedValue(newValue);
if (mValue != newValue) {
if (update)
mSeekBar.setProgress(getSeekValue(newValue));
else
mValue = newValue;
}
}
public int getValue() {
return mValue;
}
// need some methods here to set/get other attrs at runtime,
// but who really need this ...
public void refresh(int newValue) {
// this will ...
setValue(newValue, mSeekBar != null);
} }
} }