diff options
author | KalimochoAz <calimochoazucarado@gmail.com> | 2012-05-01 03:11:50 +0200 |
---|---|---|
committer | KalimochoAz <calimochoazucarado@gmail.com> | 2012-05-01 03:11:50 +0200 |
commit | 8f1496f742f27fc1fd20852710c9d7146e5fae16 (patch) | |
tree | 7b5cd8a706a54cdcbbc3412e9ee8ff1a921d339b | |
parent | 15f605f851ecf09ac387c7f116a01c5da953599a (diff) | |
download | device_samsung_tuna-8f1496f742f27fc1fd20852710c9d7146e5fae16.zip device_samsung_tuna-8f1496f742f27fc1fd20852710c9d7146e5fae16.tar.gz device_samsung_tuna-8f1496f742f27fc1fd20852710c9d7146e5fae16.tar.bz2 |
Add control for fast USB Charge
Change-Id: I60e791ac3560f192d1dd3401fe79e36da577a512
-rw-r--r-- | GNexusParts/res/values-de/strings.xml | 2 | ||||
-rw-r--r-- | GNexusParts/res/values-ja/strings.xml | 2 | ||||
-rw-r--r-- | GNexusParts/res/values-ru/strings.xml | 1 | ||||
-rw-r--r-- | GNexusParts/res/values/strings.xml | 6 | ||||
-rw-r--r-- | GNexusParts/res/xml/general_preferences.xml | 8 | ||||
-rw-r--r-- | GNexusParts/src/com/cyanogenmod/settings/device/DeviceSettings.java | 1 | ||||
-rw-r--r-- | GNexusParts/src/com/cyanogenmod/settings/device/GeneralFragmentActivity.java | 22 |
7 files changed, 35 insertions, 7 deletions
diff --git a/GNexusParts/res/values-de/strings.xml b/GNexusParts/res/values-de/strings.xml index ed03759..e5e4826 100644 --- a/GNexusParts/res/values-de/strings.xml +++ b/GNexusParts/res/values-de/strings.xml @@ -6,7 +6,7 @@ <string name="general_title">ALLGEMEIN</string> <string name="display_title">BILDSCHIRM</string> - <string name="category_cpu_title">Prozessor</string> + <string name="category_system_title">System</string> <string name="category_screen_title">WM8994 Einstellungen ( voodoo )</string> <string name="color_tuning_title_head">Farbmultiplikator</string> <string name="color_tuning_summary_head">Farbmultiplikator einstellen</string> diff --git a/GNexusParts/res/values-ja/strings.xml b/GNexusParts/res/values-ja/strings.xml index 357a2d8..6a650f3 100644 --- a/GNexusParts/res/values-ja/strings.xml +++ b/GNexusParts/res/values-ja/strings.xml @@ -6,7 +6,7 @@ <string name="general_title">一般</string> <string name="display_title">ディスプレイ</string> - <string name="category_cpu_title">CPU</string> + <string name="category_system_title">SYSTEM</string> <string name="category_screen_title">WM8994設定 ( voodoo )</string> <string name="color_tuning_title_head">カラーマルチプライヤチューニング</string> <string name="color_tuning_summary_head">画面の色味を調整する</string> diff --git a/GNexusParts/res/values-ru/strings.xml b/GNexusParts/res/values-ru/strings.xml index cd76fca..57fc0ca 100644 --- a/GNexusParts/res/values-ru/strings.xml +++ b/GNexusParts/res/values-ru/strings.xml @@ -6,7 +6,6 @@ <string name="general_title">ОСНОВНЫЕ</string> <string name="display_title">ДИСПЛЕЙ</string> - <string name="category_cpu_title">ЦП</string> <string name="category_screen_title">Настройки WM8994 ( voodoo )</string> <string name="color_tuning_title_head">Настройка цвета мультипликатора</string> <string name="color_tuning_summary_head">Калибровка цвета мультипликатора</string> diff --git a/GNexusParts/res/values/strings.xml b/GNexusParts/res/values/strings.xml index 43f27a5..f06093f 100644 --- a/GNexusParts/res/values/strings.xml +++ b/GNexusParts/res/values/strings.xml @@ -6,7 +6,7 @@ <string name="general_title">GENERAL</string> <string name="display_title">DISPLAY</string> - <string name="category_cpu_title">CPU</string> + <string name="category_system_title">System</string> <string name="category_screen_title">WM8994 Settings ( voodoo )</string> <string name="color_tuning_title_head">Color Multipliers Tuning</string> <string name="color_tuning_summary_head">Calibrate multipliers screen color</string> @@ -23,6 +23,8 @@ <string name="color_default_title">Default</string> <string name="color_CM_title">CM Sett.</string> <string name="color_dark_title">Dark Sett.</string> + <string name="usb_fastcharge_title_head">Fast charge USB</string> + <string name="usb_fastcharge_summary_head">Fast charge when connected to computer USB interface</string> <string name="preset1_default_title">Default.</string> <string name="preset2_default_title">Natural</string> @@ -30,7 +32,7 @@ <string name="preset4_default_title">Warm</string> <string name="preset5_default_title">Dark Cold</string> <string name="preset6_default_title">Cross Proc.</string> - <string name="credits_presets">Credits: ale.landra91 cpaixao provolinoo</string> + <string name="credits_presets">Credits: ale.landra91 cpaixao malycomix</string> <string name="category_touchkey_title">Touch Keys</string> <string name="touchkey_notification_title_head">Backlight Notifications</string> diff --git a/GNexusParts/res/xml/general_preferences.xml b/GNexusParts/res/xml/general_preferences.xml index fc07c42..2bf2c43 100644 --- a/GNexusParts/res/xml/general_preferences.xml +++ b/GNexusParts/res/xml/general_preferences.xml @@ -2,8 +2,12 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <!-- General settings --> - <PreferenceCategory android:key="category_cpu" - android:title="@string/category_cpu_title"> + <PreferenceCategory android:key="category_system" + android:title="@string/category_system_title"> + + <CheckBoxPreference android:key="fast_charge_usb" + android:title="@string/usb_fastcharge_title_head" + android:summary="@string/usb_fastcharge_summary_head" /> </PreferenceCategory> diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/DeviceSettings.java b/GNexusParts/src/com/cyanogenmod/settings/device/DeviceSettings.java index e131654..d5d7838 100644 --- a/GNexusParts/src/com/cyanogenmod/settings/device/DeviceSettings.java +++ b/GNexusParts/src/com/cyanogenmod/settings/device/DeviceSettings.java @@ -45,6 +45,7 @@ public class DeviceSettings extends Activity { public static final String KEY_GAMMA_TUNING = "gamma_tuning"; public static final String KEY_CATEGORY_RADIO = "category_radio"; public static final String KEY_HSPA = "hspa"; + public static final String KEY_USB_FAST_CHARGE = "fast_charge_usb"; ViewPager mViewPager; TabsAdapter mTabsAdapter; diff --git a/GNexusParts/src/com/cyanogenmod/settings/device/GeneralFragmentActivity.java b/GNexusParts/src/com/cyanogenmod/settings/device/GeneralFragmentActivity.java index ca1b155..17644e6 100644 --- a/GNexusParts/src/com/cyanogenmod/settings/device/GeneralFragmentActivity.java +++ b/GNexusParts/src/com/cyanogenmod/settings/device/GeneralFragmentActivity.java @@ -27,6 +27,7 @@ import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.util.Log; +import android.view.View; import com.cyanogenmod.settings.device.R; @@ -34,6 +35,9 @@ public class GeneralFragmentActivity extends PreferenceFragment { private static final String PREF_ENABLED = "1"; private static final String TAG = "GNexusParts_General"; + private static final String USB_FAST_CHARGE_FILE = "/sys/kernel/fast_charge/force_fast_charge"; + + private CheckBoxPreference mUSBFastCharge; @Override public void onCreate(Bundle savedInstanceState) { @@ -42,6 +46,13 @@ public class GeneralFragmentActivity extends PreferenceFragment { addPreferencesFromResource(R.xml.general_preferences); PreferenceScreen prefSet = getPreferenceScreen(); + mUSBFastCharge = (CheckBoxPreference) findPreference(DeviceSettings.KEY_USB_FAST_CHARGE); + + if (isSupported(USB_FAST_CHARGE_FILE)) { + mUSBFastCharge.setChecked(PREF_ENABLED.equals(Utils.readOneLine(USB_FAST_CHARGE_FILE))); + } else { + mUSBFastCharge.setEnabled(false); + } } @@ -53,6 +64,12 @@ public class GeneralFragmentActivity extends PreferenceFragment { Log.w(TAG, "key: " + key); + if (key.equals(DeviceSettings.KEY_USB_FAST_CHARGE)) { + final CheckBoxPreference chkPref = (CheckBoxPreference) preference; + boxValue = chkPref.isChecked() ? "1" : "0"; + Utils.writeValue(USB_FAST_CHARGE_FILE, boxValue); + } + return true; } @@ -62,5 +79,10 @@ public class GeneralFragmentActivity extends PreferenceFragment { public static void restore(Context context) { SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + if (isSupported(USB_FAST_CHARGE_FILE)) { + String sDefaultValue = Utils.readOneLine(USB_FAST_CHARGE_FILE); + Utils.writeValue(USB_FAST_CHARGE_FILE, sharedPrefs.getBoolean(DeviceSettings.KEY_USB_FAST_CHARGE, + PREF_ENABLED.equals(sDefaultValue))); + } } } |