From 75cf9404414df4d605e9c15e5d532dcee61d988f Mon Sep 17 00:00:00 2001 From: Ali B Date: Thu, 24 Feb 2022 23:58:57 +0300 Subject: [PATCH] Cherish: Add QS System Info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8575808c00a43bde146e6208e0ce9c9320721dcb Signed-off-by: Hưng Phan --- res/values/cherish_arrays.xml | 23 ++++++++++++++ res/values/cherish_strings.xml | 10 +++++++ res/xml/cherish_settings_quicksettings.xml | 13 ++++++++ .../settings/fragments/QuickSettings.java | 30 +++++++++++++++++++ 4 files changed, 76 insertions(+) diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml index 5e7ea27..8278078 100644 --- a/res/values/cherish_arrays.xml +++ b/res/values/cherish_arrays.xml @@ -650,5 +650,28 @@ 3 4 + + + + @string/qs_system_info_off + @string/qs_system_info_cpu_temp + @string/qs_system_info_battery_temp + @string/qs_system_info_gpu_clock + @string/qs_system_info_gpu_busy + + + 0 + 1 + 2 + 3 + 4 + + + + android:string/config_sysCPUTemp + android:string/config_sysBatteryTemp + android:string/config_sysGPUFreq + android:string/config_sysGPULoad + diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index 0555e5f..2a80cf4 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -827,4 +827,14 @@ Use stock aosp layout for homepage Settings UserCard Toggle in order not to show the usercard on main settings page + + QS Header + + + System Info + Off + CPU temperature + Battery temperature + GPU frequency + GPU utilization diff --git a/res/xml/cherish_settings_quicksettings.xml b/res/xml/cherish_settings_quicksettings.xml index 9ff39c9..07c8b5f 100644 --- a/res/xml/cherish_settings_quicksettings.xml +++ b/res/xml/cherish_settings_quicksettings.xml @@ -83,6 +83,19 @@ android:entryValues="@array/quick_pulldown_values" android:defaultValue="0" /> + + + + + entries = new ArrayList<>(); + List values = new ArrayList<>(); + + entries.add(entriesArray[0]); + values.add(valuesArray[0]); + int count = valuesArray.length; + for (int i = 1 ; i < count ; i++) { + int resID = res.getIdentifier(checksArray[i-1], "string", "android"); + if (DEBUG) Log.d("systemInfo", "resID= " + resID); + if (resID > 0 && !res.getString(resID).isEmpty()) { + if (DEBUG) Log.d("systemInfo", "sysPath= " + res.getString(resID)); + entries.add(entriesArray[i]); + values.add(valuesArray[i]); + } + } + mSysInfo.setEntries(entries.toArray(new String[entries.size()])); + mSysInfo.setEntryValues(values.toArray(new String[values.size()])); + if (entries.size() < 2) mSysInfo.getParent().removePreference(mSysInfo); + } + /** * For Search. */