diff options
21 files changed, 265 insertions, 64 deletions
diff --git a/BoardCommonConfig.mk b/BoardCommonConfig.mk index fc644c1..ed89f55 100644 --- a/BoardCommonConfig.mk +++ b/BoardCommonConfig.mk @@ -75,6 +75,10 @@ USE_OPENGL_RENDERER := true BOARD_USES_SKIAHWJPEG := true COMMON_GLOBAL_CFLAGS += -DSEC_HWJPEG_G2D +# FIMG Acceleration +BOARD_USES_FIMGAPI := true +BOARD_USES_SKIA_FIMGAPI := true + # Enable WEBGL in WebKit ENABLE_WEBGL := true diff --git a/DeviceSettings/res/values-de/arrays.xml b/DeviceSettings/res/values-de/arrays.xml index 04b2538..761957d 100644 --- a/DeviceSettings/res/values-de/arrays.xml +++ b/DeviceSettings/res/values-de/arrays.xml @@ -1,5 +1,19 @@ -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="mdnie_scenario_entries"> <item>CyanogenMod (Standard)</item> <item>UI</item> @@ -40,9 +54,8 @@ </string-array> <string-array name="hspa_entries"> - <item>Nur UMTS</item> - <item>Nur HSDPA</item> - <item>HSDPA + HSUPA</item> + <item>Nur UMTS</item> + <item>Nur HSDPA</item> + <item>HSDPA + HSUPA</item> </string-array> - </resources> diff --git a/DeviceSettings/res/values-de/strings.xml b/DeviceSettings/res/values-de/strings.xml index 65ce91e..31bcf5c 100644 --- a/DeviceSettings/res/values-de/strings.xml +++ b/DeviceSettings/res/values-de/strings.xml @@ -1,5 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<resources> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_name">Erweiterte Einstellungen</string> <string name="defaults_button">Zurücksetzen</string> diff --git a/DeviceSettings/res/values-es/arrays.xml b/DeviceSettings/res/values-es/arrays.xml index c7d02c5..f0d90ee 100644 --- a/DeviceSettings/res/values-es/arrays.xml +++ b/DeviceSettings/res/values-es/arrays.xml @@ -1,3 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="hspa_entries"> <item>Sólo UMTS</item> diff --git a/DeviceSettings/res/values-es/strings.xml b/DeviceSettings/res/values-es/strings.xml index f615d4b..ae3f066 100644 --- a/DeviceSettings/res/values-es/strings.xml +++ b/DeviceSettings/res/values-es/strings.xml @@ -1,20 +1,25 @@ <?xml version="1.0" encoding="utf-8"?> -<resources> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_name">Ajustes avanzados</string> - <string name="category_dock_title">Base</string> - <string name="dockaudio_subcat_title">Sonido</string> - <string name="use_dock_audio_title_head">Usar sonido USB</string> - <string name="use_dock_audio_summary_head">Utilizar la salida de audio de la base</string> - <string name="category_haptic_title">Háptica</string> - <string name="vibrator_title">Vibración</string> - <string name="vibrator_tuning_title">Intensidad de vibración</string> - <string name="vibrator_tuning_summary_head">Establecer la intensidad de vibración</string> - <string name="vibrator_warning">No son recomendables valores mayores de %1$d</string> - <string name="category_radio_title">Radio</string> - <string name="hspa_title_head">HSPA</string> - <string name="hspa_summary_head">Habilitar HSDPA/HSUPA</string> + <string name="defaults_button">Restablecer</string> <string name="category_screen_title">Pantalla</string> <string name="screen_colors_title">Colores</string> + <string name="cabc_title_head">Brillo adaptativo</string> + <string name="cabc_summary_head">Activar el control de brillo adaptado al contenido</string> <string name="mdnie_scenario_title_head">Escenario</string> <string name="mdnie_scenario_summary_head">Establecer escenario mDNIe</string> <string name="mdnie_mode_title_head">Modo</string> @@ -30,4 +35,19 @@ <string name="touchkey_light_summary_on">Deshabilitar retroiluminación</string> <string name="touchkey_timeout_title_head">Tiempo de espera de retroiluminación</string> <string name="touchkey_timeout_summary_head">Tiempo tras pulsar una tecla antes de apagar la retroiluminación</string> + <string name="category_haptic_title">Háptica</string> + <string name="vibrator_title">Vibración</string> + <string name="vibrator_tuning_title">Intensidad de vibración</string> + <string name="vibrator_tuning_summary_head">Establecer la intensidad de vibración</string> + <string name="vibrator_warning">No son recomendables valores mayores de %1$d</string> + <string name="category_radio_title">Radio</string> + <string name="hspa_title_head">HSPA</string> + <string name="hspa_summary_head">Habilitar HSDPA/HSUPA</string> + <string name="category_dock_title">Base</string> + <string name="dockaudio_subcat_title">Sonido</string> + <string name="use_dock_audio_title_head">Usar sonido USB</string> + <string name="use_dock_audio_summary_head">Utilizar la salida de audio de la base</string> + <string name="spen_subcat_title">S-Pen</string> + <string name="spen_power_save_title_head">Ahorro de energía</string> + <string name="spen_power_save_summary_head">Desactivar el digitalizador del stylus cuando el S-Pen esté en el dispositivo</string> </resources> diff --git a/DeviceSettings/res/values-fr/arrays.xml b/DeviceSettings/res/values-fr/arrays.xml index 11b706d..346893e 100644 --- a/DeviceSettings/res/values-fr/arrays.xml +++ b/DeviceSettings/res/values-fr/arrays.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2013 The CyanogenMod Project +<!-- Copyright (C) 2012-2013 The CyanogenMod Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/DeviceSettings/res/values-fr/strings.xml b/DeviceSettings/res/values-fr/strings.xml index 5556d24..a679999 100644 --- a/DeviceSettings/res/values-fr/strings.xml +++ b/DeviceSettings/res/values-fr/strings.xml @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ---> + --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_name">Paramètres avancés</string> <string name="category_dock_title">Station d\'accueil</string> diff --git a/DeviceSettings/res/values-hu/arrays.xml b/DeviceSettings/res/values-hu/arrays.xml index 82074a2..261c315 100644 --- a/DeviceSettings/res/values-hu/arrays.xml +++ b/DeviceSettings/res/values-hu/arrays.xml @@ -1,5 +1,19 @@ -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="hspa_entries"> <item>UMTS</item> <item>HSDPA</item> @@ -44,5 +58,4 @@ <item>5 másodperc</item> <item>6 másodperc</item> </string-array> - </resources> diff --git a/DeviceSettings/res/values-hu/strings.xml b/DeviceSettings/res/values-hu/strings.xml index f5f1411..1c00bd0 100644 --- a/DeviceSettings/res/values-hu/strings.xml +++ b/DeviceSettings/res/values-hu/strings.xml @@ -1,5 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<resources> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_name">Advanced settings</string> <string name="category_dock_title">Dokkoló</string> @@ -30,5 +44,4 @@ <string name="touchkey_light_summary_on">Háttérvilágítás tiltása</string> <string name="touchkey_timeout_title_head">Háttérvilágítás időkorlátja</string> <string name="touchkey_timeout_summary_head">Háttérvilágítás késleltetése</string> - </resources> diff --git a/DeviceSettings/res/values-pl/arrays.xml b/DeviceSettings/res/values-pl/arrays.xml index f9de456..c1045a1 100644 --- a/DeviceSettings/res/values-pl/arrays.xml +++ b/DeviceSettings/res/values-pl/arrays.xml @@ -1,5 +1,19 @@ -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="hspa_entries"> <item>Tylko UMTS</item> <item>Tylko HSDPA</item> @@ -44,5 +58,4 @@ <item>5 sekund</item> <item>6 sekund</item> </string-array> - </resources> diff --git a/DeviceSettings/res/values-pl/strings.xml b/DeviceSettings/res/values-pl/strings.xml index 20da92d..7e290ac 100644 --- a/DeviceSettings/res/values-pl/strings.xml +++ b/DeviceSettings/res/values-pl/strings.xml @@ -1,5 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<resources> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_name">Advanced settings</string> <string name="category_dock_title">Stacja dokująca</string> @@ -30,5 +44,4 @@ <string name="touchkey_light_summary_on">Wyłącz podświetlenie</string> <string name="touchkey_timeout_title_head">Opóźnienie podświetlenia</string> <string name="touchkey_timeout_summary_head">Ustaw opóźnienie dla podświetlenia</string> - </resources> diff --git a/DeviceSettings/res/values-pt-rBR/arrays.xml b/DeviceSettings/res/values-pt-rBR/arrays.xml index 983e35a..b7feab8 100644 --- a/DeviceSettings/res/values-pt-rBR/arrays.xml +++ b/DeviceSettings/res/values-pt-rBR/arrays.xml @@ -1,6 +1,19 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="hspa_entries"> <item>Somente UMTS</item> <item>Somente HSDPA</item> diff --git a/DeviceSettings/res/values-pt-rBR/strings.xml b/DeviceSettings/res/values-pt-rBR/strings.xml index 5813d7e..9794756 100644 --- a/DeviceSettings/res/values-pt-rBR/strings.xml +++ b/DeviceSettings/res/values-pt-rBR/strings.xml @@ -1,5 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<resources> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_name">Configurações avançadas</string> <string name="category_haptic_title">Resposta tátil</string> <string name="vibrator_title">Vibração</string> @@ -30,4 +44,4 @@ <string name="dockaudio_subcat_title">Áudio do dock</string> <string name="use_dock_audio_title_head">Usar áudio USB do dock</string> <string name="use_dock_audio_summary_head">Usar a saída de áudio passiva no dock</string> -</resources>
\ No newline at end of file +</resources> diff --git a/DeviceSettings/res/values-ru/arrays.xml b/DeviceSettings/res/values-ru/arrays.xml index a83b7b4..5cfaeb4 100644 --- a/DeviceSettings/res/values-ru/arrays.xml +++ b/DeviceSettings/res/values-ru/arrays.xml @@ -1,5 +1,19 @@ -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="hspa_entries"> <item>Только UMTS</item> <item>Только HSDPA</item> diff --git a/DeviceSettings/res/values-ru/strings.xml b/DeviceSettings/res/values-ru/strings.xml index c7b287a..24e4f5f 100644 --- a/DeviceSettings/res/values-ru/strings.xml +++ b/DeviceSettings/res/values-ru/strings.xml @@ -1,5 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<resources> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_name">Advanced settings</string> <string name="category_screen_title">Экран</string> diff --git a/DeviceSettings/res/values-zh-rCN/arrays.xml b/DeviceSettings/res/values-zh-rCN/arrays.xml index 373d649..1b14d15 100644 --- a/DeviceSettings/res/values-zh-rCN/arrays.xml +++ b/DeviceSettings/res/values-zh-rCN/arrays.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2013 The CyanogenMod Project +<!-- Copyright (C) 2012-2013 The CyanogenMod Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,9 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="hspa_entries"> <item>仅使用 UMTS</item> <item>仅使用 HSDPA</item> @@ -60,5 +58,4 @@ <item>5 秒</item> <item>6 秒</item> </string-array> - </resources> diff --git a/DeviceSettings/res/values-zh-rCN/strings.xml b/DeviceSettings/res/values-zh-rCN/strings.xml index f4158b9..6634cdf 100644 --- a/DeviceSettings/res/values-zh-rCN/strings.xml +++ b/DeviceSettings/res/values-zh-rCN/strings.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2013 The CyanogenMod Project +<!-- Copyright (C) 2012-2013 The CyanogenMod Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,8 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_name">高级设置</string> <string name="category_radio_title">无线电</string> diff --git a/DeviceSettings/res/values/arrays.xml b/DeviceSettings/res/values/arrays.xml index 18901ed..cff1afa 100644 --- a/DeviceSettings/res/values/arrays.xml +++ b/DeviceSettings/res/values/arrays.xml @@ -1,5 +1,19 @@ -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="mdnie_scenario_entries"> <item>CyanogenMod (Default)</item> <item>UI</item> @@ -89,5 +103,4 @@ <item>22</item> <item>23</item> </string-array> - </resources> diff --git a/DeviceSettings/res/values/strings.xml b/DeviceSettings/res/values/strings.xml index 472e160..0f75ae3 100644 --- a/DeviceSettings/res/values/strings.xml +++ b/DeviceSettings/res/values/strings.xml @@ -1,5 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<resources> +<!-- Copyright (C) 2012-2013 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string name="app_name">Advanced settings</string> <string name="defaults_button">Reset to default</string> diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/VibratorTuningPreference.java b/DeviceSettings/src/com/cyanogenmod/settings/device/VibratorTuningPreference.java index b9e7bb5..f2880e9 100644 --- a/DeviceSettings/src/com/cyanogenmod/settings/device/VibratorTuningPreference.java +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/VibratorTuningPreference.java @@ -40,8 +40,7 @@ import java.lang.Math; import java.text.DecimalFormat; /** - * Special preference type that allows configuration of vibrator intensity settings on Sony - * Devices + * Special preference type that allows configuration of vibrator intensity settings on Samsung devices */ public class VibratorTuningPreference extends DialogPreference implements SeekBar.OnSeekBarChangeListener { private static final String TAG = "DeviceSettings_Vibrator"; @@ -52,19 +51,18 @@ public class VibratorTuningPreference extends DialogPreference implements SeekBa private static int DEFAULT_VALUE; private static int MIN_VALUE; + private Context mContext; private SeekBar mSeekBar; private TextView mValue; private TextView mWarning; - private String mOriginalValue; - private int mOriginalPercent; - private Drawable mProgressDrawable; private Drawable mProgressThumb; private LightingColorFilter mRedFilter; public VibratorTuningPreference(Context context, AttributeSet attrs) { super(context, attrs); + mContext = context; FILE_PATH = context.getResources().getString(R.string.vibrator_sysfs_file); MAX_VALUE = Integer.valueOf(context.getResources().getString(R.string.intensity_max_value)); @@ -104,11 +102,15 @@ public class VibratorTuningPreference extends DialogPreference implements SeekBa mRedFilter = new LightingColorFilter(Color.BLACK, getContext().getResources().getColor(android.R.color.holo_red_light)); + // Read the current value from sysfs in case user wants to dismiss his changes mOriginalValue = Utils.readOneLine(FILE_PATH); - mOriginalPercent = strengthToPercent(Integer.parseInt(mOriginalValue)); + + // Restore percent value from SharedPreferences object + SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mContext); + int percent = settings.getInt("percent", strengthToPercent(DEFAULT_VALUE)); mSeekBar.setOnSeekBarChangeListener(this); - mSeekBar.setProgress(Integer.valueOf(mOriginalPercent)); + mSeekBar.setProgress(Integer.valueOf(percent)); } @Override @@ -132,13 +134,13 @@ public class VibratorTuningPreference extends DialogPreference implements SeekBa super.onDialogClosed(positiveResult); if (positiveResult) { - Editor editor = getEditor(); - - int strength = percentToStrength(mSeekBar.getProgress()); - editor.putString(FILE_PATH, String.valueOf(strength)); + // Store percent value in SharedPreferences object + SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mContext); + SharedPreferences.Editor editor = settings.edit(); + editor.putInt("percent", mSeekBar.getProgress()); editor.commit(); } else { - Utils.writeValue(FILE_PATH, String.valueOf(mOriginalPercent)); + Utils.writeValue(FILE_PATH, String.valueOf(mOriginalValue)); } } @@ -149,13 +151,15 @@ public class VibratorTuningPreference extends DialogPreference implements SeekBa return; } - final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - final String value = prefs.getString(FILE_PATH, null); + MAX_VALUE = Integer.valueOf(context.getResources().getString(R.string.intensity_max_value)); + DEFAULT_VALUE = Integer.valueOf(context.getResources().getString(R.string.intensity_default_value)); + MIN_VALUE = Integer.valueOf(context.getResources().getString(R.string.intensity_min_value)); - if (value != null) { - Log.d(TAG, "Restoring vibration setting: " + value); - Utils.writeValue(FILE_PATH, value); - } + SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); + int strength = percentToStrength(settings.getInt("percent", strengthToPercent(DEFAULT_VALUE))); + + Log.d(TAG, "Restoring vibration setting: " + strength); + Utils.writeValue(FILE_PATH, String.valueOf(strength)); } public static boolean isSupported(String filePath) { @@ -72,6 +72,7 @@ PRODUCT_PACKAGES := \ com.android.future.usb.accessory \ gralloc.exynos4 \ hwcomposer.exynos4 \ + libfimg \ libnetcmdiface \ libsecion \ libsync \ |