From a40ab208797611d56fb67dccc08264c863968684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C6=B0ng=20Phan?= Date: Mon, 19 Jul 2021 17:18:20 +0700 Subject: [PATCH] Cleanup some commits: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert "[SQUASHED] Custom Carrier Label & Carrier Label Placement [1/2]" This reverts commit 69d6ea5f4ad8368c8d67b9bfc92dfac9093db456. Signed-off-by: Hưng Phan Revert "Cherish: Explain to the user why LS Blur is disabled" This reverts commit 7d79cc9d06b7741e3b3c9ca524bfeac07aafcfac. Signed-off-by: Hưng Phan Revert "Cherish: Hide LS blur option if homescreen and LS wallpaper are different" This reverts commit 8b8a6de242af3cb8a57ee6e9ef7a15cd3b61604a. Revert "Cherish: Add lockscreen background blur [2/2]" This reverts commit d979103998f03ede979eb467f93121d4d2f1e428. Signed-off-by: Hưng Phan Revert "Cherish:Notifications background opacity [2/2]" This reverts commit d05ae2705d68905c7b78a7ecafe6b652d9adb4fe. Signed-off-by: Hưng Phan --- res/values/cherish_arrays.xml | 15 -- res/values/cherish_strings.xml | 30 +-- res/xml/cherish_settings_lockscreen.xml | 9 - res/xml/cherish_settings_notifications.xml | 11 - res/xml/cherish_settings_quicksettings.xml | 7 - res/xml/cherish_settings_statusbar.xml | 7 - res/xml/custom_carrier_label.xml | 45 ----- .../fragments/CustomCarrierLabel.java | 188 ------------------ .../fragments/LockScreenSettings.java | 18 +- src/com/cherish/settings/utils/Utils.java | 20 +- 10 files changed, 5 insertions(+), 345 deletions(-) delete mode 100644 res/xml/custom_carrier_label.xml delete mode 100644 src/com/cherish/settings/fragments/CustomCarrierLabel.java diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml index 9049c33..cba1bdc 100644 --- a/res/values/cherish_arrays.xml +++ b/res/values/cherish_arrays.xml @@ -689,21 +689,6 @@ 2 - - - @string/show_carrier_disabled - @string/show_carrier_keyguard - @string/show_carrier_statusbar - @string/show_carrier_enabled - - - - 0 - 1 - 2 - 3 - - @string/brightness_slider_style_default diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index 234d8aa..a359560 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -779,23 +779,6 @@ Disable power menu on lock screen This will only disable the power menu on secure lock screens - - CarrierLabel Settings - Customize statusbar carrierlabel - Carrier Label - Customize the carrier label - Custom carrier label - Please enter a new label. Leave blank to revert to stock label. - Custom label currently not set - Carrier label - Disabled - Lockscreen only - Statusbar only - Lockscreen & statusbar - Carrier label color - Carrier label size - Carrier Label Font - Brightness slider style Default @@ -826,8 +809,6 @@ Brightness slider Show a brightness slider in the quick settings panel - Autobrightness icon - Show toggle for adaptive brightness near the slider Panel background style @@ -1038,10 +1019,7 @@ Tint the active volume bar Use a color gradient to tint the active volume bar - - - Notification background opacity - + Advanced reboot Enables access to recovery and bootloader @@ -1254,11 +1232,7 @@ Reload Proceed with caution Blocking alarms have the potential to cause instability, crashes or data loss. - - - Background blur - Lock screen Blur cannot be enabled because your current lock screen wallpaper does not match your home screen one, or your device does not support Blur at all. - + Status bar weather Configure from QS settings/Weather. diff --git a/res/xml/cherish_settings_lockscreen.xml b/res/xml/cherish_settings_lockscreen.xml index 781ae87..04dfd19 100644 --- a/res/xml/cherish_settings_lockscreen.xml +++ b/res/xml/cherish_settings_lockscreen.xml @@ -73,15 +73,6 @@ android:icon="@drawable/ic_upset" android:title="@string/always_on_display_schedule_title" android:fragment="com.cherish.settings.fragments.AODSchedule" /> - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/cherish/settings/fragments/CustomCarrierLabel.java b/src/com/cherish/settings/fragments/CustomCarrierLabel.java deleted file mode 100644 index 4cc083f..0000000 --- a/src/com/cherish/settings/fragments/CustomCarrierLabel.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2020 CherishOS - * - * 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.app.AlertDialog; -import android.content.ContentResolver; -import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnCancelListener; -import android.content.Intent; -import android.content.res.Resources; -import android.os.Bundle; -import android.os.UserHandle; -import android.provider.Settings; -import android.text.Spannable; -import android.text.TextUtils; -import android.widget.EditText; -import androidx.preference.Preference; -import androidx.preference.PreferenceScreen; -import androidx.preference.ListPreference; - -import com.android.internal.logging.nano.MetricsProto; -import com.cherish.settings.preferences.CustomSeekBarPreference; -import net.margaritov.preference.colorpicker.ColorPickerPreference; - -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; - -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settingslib.search.SearchIndexable; -import android.provider.SearchIndexableResource; - -import java.util.ArrayList; -import java.util.List; - -@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC) -public class CustomCarrierLabel extends SettingsPreferenceFragment - implements Preference.OnPreferenceChangeListener { - - public static final String TAG = "CarrierLabel"; - private static final String CUSTOM_CARRIER_LABEL = "custom_carrier_label"; - private static final String STATUS_BAR_CARRIER_COLOR = "status_bar_carrier_color"; - private static final String STATUS_BAR_CARRIER_FONT_SIZE = "status_bar_carrier_font_size"; - - static final int DEFAULT_STATUS_CARRIER_COLOR = 0xffffffff; - - private PreferenceScreen mCustomCarrierLabel; - private String mCustomCarrierLabelText; - private ColorPickerPreference mCarrierColorPicker; - private CustomSeekBarPreference mStatusBarCarrierSize; - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - addPreferencesFromResource(R.xml.custom_carrier_label); - PreferenceScreen prefSet = getPreferenceScreen(); - ContentResolver resolver = getActivity().getContentResolver(); - - int intColor; - String hexColor; - - // custom carrier label - mCustomCarrierLabel = (PreferenceScreen) findPreference(CUSTOM_CARRIER_LABEL); - updateCustomLabelTextSummary(); - - mCarrierColorPicker = (ColorPickerPreference) findPreference(STATUS_BAR_CARRIER_COLOR); - mCarrierColorPicker.setOnPreferenceChangeListener(this); - intColor = Settings.System.getInt(resolver, - Settings.System.STATUS_BAR_CARRIER_COLOR, DEFAULT_STATUS_CARRIER_COLOR); - hexColor = String.format("#%08x", (0xffffffff & intColor)); - mCarrierColorPicker.setSummary(hexColor); - mCarrierColorPicker.setNewPreviewColor(intColor); - - mStatusBarCarrierSize = (CustomSeekBarPreference) findPreference(STATUS_BAR_CARRIER_FONT_SIZE); - int StatusBarCarrierSize = Settings.System.getInt(resolver, - Settings.System.STATUS_BAR_CARRIER_FONT_SIZE, 14); - mStatusBarCarrierSize.setValue(StatusBarCarrierSize / 1); - mStatusBarCarrierSize.setOnPreferenceChangeListener(this); - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } - - @Override - public void onResume() { - super.onResume(); - } - - public boolean onPreferenceChange(Preference preference, Object newValue) { - ContentResolver resolver = getActivity().getContentResolver(); - - if (preference == mCarrierColorPicker) { - String hex = ColorPickerPreference.convertToARGB( - Integer.valueOf(String.valueOf(newValue))); - preference.setSummary(hex); - int intHex = ColorPickerPreference.convertToColorInt(hex); - Settings.System.putInt(resolver, - Settings.System.STATUS_BAR_CARRIER_COLOR, intHex); - return true; - } else if (preference == mStatusBarCarrierSize) { - int width = ((Integer)newValue).intValue(); - Settings.System.putInt(resolver, - Settings.System.STATUS_BAR_CARRIER_FONT_SIZE, width); - return true; - } - return false; - } - - public boolean onPreferenceTreeClick(Preference preference) { - ContentResolver resolver = getActivity().getContentResolver(); - boolean value; - if (preference.getKey().equals(CUSTOM_CARRIER_LABEL)) { - AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); - alert.setTitle(R.string.custom_carrier_label_title); - alert.setMessage(R.string.custom_carrier_label_explain); - // Set an EditText view to get user input - final EditText input = new EditText(getActivity()); - input.setText(TextUtils.isEmpty(mCustomCarrierLabelText) ? "" : mCustomCarrierLabelText); - input.setSelection(input.getText().length()); - alert.setView(input); - alert.setPositiveButton(getString(android.R.string.ok), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int whichButton) { - String value = ((Spannable) input.getText()).toString().trim(); - Settings.System.putString(resolver, Settings.System.CUSTOM_CARRIER_LABEL, value); - updateCustomLabelTextSummary(); - Intent i = new Intent(); - i.setAction(Intent.ACTION_CUSTOM_CARRIER_LABEL_CHANGED); - getActivity().sendBroadcast(i); - } - }); - alert.setNegativeButton(getString(android.R.string.cancel), null); - alert.show(); - return true; - } - return false; - } - - private void updateCustomLabelTextSummary() { - mCustomCarrierLabelText = Settings.System.getString( - getContentResolver(), Settings.System.CUSTOM_CARRIER_LABEL); - if (TextUtils.isEmpty(mCustomCarrierLabelText)) { - mCustomCarrierLabel.setSummary(R.string.custom_carrier_label_notset); - } else { - mCustomCarrierLabel.setSummary(mCustomCarrierLabelText); - } - } - - /** - * For Search. - */ - - public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider() { - - @Override - public List getXmlResourcesToIndex(Context context, - boolean enabled) { - ArrayList result = - new ArrayList(); - SearchIndexableResource sir = new SearchIndexableResource(context); - sir.xmlResId = R.xml.custom_carrier_label; - result.add(sir); - return result; - } - - @Override - public List getNonIndexableKeys(Context context) { - List keys = super.getNonIndexableKeys(context); - return keys; - } - }; -} diff --git a/src/com/cherish/settings/fragments/LockScreenSettings.java b/src/com/cherish/settings/fragments/LockScreenSettings.java index 4dc7208..8e75ba9 100644 --- a/src/com/cherish/settings/fragments/LockScreenSettings.java +++ b/src/com/cherish/settings/fragments/LockScreenSettings.java @@ -28,7 +28,6 @@ import android.content.res.Resources; import android.hardware.fingerprint.FingerprintManager; import android.net.Uri; import android.os.Bundle; -import android.os.ParcelFileDescriptor; import android.os.UserHandle; import androidx.preference.SwitchPreference; import androidx.preference.ListPreference; @@ -41,8 +40,6 @@ import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; import com.android.internal.util.cherish.FodUtils; import com.android.internal.util.cherish.CherishUtils; -import com.cherish.settings.preferences.SystemSettingSeekBarPreference; -import com.cherish.settings.utils.Utils; import com.cherish.settings.preferences.SystemSettingListPreference; import com.cherish.settings.preferences.CustomSeekBarPreference; import com.cherish.settings.preferences.SecureSettingListPreference; @@ -67,8 +64,6 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements private static final String AOD_SCHEDULE_KEY = "always_on_display_schedule"; private static final String FOD_ANIMATION_CATEGORY = "fod_animations"; private static final String FOD_ICON_PICKER_CATEGORY = "fod_icon_picker"; - private static final String KEY_LOCKSCREEN_BLUR = "lockscreen_blur"; - private ContentResolver mResolver; private Preference FODSettings; @@ -78,11 +73,10 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements static final int MODE_MIXED_SUNSET = 3; static final int MODE_MIXED_SUNRISE = 4; - private SystemSettingSeekBarPreference mLockscreenBlur; private CustomSeekBarPreference mClockFontSize; private CustomSeekBarPreference mDateFontSize; private CustomSeekBarPreference mOwnerInfoFontSize; - private CustomSeekBarPreference mCustomTextClockFontSize; + private CustomSeekBarPreference mCustomTextClockFontSize; private PreferenceCategory mFODIconPickerCategory; private Preference mAODPref; @@ -90,18 +84,10 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements public void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.cherish_settings_lockscreen); - Context mContext = getContext(); + ContentResolver resolver = getActivity().getContentResolver(); PreferenceScreen prefScreen = getPreferenceScreen(); Resources resources = getResources(); - WallpaperManager manager = WallpaperManager.getInstance(mContext); - - ParcelFileDescriptor pfd = manager.getWallpaperFile(WallpaperManager.FLAG_LOCK); - mLockscreenBlur = (SystemSettingSeekBarPreference) findPreference(KEY_LOCKSCREEN_BLUR); - if (!Utils.isBlurSupported() || pfd != null) { - mLockscreenBlur.setEnabled(false); - mLockscreenBlur.setSummary(getString(R.string.lockscreen_blur_disabled)); - } mFODIconPickerCategory = findPreference(FOD_ICON_PICKER_CATEGORY); if (mFODIconPickerCategory != null && !FodUtils.hasFodSupport(getContext())) { diff --git a/src/com/cherish/settings/utils/Utils.java b/src/com/cherish/settings/utils/Utils.java index 1b1aadf..f90bad1 100644 --- a/src/com/cherish/settings/utils/Utils.java +++ b/src/com/cherish/settings/utils/Utils.java @@ -19,23 +19,13 @@ package com.cherish.settings.utils; import static android.os.UserHandle.USER_SYSTEM; -import android.app.Activity; -import android.app.ActivityManager; -import android.content.ContentResolver; import android.content.Context; -import android.content.pm.ActivityInfo; import android.content.om.IOverlayManager; import android.os.AsyncTask; import android.os.RemoteException; import android.widget.Toast; -import android.os.Build; -import android.os.SystemProperties; -import android.provider.Settings; + import com.android.settings.R; -import android.text.TextUtils; -import android.view.KeyCharacterMap; -import android.view.KeyEvent; -import android.view.Surface; public class Utils { @@ -46,13 +36,5 @@ public class Utils { e.printStackTrace(); } } - - public static boolean isBlurSupported() { - boolean blurSupportedSysProp = SystemProperties - .getBoolean("ro.surface_flinger.supports_background_blur", false); - boolean blurDisabledSysProp = SystemProperties - .getBoolean("persist.sys.sf.disable_blurs", false); - return blurSupportedSysProp && !blurDisabledSysProp && ActivityManager.isHighEndGfx(); - } } \ No newline at end of file