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:
adindotdev
2023-03-28 23:48:03 +07:00
committed by Hưng Phan
parent e4fb9690ab
commit 7267758e87
6 changed files with 191 additions and 1 deletions

View File

@@ -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;
}