diff --git a/AdvancedControls/Android.mk b/AdvancedControls/Android.mk
deleted file mode 100644
index fb0a8f9..0000000
--- a/AdvancedControls/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_PACKAGE_NAME := AdvancedControls
-LOCAL_CERTIFICATE := platform
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-LOCAL_AAPT_FLAGS := --auto-add-overlay
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-package_resource_overlays := $(strip \
- $(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
- $(addprefix $(dir)/, packages/apps/AdvancedControls/res))) \
- $(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \
- $(addprefix $(dir)/, packages/apps/AdvancedControls/res))))
-
-LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR)
-
-
-include $(BUILD_PACKAGE)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/AdvancedControls/AndroidManifest.xml b/AdvancedControls/AndroidManifest.xml
deleted file mode 100644
index 859d5cd..0000000
--- a/AdvancedControls/AndroidManifest.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AdvancedControls/res/drawable/launcher.png b/AdvancedControls/res/drawable/launcher.png
deleted file mode 100644
index e31c0a2..0000000
Binary files a/AdvancedControls/res/drawable/launcher.png and /dev/null differ
diff --git a/AdvancedControls/res/layout/preference_dialog_kcal.xml b/AdvancedControls/res/layout/preference_dialog_kcal.xml
deleted file mode 100644
index 679d770..0000000
--- a/AdvancedControls/res/layout/preference_dialog_kcal.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AdvancedControls/res/layout/preference_dialog_torch_brightness.xml b/AdvancedControls/res/layout/preference_dialog_torch_brightness.xml
deleted file mode 100644
index cd6ca17..0000000
--- a/AdvancedControls/res/layout/preference_dialog_torch_brightness.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AdvancedControls/res/layout/preference_dialog_vibrator_strength.xml b/AdvancedControls/res/layout/preference_dialog_vibrator_strength.xml
deleted file mode 100644
index cb75e4c..0000000
--- a/AdvancedControls/res/layout/preference_dialog_vibrator_strength.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AdvancedControls/res/values-ru/strings.xml b/AdvancedControls/res/values-ru/strings.xml
deleted file mode 100644
index 7e47e22..0000000
--- a/AdvancedControls/res/values-ru/strings.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
- Xiaomi
- Настройки устройства
- Вибрация
- Сила
- Установить силу вибрации
- Фонарик
- Максимальная яркость желтого светодиода
- Установить максимальную яркость желтого светодиода
- Максимальная яркость белого светодиода
- Установить максимальную яркость белого светодиода
- Цвет экрана
- Красный
- Синий
- Зеленый
- Точная настройка
- Минимальные RGB значения
- Насыщенность
- Оттенок
- Значение
- Контраст
- По умолчанию
- Восстановление настроек после загрузки
- Kcal профили
- Использовать профили Kcal
- Выбрать Kcal профиль
-
diff --git a/AdvancedControls/res/values-uk/strings.xml b/AdvancedControls/res/values-uk/strings.xml
deleted file mode 100644
index 4d6bee2..0000000
--- a/AdvancedControls/res/values-uk/strings.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
- Xiaomi
- Налаштування пристрою
- Вібрація
- Сила
- Встановити силу вібрації
- Ліхтарик
- Максимальна яскравість жовтого світлодіода
- Встановити максимальну яскравість жовтого світлодіода
- Максимальна яскравість білого світлодіода
- Встановити максимальну яскравість білого світлодіода
-
diff --git a/AdvancedControls/res/values/arrays.xml b/AdvancedControls/res/values/arrays.xml
deleted file mode 100644
index b628dd8..0000000
--- a/AdvancedControls/res/values/arrays.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
- - Default
- - Version 1
- - Version 2
- - Version 3
- - Triluminous
- - Deep Black and White
- - Deep Natural
- - Cool Amoled
- - Extreme Amoled
- - Warm Amoled
- - Hybrid Mamba
-
-
- - 0
- - 1
- - 2
- - 3
- - 4
- - 5
- - 6
- - 7
- - 8
- - 9
- - 10
-
-
-
diff --git a/AdvancedControls/res/values/strings.xml b/AdvancedControls/res/values/strings.xml
deleted file mode 100644
index 51eb0bd..0000000
--- a/AdvancedControls/res/values/strings.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
- AdvancedControls
- AdvancedControls
- Vibrator
- Strength
- Define the strength of the vibrator
- Torch
- Yellow led maximum brightness
- Define the maximum brightness of the yellow led
- White led maximum brightness
- Define the maximum brightness of the white led
- Screen Color
- Red
- Blue
- Green
- Fine Tuning
- Minimum RGB Value
- Saturation Intensity
- Screen Hue
- Screen Value
- Screen Contrast
- +1
- -1
- Default
- Restore settings after boot
- Kcal Presets
- Use kcal preset values
- Choose kcal preset
-
diff --git a/AdvancedControls/res/xml/main.xml b/AdvancedControls/res/xml/main.xml
deleted file mode 100644
index c80cdb3..0000000
--- a/AdvancedControls/res/xml/main.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/AdvancedControls/src/com/thht/settings/device/DeviceSettings.java b/AdvancedControls/src/com/thht/settings/device/DeviceSettings.java
deleted file mode 100644
index ac5f277..0000000
--- a/AdvancedControls/src/com/thht/settings/device/DeviceSettings.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
-* Copyright (C) 2016 The OmniROM Project
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-*/
-package com.thht.settings.device;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.res.Resources;
-import android.content.Intent;
-import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceScreen;
-import android.preference.PreferenceManager;
-import android.preference.SwitchPreference;
-import android.preference.ListPreference;
-import android.content.SharedPreferences;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ListView;
-import android.util.Log;
-import android.graphics.drawable.ColorDrawable;
-import android.graphics.Color;
-
-public class DeviceSettings extends PreferenceActivity implements
- Preference.OnPreferenceChangeListener {
-
- private static final String TAG = "thhtKCAL";
-
- public static final String KEY_VIBSTRENGTH = "vib_strength";
- public static final String KEY_YELLOW_TORCH_BRIGHTNESS = "yellow_torch_brightness";
- public static final String KEY_WHITE_TORCH_BRIGHTNESS = "white_torch_brightness";
- public static final String KEY_KCAL_RGB_RED = "kcal_rgb_red";
- public static final String KEY_KCAL_RGB_BLUE = "kcal_rgb_blue";
- public static final String KEY_KCAL_RGB_GREEN = "kcal_rgb_green";
- public static final String KEY_KCAL_RGB_MIN = "kcal_rgb_min";
- public static final String KEY_KCAL_SAT_INTENSITY = "kcal_sat_intensity";
- public static final String KEY_KCAL_SCR_CONTR = "key_kcal_scr_contr";
- public static final String KEY_KCAL_SCR_VAL = "key_kcal_scr_val";
- public static final String KEY_KCAL_SCR_HUE = "key_kcal_scr_hue";
- public static final String KEY_RESTORE_ON_BOOT = "restore_on_boot";
- public static final String KEY_KCAL_PRESETS = "kcal_presets";
- public static final String KEY_KCAL_PRESETS_LIST = "presets_list";
- public static final String KEY_SCREEN_COLOR = "key_screen_color";
- public static final String KEY_KCAL_EXTRAS = "key_kcal_extras";
-
-
- private VibratorStrengthPreference mVibratorStrength;
- private YellowTorchBrightnessPreference mYellowTorchBrightness;
- private WhiteTorchBrightnessPreference mWhiteTorchBrightness;
- private SwitchPreference restoreOnBootPreference;
- private SwitchPreference kcalPresetsPreference;
- private ListPreference kcalPresetsListPreference;
- private PreferenceCategory screenColorCategory;
- private PreferenceCategory kcalExtrasCategory;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- getActionBar().setDisplayHomeAsUpEnabled(true);
-
- addPreferencesFromResource(R.xml.main);
-
- getListView().setDivider(new ColorDrawable(Color.TRANSPARENT));
- getListView().setDividerHeight(0);
-
- mVibratorStrength = (VibratorStrengthPreference) findPreference(KEY_VIBSTRENGTH);
- if (mVibratorStrength != null) {
- mVibratorStrength.setEnabled(VibratorStrengthPreference.isSupported());
- }
-
- mYellowTorchBrightness = (YellowTorchBrightnessPreference) findPreference(KEY_YELLOW_TORCH_BRIGHTNESS);
- if (mYellowTorchBrightness != null) {
- mYellowTorchBrightness.setEnabled(YellowTorchBrightnessPreference.isSupported());
- }
-
- mWhiteTorchBrightness = (WhiteTorchBrightnessPreference) findPreference(KEY_WHITE_TORCH_BRIGHTNESS);
- if (mWhiteTorchBrightness != null) {
- mWhiteTorchBrightness.setEnabled(WhiteTorchBrightnessPreference.isSupported());
- }
-
- restoreOnBootPreference = (SwitchPreference) findPreference(KEY_RESTORE_ON_BOOT);
- Boolean shouldRestore = PreferenceManager.getDefaultSharedPreferences(this).getBoolean(DeviceSettings.KEY_RESTORE_ON_BOOT, false);
- restoreOnBootPreference.setChecked(shouldRestore);
- restoreOnBootPreference.setOnPreferenceChangeListener(this);
-
- kcalPresetsListPreference = (ListPreference) findPreference(KEY_KCAL_PRESETS_LIST);
- screenColorCategory = (PreferenceCategory) findPreference(KEY_SCREEN_COLOR);
- kcalExtrasCategory = (PreferenceCategory)findPreference(KEY_KCAL_EXTRAS);
-
- kcalPresetsPreference = (SwitchPreference) findPreference(KEY_KCAL_PRESETS);
- Boolean shouldRestorePreset = PreferenceManager.getDefaultSharedPreferences(this).getBoolean(DeviceSettings.KEY_KCAL_PRESETS, false);
- kcalPresetsPreference.setChecked(shouldRestorePreset);
- setKcalPresetsDependents(shouldRestorePreset);
- kcalPresetsPreference.setOnPreferenceChangeListener(this);
-
- String kcalPresetsValue = shouldRestore && shouldRestorePreset ? PreferenceManager.getDefaultSharedPreferences(this).getString(DeviceSettings.KEY_KCAL_PRESETS_LIST, "0") : "0" ;
- kcalPresetsListPreference.setValue(kcalPresetsValue);
- kcalPresetsPreference.setOnPreferenceChangeListener(this);
-
- kcalPresetsListPreference.setOnPreferenceChangeListener(this);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- finish();
- return true;
- default:
- break;
- }
- return super.onOptionsItemSelected(item);
- }
-
- @Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- return super.onPreferenceTreeClick(preferenceScreen, preference);
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
-
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
-
- if (preference == restoreOnBootPreference ||
- preference == kcalPresetsPreference) {
- boolean value = (Boolean) newValue;
- if (preference == restoreOnBootPreference)
- editor.putBoolean(DeviceSettings.KEY_RESTORE_ON_BOOT, value);
- else if (preference == kcalPresetsPreference) {
- editor.putBoolean(DeviceSettings.KEY_KCAL_PRESETS, value);
- setKcalPresetsDependents(value);
- }
- editor.commit();
- }
-
- else if (preference == kcalPresetsListPreference) {
- String currValue = (String) newValue;
- editor.putString(DeviceSettings.KEY_KCAL_PRESETS_LIST, currValue);
- KcalPresets.setValue(currValue);
- editor.commit();
- }
-
- return true;
- }
-
- private void setKcalPresetsDependents(boolean value) {
- kcalPresetsListPreference.setEnabled(value);
- screenColorCategory.setEnabled(!value);
- kcalExtrasCategory.setEnabled(!value);
- }
-}
diff --git a/AdvancedControls/src/com/thht/settings/device/KcalPresets.java b/AdvancedControls/src/com/thht/settings/device/KcalPresets.java
deleted file mode 100644
index c7d53d7..0000000
--- a/AdvancedControls/src/com/thht/settings/device/KcalPresets.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.thht.settings.device;
-
-public class KcalPresets {
-
- public static final String[] rgb = {"237 237 237", "225 245 255", "250 250 235", "240 240 240", "255 250 251", "250 250 255", "250 250 255", "236 248 255", "255 255 255", "253 246 243", "226 215 255"};
- public static final String[] minRgb = {"35", "35", "35", "35", "35", "35", "35", "35", "35", "35", "35"};
- public static final String[] satIntensity = {"33", "40", "27", "33", "66", "60", "33", "50", "65", "50", "40"};
- public static final String[] scrHue = {"0", "0", "1520", "0", "1526", "0", "0", "0", "0", "0", "10"};
- public static final String[] scrValue = {"127", "127", "112", "127", "136", "117", "117", "123", "114", "123", "119"};
- public static final String[] scrContrast = {"127", "127", "132", "127", "132", "136", "136", "130", "136", "130", "132"};
-
- enum Presets {
- DEFAULT, VERSION1, VERSION2, VERSION3, TRILUMINOUS, DEEPBW, DEEPND, COOLAMOLED, EXTREMEAMOLED, WARMAMOLED, HYBRIDMAMBA;
- public static Presets toEnum(int index) {
- switch (index) {
- case 0:
- return DEFAULT;
- case 1:
- return VERSION1;
- case 2:
- return VERSION2;
- case 3:
- return VERSION3;
- case 4:
- return TRILUMINOUS;
- case 5:
- return DEEPBW;
- case 6:
- return DEEPND;
- case 7:
- return COOLAMOLED;
- case 8:
- return EXTREMEAMOLED;
- case 9:
- return WARMAMOLED;
- case 10:
- return HYBRIDMAMBA;
- }
- return null;
- }
- }
-
- public static void setValue(String value) {
- int index = Integer.parseInt(value);
- KcalRGBRedPreference.setValue(rgb[index]);
- KcalRGBMinPreference.setValue(minRgb[index]);
- KcalSatIntensityPreference.setValue(satIntensity[index]);
- KcalScreenHuePreference.setValue(scrHue[index]);
- KcalScreenValuePreference.setValue(scrValue[index]);
- KcalScreenContrPreference.setValue(scrContrast[index]);
- }
-}
-
diff --git a/AdvancedControls/src/com/thht/settings/device/KcalRGBBluePreference.java b/AdvancedControls/src/com/thht/settings/device/KcalRGBBluePreference.java
deleted file mode 100644
index 5f34d5f..0000000
--- a/AdvancedControls/src/com/thht/settings/device/KcalRGBBluePreference.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.util.List;
-
-public class KcalRGBBluePreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldStrength;
- private int mMinValue;
- private int mMaxValue;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final String FILE_LEVEL = "/sys/devices/platform/kcal_ctrl.0/kcal";
- private static final String DEFAULT_VALUE = "237 237 237";
-
- public KcalRGBBluePreference(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- mMinValue = 0;
- mMaxValue = 255;
-
- setDialogLayoutResource(R.layout.preference_dialog_kcal);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- String value = getValue(getContext());
- String[] rgb = getIndividualRGB(value);
- mOldStrength = Integer.parseInt(rgb[2]);
- mSeekBar = (SeekBar) view.findViewById(R.id.kcalSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldStrength - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(String.valueOf(rgb[2]));
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_LEVEL);
- }
-
- public static String getValue(Context context) {
- return Utils.getFileValue(FILE_LEVEL, DEFAULT_VALUE);
- }
-
- public static void setValue(String newValue) {
- Utils.writeValue(FILE_LEVEL, newValue);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_RGB_BLUE, DEFAULT_VALUE);
- Utils.writeValue(FILE_LEVEL, storedValue);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- String value = String.valueOf(progress + mMinValue);
- String[] rgb = getIndividualRGB(getValue(getContext()));
- rgb[2] = value;
- String finalValue = combineIndividualRGB(rgb);
- setValue(finalValue);
- mValueText.setText(value);
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- String value = String.valueOf(mSeekBar.getProgress() + mMinValue);
- String[] rgb = getIndividualRGB(getValue(getContext()));
- rgb[2] = value;
- String finalValue = combineIndividualRGB(rgb);
- setValue(finalValue);
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_KCAL_RGB_BLUE, finalValue);
- editor.commit();
- } else {
- restoreOldState();
- }
- }
-
- private void restoreOldState() {
- String[] rgb = getIndividualRGB(getValue(getContext()));
- rgb[2] = String.valueOf(mOldStrength);
- setValue(combineIndividualRGB(rgb));
- }
-
- private String[] getIndividualRGB(String rgb) {
- return rgb.split(" ", 3);
- }
-
- private String combineIndividualRGB(String[] rgb) {
- return String.join(" ", rgb);
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + 1);
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - 1);
- }
- }
-
- private void restoreDefault() {
- String[] rgb = getIndividualRGB(DEFAULT_VALUE);
- int defaultValue = Integer.parseInt(rgb[2]);
- mSeekBar.setProgress(defaultValue);
- }
-}
\ No newline at end of file
diff --git a/AdvancedControls/src/com/thht/settings/device/KcalRGBGreenPreference.java b/AdvancedControls/src/com/thht/settings/device/KcalRGBGreenPreference.java
deleted file mode 100644
index 91ea237..0000000
--- a/AdvancedControls/src/com/thht/settings/device/KcalRGBGreenPreference.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.util.List;
-
-public class KcalRGBGreenPreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldStrength;
- private int mMinValue;
- private int mMaxValue;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final String FILE_LEVEL = "/sys/devices/platform/kcal_ctrl.0/kcal";
- private static final String DEFAULT_VALUE = "237 237 237";
-
- public KcalRGBGreenPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- mMinValue = 0;
- mMaxValue = 255;
-
- setDialogLayoutResource(R.layout.preference_dialog_kcal);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- String value = getValue(getContext());
- String[] rgb = getIndividualRGB(value);
- mOldStrength = Integer.parseInt(rgb[1]);
- mSeekBar = (SeekBar) view.findViewById(R.id.kcalSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldStrength - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(String.valueOf(rgb[1]));
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_LEVEL);
- }
-
- public static String getValue(Context context) {
- return Utils.getFileValue(FILE_LEVEL, DEFAULT_VALUE);
- }
-
- public static void setValue(String newValue) {
- Utils.writeValue(FILE_LEVEL, newValue);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_RGB_GREEN, DEFAULT_VALUE);
- Utils.writeValue(FILE_LEVEL, storedValue);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- String value = String.valueOf(progress + mMinValue);
- String[] rgb = getIndividualRGB(getValue(getContext()));
- rgb[1] = value;
- String finalValue = combineIndividualRGB(rgb);
- setValue(finalValue);
- mValueText.setText(value);
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- String value = String.valueOf(mSeekBar.getProgress() + mMinValue);
- String[] rgb = getIndividualRGB(getValue(getContext()));
- rgb[1] = value;
- String finalValue = combineIndividualRGB(rgb);
- setValue(finalValue);
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_KCAL_RGB_GREEN, finalValue);
- editor.commit();
- } else {
- restoreOldState();
- }
- }
-
- private void restoreOldState() {
- String[] rgb = getIndividualRGB(getValue(getContext()));
- rgb[1] = String.valueOf(mOldStrength);
- setValue(combineIndividualRGB(rgb));
- }
-
- private String[] getIndividualRGB(String rgb) {
- return rgb.split(" ", 3);
- }
-
- private String combineIndividualRGB(String[] rgb) {
- return String.join(" ", rgb);
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + 1);
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - 1);
- }
- }
-
- private void restoreDefault() {
- String[] rgb = getIndividualRGB(DEFAULT_VALUE);
- int defaultValue = Integer.parseInt(rgb[1]);
- mSeekBar.setProgress(defaultValue);
- }
-}
-
diff --git a/AdvancedControls/src/com/thht/settings/device/KcalRGBMinPreference.java b/AdvancedControls/src/com/thht/settings/device/KcalRGBMinPreference.java
deleted file mode 100644
index 802cafe..0000000
--- a/AdvancedControls/src/com/thht/settings/device/KcalRGBMinPreference.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.util.List;
-
-public class KcalRGBMinPreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldStrength;
- private int mMinValue;
- private int mMaxValue;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final String FILE_LEVEL = "/sys/devices/platform/kcal_ctrl.0/kcal_min";
- private static final String DEFAULT_VALUE = "35";
-
- public KcalRGBMinPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- mMinValue = 0;
- mMaxValue = 255;
- setDialogLayoutResource(R.layout.preference_dialog_kcal);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- mOldStrength = Integer.parseInt(getValue(getContext()));
- mSeekBar = (SeekBar) view.findViewById(R.id.kcalSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldStrength - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(String.valueOf(mOldStrength));
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_LEVEL);
- }
-
- public static String getValue(Context context) {
- return Utils.getFileValue(FILE_LEVEL, DEFAULT_VALUE);
- }
-
- public static void setValue(String newValue) {
- Utils.writeValue(FILE_LEVEL, newValue);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_RGB_MIN, DEFAULT_VALUE);
- Utils.writeValue(FILE_LEVEL, storedValue);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- String value = String.valueOf(progress + mMinValue);
- setValue(value);
- mValueText.setText(value);
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- final int value = mSeekBar.getProgress() + mMinValue;
- setValue(String.valueOf(value));
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_KCAL_RGB_MIN, String.valueOf(value));
- editor.commit();
- } else {
- restoreOldState();
- }
- }
-
- private void restoreOldState() {
- setValue(String.valueOf(mOldStrength));
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + 1);
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - 1);
- }
- }
-
- private void restoreDefault() {
- int defaultValue = Integer.parseInt(DEFAULT_VALUE);
- mSeekBar.setProgress(defaultValue);
- }
-}
-
diff --git a/AdvancedControls/src/com/thht/settings/device/KcalRGBRedPreference.java b/AdvancedControls/src/com/thht/settings/device/KcalRGBRedPreference.java
deleted file mode 100644
index c71984d..0000000
--- a/AdvancedControls/src/com/thht/settings/device/KcalRGBRedPreference.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.util.List;
-
-public class KcalRGBRedPreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldStrength;
- private int mMinValue;
- private int mMaxValue;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final String FILE_LEVEL = "/sys/devices/platform/kcal_ctrl.0/kcal";
- private static final String DEFAULT_VALUE = "237 237 237";
-
- public KcalRGBRedPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- mMinValue = 0;
- mMaxValue = 255;
-
- setDialogLayoutResource(R.layout.preference_dialog_kcal);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- String value = getValue(getContext());
- String[] rgb = getIndividualRGB(value);
- mOldStrength = Integer.parseInt(rgb[0]);
- mSeekBar = (SeekBar) view.findViewById(R.id.kcalSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldStrength - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(String.valueOf(rgb[0]));
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_LEVEL);
- }
-
- public static String getValue(Context context) {
- return Utils.getFileValue(FILE_LEVEL, DEFAULT_VALUE);
- }
-
- public static void setValue(String newValue) {
- Utils.writeValue(FILE_LEVEL, newValue);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_RGB_RED, DEFAULT_VALUE);
- Utils.writeValue(FILE_LEVEL, storedValue);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- String value = String.valueOf(progress + mMinValue);
- String[] rgb = getIndividualRGB(getValue(getContext()));
- rgb[0] = value;
- String finalValue = combineIndividualRGB(rgb);
- setValue(finalValue);
- mValueText.setText(value);
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- String value = String.valueOf(mSeekBar.getProgress() + mMinValue);
- String[] rgb = getIndividualRGB(getValue(getContext()));
- rgb[0] = value;
- String finalValue = combineIndividualRGB(rgb);
- setValue(finalValue);
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_KCAL_RGB_RED, finalValue);
- editor.commit();
- } else {
- restoreOldState();
- }
- }
-
- private void restoreOldState() {
- String[] rgb = getIndividualRGB(getValue(getContext()));
- rgb[0] = String.valueOf(mOldStrength);
- setValue(combineIndividualRGB(rgb));
- }
-
- private String[] getIndividualRGB(String rgb) {
- return rgb.split(" ", 3);
- }
-
- private String combineIndividualRGB(String[] rgb) {
- return String.join(" ", rgb);
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + 1);
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - 1);
- }
- }
-
- private void restoreDefault() {
- String[] rgb = getIndividualRGB(DEFAULT_VALUE);
- int defaultValue = Integer.parseInt(rgb[0]);
- mSeekBar.setProgress(defaultValue);
- }
-}
-
diff --git a/AdvancedControls/src/com/thht/settings/device/KcalSatIntensityPreference.java b/AdvancedControls/src/com/thht/settings/device/KcalSatIntensityPreference.java
deleted file mode 100644
index d913763..0000000
--- a/AdvancedControls/src/com/thht/settings/device/KcalSatIntensityPreference.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.util.List;
-
-public class KcalSatIntensityPreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldStrength;
- private int mMinValue;
- private int mMaxValue;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final int OFFSET = 225;
- private static final String FILE_LEVEL = "/sys/devices/platform/kcal_ctrl.0/kcal_sat";
- private static final String DEFAULT_VALUE = "33";
-
- public KcalSatIntensityPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- mMinValue = 0;
- mMaxValue = 158;
- setDialogLayoutResource(R.layout.preference_dialog_kcal);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- mOldStrength = Integer.parseInt(getValue(getContext()));
- mSeekBar = (SeekBar) view.findViewById(R.id.kcalSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldStrength - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(String.valueOf(mOldStrength));
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_LEVEL);
- }
-
- public static String getValue(Context context) {
- int value = Integer.parseInt(Utils.getFileValue(FILE_LEVEL, DEFAULT_VALUE));
- return String.valueOf(translate(value, true));
- }
-
- public static void setValue(String newValue) {
- String value = String.valueOf(translate(Integer.parseInt(newValue), false));
- Utils.writeValue(FILE_LEVEL, value);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_RGB_MIN, DEFAULT_VALUE);
- String value = String.valueOf(translate(Integer.parseInt(storedValue), false));
- Utils.writeValue(FILE_LEVEL, value);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- String value = String.valueOf(progress + mMinValue);
- setValue(value);
- mValueText.setText(value);
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- final int value = mSeekBar.getProgress() + mMinValue;
- setValue(String.valueOf(value));
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_KCAL_RGB_MIN, String.valueOf(value));
- editor.commit();
- } else {
- restoreOldState();
- }
- }
-
- private void restoreOldState() {
- setValue(String.valueOf(mOldStrength));
- }
-
- private static int translate(int value, boolean read) {
- if (!read)
- return value + OFFSET;
- else
- return value - OFFSET;
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + 1);
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - 1);
- }
- }
-
- private void restoreDefault() {
- int defaultValue = Integer.parseInt(DEFAULT_VALUE);
- mSeekBar.setProgress(defaultValue);
- }
-}
-
diff --git a/AdvancedControls/src/com/thht/settings/device/KcalScreenContrPreference.java b/AdvancedControls/src/com/thht/settings/device/KcalScreenContrPreference.java
deleted file mode 100644
index 8f10fd3..0000000
--- a/AdvancedControls/src/com/thht/settings/device/KcalScreenContrPreference.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.util.List;
-
-public class KcalScreenContrPreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldStrength;
- private int mMinValue;
- private int mMaxValue;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final int OFFSET = 128;
- private static final String FILE_LEVEL = "/sys/devices/platform/kcal_ctrl.0/kcal_cont";
- private static final String DEFAULT_VALUE = "127";
-
- public KcalScreenContrPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- mMinValue = 0;
- mMaxValue = 255;
- setDialogLayoutResource(R.layout.preference_dialog_kcal);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- mOldStrength = Integer.parseInt(getValue(getContext()));
- mSeekBar = (SeekBar) view.findViewById(R.id.kcalSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldStrength - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(String.valueOf(mOldStrength));
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_LEVEL);
- }
-
- public static String getValue(Context context) {
- int value = Integer.parseInt(Utils.getFileValue(FILE_LEVEL, DEFAULT_VALUE));
- return String.valueOf(translate(value, true));
- }
-
- public static void setValue(String newValue) {
- String value = String.valueOf(translate(Integer.parseInt(newValue), false));
- Utils.writeValue(FILE_LEVEL, value);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_SCR_CONTR, DEFAULT_VALUE);
- String value = String.valueOf(translate(Integer.parseInt(storedValue), false));
- Utils.writeValue(FILE_LEVEL, value);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- String value = String.valueOf(progress + mMinValue);
- setValue(value);
- mValueText.setText(value);
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- final int value = mSeekBar.getProgress() + mMinValue;
- setValue(String.valueOf(value));
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_KCAL_SCR_CONTR, String.valueOf(value));
- editor.commit();
- } else {
- restoreOldState();
- }
- }
-
- private void restoreOldState() {
- setValue(String.valueOf(mOldStrength));
- }
-
- private static int translate(int value, boolean read) {
- if (!read)
- return value + OFFSET;
- else
- return value - OFFSET;
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + 1);
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - 1);
- }
- }
-
- private void restoreDefault() {
- int defaultValue = Integer.parseInt(DEFAULT_VALUE);
- mSeekBar.setProgress(defaultValue);
- }
-}
-
diff --git a/AdvancedControls/src/com/thht/settings/device/KcalScreenHuePreference.java b/AdvancedControls/src/com/thht/settings/device/KcalScreenHuePreference.java
deleted file mode 100644
index 21ed472..0000000
--- a/AdvancedControls/src/com/thht/settings/device/KcalScreenHuePreference.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.util.List;
-
-public class KcalScreenHuePreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldStrength;
- private int mMinValue;
- private int mMaxValue;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final int OFFSET = 0;
- private static final String FILE_LEVEL = "/sys/devices/platform/kcal_ctrl.0/kcal_hue";
- private static final String DEFAULT_VALUE = "0";
-
- public KcalScreenHuePreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- mMinValue = 0;
- mMaxValue = 1536;
- setDialogLayoutResource(R.layout.preference_dialog_kcal);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- mOldStrength = Integer.parseInt(getValue(getContext()));
- mSeekBar = (SeekBar) view.findViewById(R.id.kcalSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldStrength - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(String.valueOf(mOldStrength));
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_LEVEL);
- }
-
- public static String getValue(Context context) {
- int value = Integer.parseInt(Utils.getFileValue(FILE_LEVEL, DEFAULT_VALUE));
- return String.valueOf(translate(value, true));
- }
-
- public static void setValue(String newValue) {
- String value = String.valueOf(translate(Integer.parseInt(newValue), false));
- Utils.writeValue(FILE_LEVEL, value);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_SCR_HUE, DEFAULT_VALUE);
- String value = String.valueOf(translate(Integer.parseInt(storedValue), false));
- Utils.writeValue(FILE_LEVEL, value);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- String value = String.valueOf(progress + mMinValue);
- setValue(value);
- mValueText.setText(value);
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- final int value = mSeekBar.getProgress() + mMinValue;
- setValue(String.valueOf(value));
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_KCAL_SCR_HUE, String.valueOf(value));
- editor.commit();
- } else {
- restoreOldState();
- }
- }
-
- private void restoreOldState() {
- setValue(String.valueOf(mOldStrength));
- }
-
- private static int translate(int value, boolean read) {
- if (!read)
- return value + OFFSET;
- else
- return value - OFFSET;
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + 1);
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - 1);
- }
- }
-
- private void restoreDefault() {
- int defaultValue = Integer.parseInt(DEFAULT_VALUE);
- mSeekBar.setProgress(defaultValue);
- }
-}
-
diff --git a/AdvancedControls/src/com/thht/settings/device/KcalScreenValuePreference.java b/AdvancedControls/src/com/thht/settings/device/KcalScreenValuePreference.java
deleted file mode 100644
index 4143d60..0000000
--- a/AdvancedControls/src/com/thht/settings/device/KcalScreenValuePreference.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.util.List;
-
-public class KcalScreenValuePreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldStrength;
- private int mMinValue;
- private int mMaxValue;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final int OFFSET = 128;
- private static final String FILE_LEVEL = "/sys/devices/platform/kcal_ctrl.0/kcal_val";
- private static final String DEFAULT_VALUE = "127";
-
- public KcalScreenValuePreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- mMinValue = 0;
- mMaxValue = 255;
- setDialogLayoutResource(R.layout.preference_dialog_kcal);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- mOldStrength = Integer.parseInt(getValue(getContext()));
- mSeekBar = (SeekBar) view.findViewById(R.id.kcalSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldStrength - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(String.valueOf(mOldStrength));
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_LEVEL);
- }
-
- public static String getValue(Context context) {
- int value = Integer.parseInt(Utils.getFileValue(FILE_LEVEL, DEFAULT_VALUE));
- return String.valueOf(translate(value, true));
- }
-
- public static void setValue(String newValue) {
- String value = String.valueOf(translate(Integer.parseInt(newValue), false));
- Utils.writeValue(FILE_LEVEL, value);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_SCR_VAL, DEFAULT_VALUE);
- String value = String.valueOf(translate(Integer.parseInt(storedValue), false));
- Utils.writeValue(FILE_LEVEL, value);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- String value = String.valueOf(progress + mMinValue);
- setValue(value);
- mValueText.setText(value);
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- final int value = mSeekBar.getProgress() + mMinValue;
- setValue(String.valueOf(value));
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_KCAL_SCR_VAL, String.valueOf(value));
- editor.commit();
- } else {
- restoreOldState();
- }
- }
-
- private void restoreOldState() {
- setValue(String.valueOf(mOldStrength));
- }
-
- private static int translate(int value, boolean read) {
- if (!read)
- return value + OFFSET;
- else
- return value - OFFSET;
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + 1);
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - 1);
- }
- }
-
- private void restoreDefault() {
- int defaultValue = Integer.parseInt(DEFAULT_VALUE);
- mSeekBar.setProgress(defaultValue);
- }
-}
-
diff --git a/AdvancedControls/src/com/thht/settings/device/KcalUtils.java b/AdvancedControls/src/com/thht/settings/device/KcalUtils.java
deleted file mode 100644
index 87152fc..0000000
--- a/AdvancedControls/src/com/thht/settings/device/KcalUtils.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.thht.settings.device;
-
-import android.preference.PreferenceManager;
-import android.content.Context;
-import java.util.List;
-
-public class KcalUtils {
-
- public static final String FILE_LEVEL = "/sys/devices/platform/kcal_ctrl.0/kcal";
- public static final String DEFAULT_VALUE = "237 237 237";
-
- public static String[] getIndividualRGB(String rgb) {
- return rgb.split(" ", 3);
- }
-
- public static String combineIndividualRGB(String[] rgb) {
- return String.join(" ", rgb);
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_LEVEL);
- }
-
- public static void restoreRGBAfterBoot(Context context) {
-
- if(!isSupported()) { return; }
-
- String[] redStoredValue = getIndividualRGB(PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_RGB_RED, DEFAULT_VALUE));
- String[] greenStoredValue = getIndividualRGB(PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_RGB_GREEN, DEFAULT_VALUE));
- String[] blueStoredValue = getIndividualRGB(PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_KCAL_RGB_BLUE, DEFAULT_VALUE));
-
- String[] combinedValue = {redStoredValue[0], greenStoredValue[1], blueStoredValue[2]};
- String finalValue = combineIndividualRGB(combinedValue);
-
- Utils.writeValue(FILE_LEVEL, finalValue);
-
- }
-}
diff --git a/AdvancedControls/src/com/thht/settings/device/RestoreService.java b/AdvancedControls/src/com/thht/settings/device/RestoreService.java
deleted file mode 100644
index 3956429..0000000
--- a/AdvancedControls/src/com/thht/settings/device/RestoreService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.thht.settings.device;
-
-import android.app.IntentService;
-import android.content.Intent;
-import android.os.IBinder;
-import android.util.Log;
-import android.preference.PreferenceManager;
-
-public class RestoreService extends IntentService {
-
- private static final String TAG = "RestoreService";
-
- public RestoreService() {
- super(RestoreService.class.getName());
- }
-
- @Override
- protected void onHandleIntent(Intent intent) {
-
- VibratorStrengthPreference.restore(this);
- WhiteTorchBrightnessPreference.restore(this);
- YellowTorchBrightnessPreference.restore(this);
-
- Boolean shouldRestorePreset = intent.getExtras().getBoolean(DeviceSettings.KEY_KCAL_PRESETS, false);
-
- if (shouldRestorePreset) {
- String kcalPresetsValue = PreferenceManager.getDefaultSharedPreferences(this).getString(DeviceSettings.KEY_KCAL_PRESETS_LIST, "0");
- KcalPresets.setValue(kcalPresetsValue);
- } else {
- KcalRGBMinPreference.restore(this);
- KcalSatIntensityPreference.restore(this);
- KcalScreenHuePreference.restore(this);
- KcalScreenValuePreference.restore(this);
- KcalScreenContrPreference.restore(this);
- KcalUtils.restoreRGBAfterBoot(this);
- }
-
- }
-}
diff --git a/AdvancedControls/src/com/thht/settings/device/Startup.java b/AdvancedControls/src/com/thht/settings/device/Startup.java
deleted file mode 100644
index 01b651a..0000000
--- a/AdvancedControls/src/com/thht/settings/device/Startup.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2013 The OmniROM Project
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-package com.thht.settings.device;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.os.Handler;
-import java.lang.Runnable;
-import android.util.Log;
-
-
-public class Startup extends BroadcastReceiver {
-
- private static final String TAG = "AdvancedControls";
-
- @Override
- public void onReceive(final Context context, final Intent bootintent) {
-
- Boolean shouldRestore = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(DeviceSettings.KEY_RESTORE_ON_BOOT, false);
- Boolean shouldRestorePreset = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(DeviceSettings.KEY_KCAL_PRESETS, false);
- Log.e(TAG, Boolean.toString(shouldRestore));
- if(bootintent.getAction().equals("android.intent.action.BOOT_COMPLETED") && shouldRestore) {
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- Intent in = new Intent(context, RestoreService.class);
- in.putExtra(DeviceSettings.KEY_KCAL_PRESETS, shouldRestorePreset);
- context.startService(in);
- }
- }, 0);
- }
- }
-}
diff --git a/AdvancedControls/src/com/thht/settings/device/Utils.java b/AdvancedControls/src/com/thht/settings/device/Utils.java
deleted file mode 100644
index 3c3af3c..0000000
--- a/AdvancedControls/src/com/thht/settings/device/Utils.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-* Copyright (C) 2013 The OmniROM Project
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-*/
-package com.thht.settings.device;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.BufferedReader;
-import java.io.FileReader;
-
-public class Utils {
-
- /**
- * Write a string value to the specified file.
- * @param filename The filename
- * @param value The value
- */
- public static void writeValue(String filename, String value) {
- if (filename == null) {
- return;
- }
- try {
- FileOutputStream fos = new FileOutputStream(new File(filename));
- fos.write(value.getBytes());
- fos.flush();
- fos.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Check if the specified file exists.
- * @param filename The filename
- * @return Whether the file exists or not
- */
- public static boolean fileExists(String filename) {
- if (filename == null) {
- return false;
- }
- return new File(filename).exists();
- }
-
- public static boolean fileWritable(String filename) {
- return fileExists(filename) && new File(filename).canWrite();
- }
-
- public static String readLine(String filename) {
- if (filename == null) {
- return null;
- }
- BufferedReader br = null;
- String line = null;
- try {
- br = new BufferedReader(new FileReader(filename), 1024);
- line = br.readLine();
- } catch (IOException e) {
- return null;
- } finally {
- if (br != null) {
- try {
- br.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- return line;
- }
-
- public static boolean getFileValueAsBoolean(String filename, boolean defValue) {
- String fileValue = readLine(filename);
- if(fileValue!=null){
- return (fileValue.equals("0")?false:true);
- }
- return defValue;
- }
-
- public static String getFileValue(String filename, String defValue) {
- String fileValue = readLine(filename);
- if(fileValue!=null){
- return fileValue;
- }
- return defValue;
- }
-}
diff --git a/AdvancedControls/src/com/thht/settings/device/VibratorStrengthPreference.java b/AdvancedControls/src/com/thht/settings/device/VibratorStrengthPreference.java
deleted file mode 100644
index f613c98..0000000
--- a/AdvancedControls/src/com/thht/settings/device/VibratorStrengthPreference.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
-* Copyright (C) 2016 The OmniROM Project
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-*/
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-import android.os.Vibrator;
-
-import java.util.List;
-
-import com.thht.settings.device.R;
-
-public class VibratorStrengthPreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldStrength;
- private int mMinValue;
- private int mMaxValue;
- private float offset;
- private Vibrator mVibrator;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final String FILE_LEVEL = "/sys/devices/virtual/timed_output/vibrator/vtg_level";
- private static final long testVibrationPattern[] = {0,250};
- private static final int DEFAULT_VALUE = 2873;
-
- public VibratorStrengthPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- // from drivers/platform/msm/qpnp-haptic.c
- // #define QPNP_HAP_VMAX_MIN_MV 116
- // #define QPNP_HAP_VMAX_MAX_MV 3596
- mMinValue = 116;
- mMaxValue = 3596;
- offset = mMaxValue / 100f;
-
- mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
- setDialogLayoutResource(R.layout.preference_dialog_vibrator_strength);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- mOldStrength = Integer.parseInt(getValue(getContext()));
- mSeekBar = (SeekBar) view.findViewById(R.id.vibratorSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldStrength - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(Integer.toString(Math.round(mOldStrength / offset)) + "%");
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_LEVEL);
- }
-
- public static String getValue(Context context) {
- return Utils.getFileValue(FILE_LEVEL, String.valueOf(DEFAULT_VALUE));
- }
-
- public static void setValue(String newValue) {
- Utils.writeValue(FILE_LEVEL, newValue);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_VIBSTRENGTH, String.valueOf(DEFAULT_VALUE));
- Utils.writeValue(FILE_LEVEL, storedValue);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- setValue(String.valueOf(progress + mMinValue));
- mValueText.setText(Integer.toString(Math.round((progress + mMinValue) / offset)) + "%");
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- if (mVibrator.hasVibrator())
- mVibrator.vibrate(testVibrationPattern, -1);
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- final int value = mSeekBar.getProgress() + mMinValue;
- setValue(String.valueOf(value));
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_VIBSTRENGTH, String.valueOf(value));
- editor.commit();
- } else {
- restoreOldState();
- }
- mVibrator.cancel();
- }
-
- private void restoreOldState() {
- setValue(String.valueOf(mOldStrength));
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + Math.round(offset));
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - Math.round(offset));
- }
- }
-
- private void restoreDefault() {
- mSeekBar.setProgress(DEFAULT_VALUE);
- }
-}
-
diff --git a/AdvancedControls/src/com/thht/settings/device/WhiteTorchBrightnessPreference.java b/AdvancedControls/src/com/thht/settings/device/WhiteTorchBrightnessPreference.java
deleted file mode 100644
index 586fe06..0000000
--- a/AdvancedControls/src/com/thht/settings/device/WhiteTorchBrightnessPreference.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-* Copyright (C) 2016 The OmniROM Project
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-*/
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.util.List;
-
-public class WhiteTorchBrightnessPreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldBrightness;
- private int mMinValue;
- private int mMaxValue;
- private float offset;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final String FILE_BRIGHTNESS = "/sys/devices/platform/soc/qpnp-flash-led-24/leds/led:torch_0/max_brightness";
- private static final int DEFAULT_VALUE = 200;
-
- public WhiteTorchBrightnessPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- mMinValue = 0;
- mMaxValue = 200;
- offset = mMaxValue / 100f;
-
- setDialogLayoutResource(R.layout.preference_dialog_torch_brightness);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- mOldBrightness = Integer.parseInt(getValue(getContext()));
- mSeekBar = (SeekBar) view.findViewById(R.id.torchSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldBrightness - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(Integer.toString(Math.round(mOldBrightness / offset)) + "%");
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_BRIGHTNESS);
- }
-
- public static String getValue(Context context) {
- return Utils.getFileValue(FILE_BRIGHTNESS, "200");
- }
-
- public static void setValue(String newValue) {
- Utils.writeValue(FILE_BRIGHTNESS, newValue);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_WHITE_TORCH_BRIGHTNESS, "200");
- Utils.writeValue(FILE_BRIGHTNESS, storedValue);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- setValue(String.valueOf(progress + mMinValue));
- mValueText.setText(Integer.toString(Math.round((progress + mMinValue) / offset)) + "%");
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- final int value = mSeekBar.getProgress() + mMinValue;
- setValue(String.valueOf(value));
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_WHITE_TORCH_BRIGHTNESS, String.valueOf(value));
- editor.commit();
- } else {
- restoreOldState();
- }
- }
-
- private void restoreOldState() {
- setValue(String.valueOf(mOldBrightness));
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + Math.round(offset));
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - Math.round(offset));
- }
- }
-
- private void restoreDefault() {
- mSeekBar.setProgress(DEFAULT_VALUE);
- }
-}
-
diff --git a/AdvancedControls/src/com/thht/settings/device/YellowTorchBrightnessPreference.java b/AdvancedControls/src/com/thht/settings/device/YellowTorchBrightnessPreference.java
deleted file mode 100644
index eb08269..0000000
--- a/AdvancedControls/src/com/thht/settings/device/YellowTorchBrightnessPreference.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-* Copyright (C) 2016 The OmniROM Project
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-*/
-package com.thht.settings.device;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import android.database.ContentObserver;
-import android.preference.SeekBarDialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.widget.Button;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.util.List;
-
-public class YellowTorchBrightnessPreference extends SeekBarDialogPreference implements
- SeekBar.OnSeekBarChangeListener {
-
- private SeekBar mSeekBar;
- private int mOldBrightness;
- private int mMinValue;
- private int mMaxValue;
- private float offset;
- private TextView mValueText;
- private Button mPlusOneButton;
- private Button mMinusOneButton;
- private Button mRestoreDefaultButton;
-
- private static final String FILE_BRIGHTNESS = "/sys/devices/platform/soc/qpnp-flash-led-24/leds/led:torch_1/max_brightness";
- private static final int DEFAULT_VALUE = 200;
-
- public YellowTorchBrightnessPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- mMinValue = 0;
- mMaxValue = 200;
- offset = mMaxValue / 100f;
-
- setDialogLayoutResource(R.layout.preference_dialog_torch_brightness);
- }
-
- @Override
- protected void showDialog(Bundle state) {
- super.showDialog(state);
- }
-
- @Override
- protected void onBindDialogView(View view) {
- super.onBindDialogView(view);
-
- mOldBrightness = Integer.parseInt(getValue(getContext()));
- mSeekBar = (SeekBar) view.findViewById(R.id.torchSeekBar);
- mSeekBar.setMax(mMaxValue - mMinValue);
- mSeekBar.setProgress(mOldBrightness - mMinValue);
- mValueText = (TextView) view.findViewById(R.id.current_value);
- mValueText.setText(Integer.toString(Math.round(mOldBrightness / offset)) + "%");
- mSeekBar.setOnSeekBarChangeListener(this);
- mPlusOneButton = (Button) view.findViewById(R.id.plus_one);
- mPlusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.plus_one) {
- singleStepPlus();
- }
- }
- });
- mMinusOneButton = (Button) view.findViewById(R.id.minus_one);
- mMinusOneButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.minus_one) {
- singleStepMinus();
- }
- }
- });
- mRestoreDefaultButton = (Button) view.findViewById(R.id.restore_default);
- mRestoreDefaultButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (v.getId() == R.id.restore_default) {
- restoreDefault();
- }
- }
- });
- }
-
- public static boolean isSupported() {
- return Utils.fileWritable(FILE_BRIGHTNESS);
- }
-
- public static String getValue(Context context) {
- return Utils.getFileValue(FILE_BRIGHTNESS, "200");
- }
-
- public static void setValue(String newValue) {
- Utils.writeValue(FILE_BRIGHTNESS, newValue);
- }
-
- public static void restore(Context context) {
- if (!isSupported()) {
- return;
- }
-
- String storedValue = PreferenceManager.getDefaultSharedPreferences(context).getString(DeviceSettings.KEY_YELLOW_TORCH_BRIGHTNESS, "200");
- Utils.writeValue(FILE_BRIGHTNESS, storedValue);
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress,
- boolean fromTouch) {
- setValue(String.valueOf(progress + mMinValue));
- mValueText.setText(Integer.toString(Math.round((progress + mMinValue) / offset)) + "%");
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- // NA
- }
-
- @Override
- protected void onDialogClosed(boolean positiveResult) {
- super.onDialogClosed(positiveResult);
-
- if (positiveResult) {
- final int value = mSeekBar.getProgress() + mMinValue;
- setValue(String.valueOf(value));
- SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
- editor.putString(DeviceSettings.KEY_YELLOW_TORCH_BRIGHTNESS, String.valueOf(value));
- editor.commit();
- } else {
- restoreOldState();
- }
- }
-
- private void restoreOldState() {
- setValue(String.valueOf(mOldBrightness));
- }
-
- private void singleStepPlus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue < mMaxValue) {
- mSeekBar.setProgress(currentValue + Math.round(offset));
- }
- }
-
- private void singleStepMinus() {
- int currentValue = mSeekBar.getProgress();
- if (currentValue > mMinValue) {
- mSeekBar.setProgress(currentValue - Math.round(offset));
- }
- }
-
- private void restoreDefault() {
- mSeekBar.setProgress(DEFAULT_VALUE);
- }
-}
-
diff --git a/device.mk b/device.mk
index a8c45c9..773a8c1 100644
--- a/device.mk
+++ b/device.mk
@@ -83,10 +83,6 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \
frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml
-# Advanced Controls
-#PRODUCT_PACKAGES += \
-# AdvancedControls
-
# ANT
PRODUCT_PACKAGES += \
AntHalService \
diff --git a/rootdir/init.qcom.rc b/rootdir/init.qcom.rc
index 4897c05..b7e22bb 100644
--- a/rootdir/init.qcom.rc
+++ b/rootdir/init.qcom.rc
@@ -130,23 +130,6 @@ on boot
chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo
chmod 0660 /sys/class/rfkill/rfkill0/device/extldo
- # Vibrator permissions
- chown root system /sys/class/timed_output/vibrator/vtg_level
- chmod 0660 /sys/class/timed_output/vibrator/vtg_level
-
- # Kcal permissions
- chown root system /sys/devices/platform/kcal_ctrl.0/kcal
- chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal
- chown root system /sys/devices/platform/kcal_ctrl.0/kcal_min
- chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_min
- chown root system /sys/devices/platform/kcal_ctrl.0/kcal_sat
- chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_sat
- chown root system /sys/devices/platform/kcal_ctrl.0/kcal_hue
- chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_hue
- chown root system /sys/devices/platform/kcal_ctrl.0/kcal_val
- chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_val
- chown root system /sys/devices/platform/kcal_ctrl.0/kcal_cont
- chmod 0660 /sys/devices/platform/kcal_ctrl.0/kcal_cont
#Create QMUX deamon socket area
mkdir /dev/socket/qmux_radio 0770 radio radio