From 9258aa0c2482d791afc4a6f21b517f1a216c25e9 Mon Sep 17 00:00:00 2001 From: xyyx Date: Mon, 27 Aug 2018 10:47:48 +0000 Subject: [PATCH] Cherish: Launch Statusbar items and LS shortcut editor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hưng Phan --- res/values/cherish_strings.xml | 13 ++++ res/xml/cherish_lockscreen_shortcuts.xml | 35 +++++++++ res/xml/cherish_settings_lockscreen.xml | 13 ++++ res/xml/cherish_settings_statusbar.xml | 14 ++++ .../fragments/LockscreenShortcuts.java | 76 +++++++++++++++++++ 5 files changed, 151 insertions(+) create mode 100644 res/xml/cherish_lockscreen_shortcuts.xml create mode 100644 src/com/cherish/settings/fragments/LockscreenShortcuts.java diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index db6e477..231aea9 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -68,6 +68,19 @@ Quick settings + + Lockscreen Items + Enable Lockscreen tuner + Lockscreen shortcuts + Customize Lockscreen shortcuts + + + Lockscreen tuner + + + Statusbar Icons + Statusbar items + Status bar icons diff --git a/res/xml/cherish_lockscreen_shortcuts.xml b/res/xml/cherish_lockscreen_shortcuts.xml new file mode 100644 index 0000000..40bee62 --- /dev/null +++ b/res/xml/cherish_lockscreen_shortcuts.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + diff --git a/res/xml/cherish_settings_lockscreen.xml b/res/xml/cherish_settings_lockscreen.xml index 2371dd4..7826b67 100644 --- a/res/xml/cherish_settings_lockscreen.xml +++ b/res/xml/cherish_settings_lockscreen.xml @@ -17,5 +17,18 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/lockscreen_title" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"> + + + + + + + diff --git a/res/xml/cherish_settings_statusbar.xml b/res/xml/cherish_settings_statusbar.xml index d6bbc3c..686796b 100644 --- a/res/xml/cherish_settings_statusbar.xml +++ b/res/xml/cherish_settings_statusbar.xml @@ -14,5 +14,19 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/statusbar_title" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"> + + + + + + + + diff --git a/src/com/cherish/settings/fragments/LockscreenShortcuts.java b/src/com/cherish/settings/fragments/LockscreenShortcuts.java new file mode 100644 index 0000000..de52da6 --- /dev/null +++ b/src/com/cherish/settings/fragments/LockscreenShortcuts.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2020 The CherishOS 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.app.ActivityManagerNative; +import android.content.Context; +import android.content.ContentResolver; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.res.Resources; +import android.os.Bundle; +import android.os.UserHandle; +import android.os.RemoteException; +import android.os.ServiceManager; +import androidx.preference.Preference; +import androidx.preference.ListPreference; +import androidx.preference.PreferenceCategory; +import androidx.preference.PreferenceScreen; +import androidx.preference.Preference.OnPreferenceChangeListener; +import android.provider.Settings; +import android.util.Log; +import android.view.WindowManagerGlobal; +import android.view.IWindowManager; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import java.util.Locale; +import android.text.TextUtils; +import android.view.View; + +import com.android.settings.R; +import com.android.settings.SettingsPreferenceFragment; +import com.android.internal.logging.nano.MetricsProto.MetricsEvent; +import com.android.settings.Utils; + +public class LockscreenShortcuts extends SettingsPreferenceFragment implements OnPreferenceChangeListener { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.cherish_lockscreen_shortcuts); + + final ContentResolver resolver = getActivity().getContentResolver(); + final PreferenceScreen prefSet = getPreferenceScreen(); + + } + + @Override + public int getMetricsCategory() { + return MetricsEvent.CHERISH_SETTINGS; + } + + @Override + public void onResume() { + super.onResume(); + } + + @Override + public boolean onPreferenceChange(Preference preference, Object objValue) { + return false; + } +}