Cherish: Smart Pixels [2/2]
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com> Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -40,6 +40,7 @@ import com.android.settingslib.search.SearchIndexable;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import com.cherish.settings.fragments.SmartCharging;
|
||||
import com.cherish.settings.fragments.SmartPixels;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -53,10 +54,12 @@ public class MiscSettings extends SettingsPreferenceFragment implements
|
||||
private static final String SYS_PHOTOS_SPOOF = "persist.sys.pixelprops.gphotos";
|
||||
|
||||
private static final String SMART_CHARGING = "smart_charging";
|
||||
private static final String SMART_PIXELS = "smart_pixels";
|
||||
|
||||
private SwitchPreference mGamesSpoof;
|
||||
private SwitchPreference mPhotosSpoof;
|
||||
private Preference mSmartCharging;
|
||||
private Preference mSmartPixels;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -81,6 +84,12 @@ public class MiscSettings extends SettingsPreferenceFragment implements
|
||||
com.android.internal.R.bool.config_smartChargingAvailable);
|
||||
if (!mSmartChargingSupported)
|
||||
prefScreen.removePreference(mSmartCharging);
|
||||
|
||||
mSmartPixels = (Preference) prefScreen.findPreference(SMART_PIXELS);
|
||||
boolean mSmartPixelsSupported = getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_supportSmartPixels);
|
||||
if (!mSmartPixelsSupported)
|
||||
prefScreen.removePreference(mSmartPixels);
|
||||
|
||||
}
|
||||
|
||||
@@ -112,8 +121,12 @@ public class MiscSettings extends SettingsPreferenceFragment implements
|
||||
|
||||
boolean mSmartChargingSupported = context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_smartChargingAvailable);
|
||||
boolean mSmartPixelsSupported = context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_supportSmartPixels);
|
||||
if (!mSmartChargingSupported)
|
||||
keys.add(SMART_CHARGING);
|
||||
if (!mSmartPixelsSupported)
|
||||
keys.add(SMART_PIXELS);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
57
src/com/cherish/settings/fragments/SmartPixels.java
Normal file
57
src/com/cherish/settings/fragments/SmartPixels.java
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.fragments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
|
||||
public class SmartPixels extends SettingsPreferenceFragment {
|
||||
|
||||
private static final String TAG = "SmartPixels";
|
||||
|
||||
private static final String SMART_PIXELS_FOOTER = "smart_pixels_footer";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.cherish_settings_smart_pixels);
|
||||
|
||||
findPreference(SMART_PIXELS_FOOTER).setTitle(R.string.smart_pixels_warning_text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user