From 325722855f24fbc017a46d969adaf35c237fe805 Mon Sep 17 00:00:00 2001 From: Simon Shields Date: Fri, 18 Mar 2016 23:13:27 +1100 Subject: smdk4412-common: commonize AdvancedDisplay [3/3] Change-Id: Ie66ca09bccc5e651365c1fe0004ba81eaed823ba --- AdvancedDisplay/Android.mk | 15 -- AdvancedDisplay/AndroidManifest.xml | 33 --- .../res/drawable/ic_launcher_cmdevicesettings.png | Bin 11748 -> 0 bytes AdvancedDisplay/res/layout/seek_bar_preference.xml | 61 ------ AdvancedDisplay/res/layout/top.xml | 5 - AdvancedDisplay/res/values-de/arrays.xml | 40 ---- AdvancedDisplay/res/values-de/strings.xml | 28 --- AdvancedDisplay/res/values-es/arrays.xml | 38 ---- AdvancedDisplay/res/values-es/strings.xml | 26 --- AdvancedDisplay/res/values-fr/arrays.xml | 38 ---- AdvancedDisplay/res/values-fr/strings.xml | 26 --- AdvancedDisplay/res/values-hu/arrays.xml | 38 ---- AdvancedDisplay/res/values-hu/strings.xml | 26 --- AdvancedDisplay/res/values-nl/arrays.xml | 40 ---- AdvancedDisplay/res/values-nl/strings.xml | 28 --- AdvancedDisplay/res/values-pl/arrays.xml | 40 ---- AdvancedDisplay/res/values-pl/strings.xml | 25 --- AdvancedDisplay/res/values-pt-rBR/arrays.xml | 40 ---- AdvancedDisplay/res/values-pt-rBR/strings.xml | 25 --- AdvancedDisplay/res/values-ru/arrays.xml | 39 ---- AdvancedDisplay/res/values-ru/strings.xml | 25 --- AdvancedDisplay/res/values-zh-rCN/arrays.xml | 40 ---- AdvancedDisplay/res/values-zh-rCN/strings.xml | 25 --- AdvancedDisplay/res/values/arrays.xml | 106 ---------- AdvancedDisplay/res/values/config.xml | 58 ------ AdvancedDisplay/res/values/custom_attrs.xml | 27 --- AdvancedDisplay/res/values/strings.xml | 33 --- AdvancedDisplay/res/xml/screen_preferences.xml | 36 ---- .../settings/device/DisplaySettings.java | 162 --------------- .../settings/device/ScreenFragmentActivity.java | 79 ------- .../settings/device/SeekBarPreference.java | 226 --------------------- .../com/cyanogenmod/settings/device/Startup.java | 32 --- .../src/com/cyanogenmod/settings/device/Utils.java | 163 --------------- .../com/cyanogenmod/settings/device/mDNIeMode.java | 61 ------ .../cyanogenmod/settings/device/mDNIeNegative.java | 61 ------ .../cyanogenmod/settings/device/mDNIeScenario.java | 61 ------ 36 files changed, 1806 deletions(-) delete mode 100644 AdvancedDisplay/Android.mk delete mode 100644 AdvancedDisplay/AndroidManifest.xml delete mode 100755 AdvancedDisplay/res/drawable/ic_launcher_cmdevicesettings.png delete mode 100644 AdvancedDisplay/res/layout/seek_bar_preference.xml delete mode 100755 AdvancedDisplay/res/layout/top.xml delete mode 100644 AdvancedDisplay/res/values-de/arrays.xml delete mode 100644 AdvancedDisplay/res/values-de/strings.xml delete mode 100644 AdvancedDisplay/res/values-es/arrays.xml delete mode 100644 AdvancedDisplay/res/values-es/strings.xml delete mode 100644 AdvancedDisplay/res/values-fr/arrays.xml delete mode 100644 AdvancedDisplay/res/values-fr/strings.xml delete mode 100644 AdvancedDisplay/res/values-hu/arrays.xml delete mode 100644 AdvancedDisplay/res/values-hu/strings.xml delete mode 100644 AdvancedDisplay/res/values-nl/arrays.xml delete mode 100644 AdvancedDisplay/res/values-nl/strings.xml delete mode 100644 AdvancedDisplay/res/values-pl/arrays.xml delete mode 100644 AdvancedDisplay/res/values-pl/strings.xml delete mode 100644 AdvancedDisplay/res/values-pt-rBR/arrays.xml delete mode 100644 AdvancedDisplay/res/values-pt-rBR/strings.xml delete mode 100644 AdvancedDisplay/res/values-ru/arrays.xml delete mode 100644 AdvancedDisplay/res/values-ru/strings.xml delete mode 100644 AdvancedDisplay/res/values-zh-rCN/arrays.xml delete mode 100644 AdvancedDisplay/res/values-zh-rCN/strings.xml delete mode 100644 AdvancedDisplay/res/values/arrays.xml delete mode 100644 AdvancedDisplay/res/values/config.xml delete mode 100644 AdvancedDisplay/res/values/custom_attrs.xml delete mode 100644 AdvancedDisplay/res/values/strings.xml delete mode 100644 AdvancedDisplay/res/xml/screen_preferences.xml delete mode 100644 AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java delete mode 100644 AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java delete mode 100644 AdvancedDisplay/src/com/cyanogenmod/settings/device/SeekBarPreference.java delete mode 100644 AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java delete mode 100644 AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java delete mode 100644 AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java delete mode 100644 AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java delete mode 100644 AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java diff --git a/AdvancedDisplay/Android.mk b/AdvancedDisplay/Android.mk deleted file mode 100644 index f848efe..0000000 --- a/AdvancedDisplay/Android.mk +++ /dev/null @@ -1,15 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13 - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := AdvancedDisplay -LOCAL_CERTIFICATE := platform - -include $(BUILD_PACKAGE) - -include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/AdvancedDisplay/AndroidManifest.xml b/AdvancedDisplay/AndroidManifest.xml deleted file mode 100644 index bd470fa..0000000 --- a/AdvancedDisplay/AndroidManifest.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/AdvancedDisplay/res/drawable/ic_launcher_cmdevicesettings.png b/AdvancedDisplay/res/drawable/ic_launcher_cmdevicesettings.png deleted file mode 100755 index 9bfdd78..0000000 Binary files a/AdvancedDisplay/res/drawable/ic_launcher_cmdevicesettings.png and /dev/null differ diff --git a/AdvancedDisplay/res/layout/seek_bar_preference.xml b/AdvancedDisplay/res/layout/seek_bar_preference.xml deleted file mode 100644 index 38d9a1e..0000000 --- a/AdvancedDisplay/res/layout/seek_bar_preference.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/AdvancedDisplay/res/layout/top.xml b/AdvancedDisplay/res/layout/top.xml deleted file mode 100755 index 744b568..0000000 --- a/AdvancedDisplay/res/layout/top.xml +++ /dev/null @@ -1,5 +0,0 @@ - - diff --git a/AdvancedDisplay/res/values-de/arrays.xml b/AdvancedDisplay/res/values-de/arrays.xml deleted file mode 100644 index d3faa6a..0000000 --- a/AdvancedDisplay/res/values-de/arrays.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - CyanogenMod (Standard) - UI - Video - Video warm - Video kalt - Kamera - Navigation - Gallerie - VT - - - - Dynamisch (Standard) - Standard - Natürlich - Film - - - - Normal - Invertiert - - diff --git a/AdvancedDisplay/res/values-de/strings.xml b/AdvancedDisplay/res/values-de/strings.xml deleted file mode 100644 index 419f05c..0000000 --- a/AdvancedDisplay/res/values-de/strings.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Zurücksetzen - - Display - Farben - Szenario - Wähle das mDNIe Szenario - Modus - Wähle den mDNIe Modus - Negativ Modus - Invertiere Farben - - diff --git a/AdvancedDisplay/res/values-es/arrays.xml b/AdvancedDisplay/res/values-es/arrays.xml deleted file mode 100644 index 94c10b9..0000000 --- a/AdvancedDisplay/res/values-es/arrays.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CyanogenMod (por defecto) - UI - Vídeo - Vídeo cálido - Vídeo frío - Camara - Navegación - Galería - VT - - - Estándar (por defecto) - Dinámico - Natural - Película - - - Normal - Invertido - - diff --git a/AdvancedDisplay/res/values-es/strings.xml b/AdvancedDisplay/res/values-es/strings.xml deleted file mode 100644 index e7c1594..0000000 --- a/AdvancedDisplay/res/values-es/strings.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - Restablecer - Pantalla - Colores - Escenario - Establecer escenario mDNIe - Modo - Establecer modo mDNIe - Modo Negativo - Habilitar/deshabilitar colores invertidos - diff --git a/AdvancedDisplay/res/values-fr/arrays.xml b/AdvancedDisplay/res/values-fr/arrays.xml deleted file mode 100644 index 6983df7..0000000 --- a/AdvancedDisplay/res/values-fr/arrays.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CyanogenMod (Défaut) - UI - Vidéo - Vidéo chaude - Vidéo froide - Caméra - Navigation - Galerie - VT - - - Dynamique (Défaut) - Standard - Naturel - Vidéo - - - Normal - Inversé - - diff --git a/AdvancedDisplay/res/values-fr/strings.xml b/AdvancedDisplay/res/values-fr/strings.xml deleted file mode 100644 index 4e5e67c..0000000 --- a/AdvancedDisplay/res/values-fr/strings.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - Réinitialiser - Écran - Couleurs - Scénario - Définir le scénario mDNIe - Mode - Définir le mode mDNIe - Mode négatif - Activer/désactiver les couleurs inversées - diff --git a/AdvancedDisplay/res/values-hu/arrays.xml b/AdvancedDisplay/res/values-hu/arrays.xml deleted file mode 100644 index dae3a4c..0000000 --- a/AdvancedDisplay/res/values-hu/arrays.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CyanogenMod (Alapbeállítás) - Felhasználói felület - Videó - Videó (Meleg árnyalat) - Videó (Hideg árnyalat) - Kamera - Navigáció - Galéria - VT - - - Dinamikus (Alapbeállítás) - Hagyományos - Természetes - Film - - - Normál - Fordított - - diff --git a/AdvancedDisplay/res/values-hu/strings.xml b/AdvancedDisplay/res/values-hu/strings.xml deleted file mode 100644 index b8fcba6..0000000 --- a/AdvancedDisplay/res/values-hu/strings.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - Beállítások visszaállítása alaphelyzetbe - Kijelző - Színek - Megjelenítés - mDNIe megjelenítési beállítások - Üzemmód - mDNIe üzemmódok - Negatív üzemmód - Fordított színek ki/be - diff --git a/AdvancedDisplay/res/values-nl/arrays.xml b/AdvancedDisplay/res/values-nl/arrays.xml deleted file mode 100644 index d0baeed..0000000 --- a/AdvancedDisplay/res/values-nl/arrays.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - CyanogenMod (standaard) - Uiterlijk - Video - Video (warm) - Video (koud) - Camera - Navigatie - Galerij - VT - - - - Dynamisch (standaard) - Standaard - Natuurlijk - Film - - - - Normaal - Omgedraaid - - diff --git a/AdvancedDisplay/res/values-nl/strings.xml b/AdvancedDisplay/res/values-nl/strings.xml deleted file mode 100644 index eafc3a5..0000000 --- a/AdvancedDisplay/res/values-nl/strings.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Standaardwaarden - - Scherm - Kleuren - - Scenario - mDNIe-scenario instellen - Modus - mDNIe-modus instellen - Negatieve modus - Negatieve kleuren in-/uitschakelen - diff --git a/AdvancedDisplay/res/values-pl/arrays.xml b/AdvancedDisplay/res/values-pl/arrays.xml deleted file mode 100644 index 30274f2..0000000 --- a/AdvancedDisplay/res/values-pl/arrays.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - CyanogenMod (domyślnie) - UI - Wideo - Ciepły film - Zimny film - Kamera - Nawigacja - Galeria - VT - - - - Dynamicznie (domyślnie) - Standardowo - Naturalnie - Film - - - - Normalnie - Odwrócony - - diff --git a/AdvancedDisplay/res/values-pl/strings.xml b/AdvancedDisplay/res/values-pl/strings.xml deleted file mode 100644 index 06ad53b..0000000 --- a/AdvancedDisplay/res/values-pl/strings.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - Ekran - Kolory - Technologia mDNIe - Ustaw scenariusz mDNIe - Tryb - Ustaw tryb mDNIe - Tryb negatywu - Włącz/wyłącz odwrócone kolory - diff --git a/AdvancedDisplay/res/values-pt-rBR/arrays.xml b/AdvancedDisplay/res/values-pt-rBR/arrays.xml deleted file mode 100644 index 77a51d2..0000000 --- a/AdvancedDisplay/res/values-pt-rBR/arrays.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - CyanogenMod (Padrão) - IU - Vídeo - Vídeo Quente - Vídeo Frio - Câmera - Navegação - Galeria - VT - - - - Padrão - Dinâmico - Natural - Filme - - - - Normal - Invertido - - diff --git a/AdvancedDisplay/res/values-pt-rBR/strings.xml b/AdvancedDisplay/res/values-pt-rBR/strings.xml deleted file mode 100644 index 76487b3..0000000 --- a/AdvancedDisplay/res/values-pt-rBR/strings.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - Tela - Cores - Cenário - Define o Cenário mDNIe - Modo - Define o Modo mDNIe - Modo Negativo - Ativar/Desativar cores invertidas - diff --git a/AdvancedDisplay/res/values-ru/arrays.xml b/AdvancedDisplay/res/values-ru/arrays.xml deleted file mode 100644 index a32bc26..0000000 --- a/AdvancedDisplay/res/values-ru/arrays.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - CyanogenMod (По умолч.) - Видео - Видео (тёпл.) - Видео (хол.) - Камера - Навигация - Галерея - VT - - - - Динамический (По умолч.) - Стандартный - Натуральный - Кино - - - - Нормально - Инверсия - - diff --git a/AdvancedDisplay/res/values-ru/strings.xml b/AdvancedDisplay/res/values-ru/strings.xml deleted file mode 100644 index 9cabd97..0000000 --- a/AdvancedDisplay/res/values-ru/strings.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - Экран - Цвета - Сценарий - Установка сценария mDNIe - Режим - Установка режима mDNIe - Негатив - Вкл./выкл. инверсии цветов - diff --git a/AdvancedDisplay/res/values-zh-rCN/arrays.xml b/AdvancedDisplay/res/values-zh-rCN/arrays.xml deleted file mode 100644 index 8b295c4..0000000 --- a/AdvancedDisplay/res/values-zh-rCN/arrays.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - CyanogenMod (默认) - 界面 - 影片 - 影片 (温) - 影片 (冷) - 相机 - 导航 - 图库 - VT - - - - 动态 (默认) - 标准 - 自然 - 电影 - - - - 正常 - 反色 - - diff --git a/AdvancedDisplay/res/values-zh-rCN/strings.xml b/AdvancedDisplay/res/values-zh-rCN/strings.xml deleted file mode 100644 index b5ee6f6..0000000 --- a/AdvancedDisplay/res/values-zh-rCN/strings.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - 屏幕 - 颜色 - 场景 - 设置 mDNIe 场景 - 模式 - 设置 mDNIe 模式 - 负极模式 - 启用/禁用反色 - diff --git a/AdvancedDisplay/res/values/arrays.xml b/AdvancedDisplay/res/values/arrays.xml deleted file mode 100644 index cff1afa..0000000 --- a/AdvancedDisplay/res/values/arrays.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - CyanogenMod (Default) - UI - Video - Video Warm - Video Cold - Camera - Navigation - Gallery - VT - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - - - - Dynamic (Default) - Standard - Natural - Movie - - - - 0 - 1 - 2 - 3 - - - - Normal - Inverted - - - - 0 - 1 - - - - Never - 1 second - 2 seconds - 3 seconds (Default) - 4 seconds - 5 seconds - 6 seconds - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - - - - Blinking - Fading - - - - 0 - 1 - - - - UMTS Only - HSDPA Only - HSDPA + HSUPA - - - - 21 - 22 - 23 - - diff --git a/AdvancedDisplay/res/values/config.xml b/AdvancedDisplay/res/values/config.xml deleted file mode 100644 index 5e4be8f..0000000 --- a/AdvancedDisplay/res/values/config.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - true - "/sys/vibrator/pwm_val" - 100 - 75 - 50 - 0 - - - "/sys/class/sec/sec_epen" - "/sys/class/sec/sec_epen/epen_saving_mode" - - - false - false - - 10 - 9 - 5 - 1 - 63 - 60 - 50 - 0 - - - true - - - true - - - "/sys/class/lcd/panel/power_reduce" - "/sys/class/mdnie/mdnie/scenario" - "/sys/class/mdnie/mdnie/mode" - "/sys/class/mdnie/mdnie/negative" - - diff --git a/AdvancedDisplay/res/values/custom_attrs.xml b/AdvancedDisplay/res/values/custom_attrs.xml deleted file mode 100644 index b856986..0000000 --- a/AdvancedDisplay/res/values/custom_attrs.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/AdvancedDisplay/res/values/strings.xml b/AdvancedDisplay/res/values/strings.xml deleted file mode 100644 index d7438f4..0000000 --- a/AdvancedDisplay/res/values/strings.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - Advanced Display - - Reset to default - - - Screen - Colors - - - Scenario - Set the mDNIe Scenario - Mode - Set the mDNIe Mode - Negative Mode - Enable/Disable inverted colors - - diff --git a/AdvancedDisplay/res/xml/screen_preferences.xml b/AdvancedDisplay/res/xml/screen_preferences.xml deleted file mode 100644 index 56e536c..0000000 --- a/AdvancedDisplay/res/xml/screen_preferences.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java deleted file mode 100644 index d838c31..0000000 --- a/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -package com.cyanogenmod.settings.device; - -import android.app.ActionBar; -import android.app.ActionBar.Tab; -import android.app.Activity; -import android.app.Fragment; -import android.app.FragmentTransaction; -import android.content.Context; -import android.os.Bundle; -import android.support.v4.app.FragmentActivity; -import android.support.v13.app.FragmentPagerAdapter; -import android.support.v4.view.ViewPager; -import android.view.MenuItem; - -import com.cyanogenmod.settings.device.R; - -import java.util.ArrayList; - -public class DisplaySettings extends FragmentActivity { - - public static final String SHARED_PREFERENCES_BASENAME = "com.cyanogenmod.settings.device"; - public static final String ACTION_UPDATE_PREFERENCES = "com.cyanogenmod.settings.device.UPDATE"; - public static final String KEY_CABC = "cabc"; - public static final String KEY_MDNIE_SCENARIO = "mdnie_scenario"; - public static final String KEY_MDNIE_MODE = "mdnie_mode"; - public static final String KEY_MDNIE_NEGATIVE = "mdnie_negative"; - public static final String KEY_LED_FADE = "led_fade"; - public static final String KEY_TOUCHKEY_LIGHT = "touchkey_light"; - public static final String KEY_TOUCHKEY_TIMEOUT = "touchkey_timeout"; - public static final String KEY_HSPA = "hspa"; - public static final String KEY_USE_DOCK_AUDIO = "dock_audio"; - public static final String KEY_CATEGORY_SPEN = "category_spen"; - public static final String KEY_SPEN_POWER_SAVING_MODE = "spen_power_saving"; - - ViewPager mViewPager; - TabsAdapter mTabsAdapter; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - mViewPager = new ViewPager(this); - mViewPager.setId(R.id.viewPager); - setContentView(mViewPager); - - final ActionBar bar = getActionBar(); - bar.setTitle(R.string.app_name); - bar.setDisplayHomeAsUpEnabled(true); - - mTabsAdapter = new TabsAdapter(this, mViewPager); - mTabsAdapter.addTab(bar.newTab().setText(R.string.category_screen_title), - ScreenFragmentActivity.class, null); - - if (savedInstanceState != null) { - bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); - } - } - - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - outState.putInt("tab", getActionBar().getSelectedNavigationIndex()); - } - - public static class TabsAdapter extends FragmentPagerAdapter - implements ActionBar.TabListener, ViewPager.OnPageChangeListener { - private final Context mContext; - private final ActionBar mActionBar; - private final ViewPager mViewPager; - private final ArrayList mTabs = new ArrayList(); - - static final class TabInfo { - private final Class clss; - private final Bundle args; - - TabInfo(Class _class, Bundle _args) { - clss = _class; - args = _args; - } - } - - public TabsAdapter(Activity activity, ViewPager pager) { - super(activity.getFragmentManager()); - mContext = activity; - mActionBar = activity.getActionBar(); - mViewPager = pager; - mViewPager.setAdapter(this); - mViewPager.setOnPageChangeListener(this); - } - - public void addTab(ActionBar.Tab tab, Class clss, Bundle args) { - TabInfo info = new TabInfo(clss, args); - tab.setTag(info); - tab.setTabListener(this); - mTabs.add(info); - mActionBar.addTab(tab); - notifyDataSetChanged(); - } - - @Override - public int getCount() { - return mTabs.size(); - } - - @Override - public Fragment getItem(int position) { - TabInfo info = mTabs.get(position); - return Fragment.instantiate(mContext, info.clss.getName(), info.args); - } - - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - } - - public void onPageSelected(int position) { - mActionBar.setSelectedNavigationItem(position); - } - - public void onPageScrollStateChanged(int state) { - } - - public void onTabSelected(Tab tab, FragmentTransaction ft) { - Object tag = tab.getTag(); - for (int i=0; i mMaxValue) - newValue = mMaxValue; - else if(newValue < mMinValue) - newValue = mMinValue; - else if(mInterval != 1 && newValue % mInterval != 0) - newValue = Math.round(((float)newValue)/mInterval)*mInterval; - - // change rejected, revert to the previous value - if(!callChangeListener(newValue)){ - seekBar.setProgress(mCurrentValue - mMinValue); - return; - } - // change accepted, store it - mCurrentValue = newValue; - mStatusText.setText(String.valueOf(newValue)); - persistInt(newValue); - } - - @Override - public void onStartTrackingTouch(SeekBar seekBar) {} - - @Override - public void onStopTrackingTouch(SeekBar seekBar) { - notifyChanged(); - } - - @Override - protected Object onGetDefaultValue(TypedArray ta, int index){ - int defaultValue = ta.getInt(index, DEFAULT_VALUE); - return defaultValue; - } - - @Override - protected void onSetInitialValue(boolean restoreValue, Object defaultValue) { - if(restoreValue) { - mCurrentValue = getPersistedInt(mCurrentValue); - } - else { - int temp = 0; - try { - temp = (Integer)defaultValue; - } - catch(Exception ex) { - Log.e(TAG, "Invalid default value: " + defaultValue.toString()); - } - persistInt(temp); - mCurrentValue = temp; - } - } - - public void setValue(int value) { - mCurrentValue = value; - } -} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java deleted file mode 100644 index 2bada88..0000000 --- a/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -package com.cyanogenmod.settings.device; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -public class Startup extends BroadcastReceiver { - - @Override - public void onReceive(final Context context, final Intent bootintent) { - mDNIeScenario.restore(context); - mDNIeMode.restore(context); - mDNIeNegative.restore(context); - ScreenFragmentActivity.restore(context); - } -} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java deleted file mode 100644 index 4ca2e9e..0000000 --- a/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -package com.cyanogenmod.settings.device; - -import android.util.Log; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.SyncFailedException; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Context; - -public class Utils { - - private static final String TAG = "DeviceSettings_Utils"; - private static final String TAG_READ = "DeviceSettings_Utils_Read"; - private static final String TAG_WRITE = "DeviceSettings_Utils_Write"; - - // Read value from sysfs interface - public static String readOneLine(String sFile) { - BufferedReader brBuffer; - String sLine = null; - - try { - brBuffer = new BufferedReader(new FileReader(sFile), 512); - try { - sLine = brBuffer.readLine(); - } finally { - Log.w(TAG_READ, "file " + sFile + ": " + sLine); - brBuffer.close(); - } - } catch (Exception e) { - Log.e(TAG_READ, "IO Exception when reading /sys/ file", e); - } - return sLine; - } - - /** - * Write a string value to the specified file. - * - * @param filename The filename - * @param value The value - */ - public static void writeValue(String filename, String value) { - FileOutputStream fos = null; - try { - fos = new FileOutputStream(new File(filename), false); - fos.write(value.getBytes()); - fos.flush(); - // fos.getFD().sync(); - } catch (FileNotFoundException ex) { - Log.w(TAG, "file " + filename + " not found: " + ex); - } catch (SyncFailedException ex) { - Log.w(TAG, "file " + filename + " sync failed: " + ex); - } catch (IOException ex) { - Log.w(TAG, "IOException trying to sync " + filename + ": " + ex); - } catch (RuntimeException ex) { - Log.w(TAG, "exception while syncing file: ", ex); - } finally { - if (fos != null) { - try { - Log.w(TAG_WRITE, "file " + filename + ": " + value); - fos.close(); - } catch (IOException ex) { - Log.w(TAG, "IOException while closing synced file: ", ex); - } catch (RuntimeException ex) { - Log.w(TAG, "exception while closing file: ", ex); - } - } - } - - } - - /** - * Write a string value to the specified file. - * - * @param filename The filename - * @param value The value - */ - public static void writeValue(String filename, Boolean value) { - FileOutputStream fos = null; - String sEnvia; - try { - fos = new FileOutputStream(new File(filename), false); - if (value) - sEnvia = "1"; - else - sEnvia = "0"; - fos.write(sEnvia.getBytes()); - fos.flush(); - // fos.getFD().sync(); - } catch (FileNotFoundException ex) { - Log.w(TAG, "file " + filename + " not found: " + ex); - } catch (SyncFailedException ex) { - Log.w(TAG, "file " + filename + " sync failed: " + ex); - } catch (IOException ex) { - Log.w(TAG, "IOException trying to sync " + filename + ": " + ex); - } catch (RuntimeException ex) { - Log.w(TAG, "exception while syncing file: ", ex); - } finally { - if (fos != null) { - try { - Log.w(TAG_WRITE, "file " + filename + ": " + value); - fos.close(); - } catch (IOException ex) { - Log.w(TAG, "IOException while closing synced file: ", ex); - } catch (RuntimeException ex) { - Log.w(TAG, "exception while closing file: ", ex); - } - } - } - } - - /** - * Write the "color value" to the specified file. The value is scaled from - * an integer to an unsigned integer by multiplying by 2. - * @param filename The filename - * @param value The value of max value Integer.MAX - */ - public static void writeColor(String filename, int value) { - writeValue(filename, String.valueOf((long) value * 2)); - } - - /** - * Check if the specified file exists. - * @param filename The filename - * @return Whether the file exists or not - */ - public static boolean fileExists(String filename) { - return new File(filename).exists(); - } - - public static void showDialog(Context ctx, String title, String message) { - final AlertDialog alertDialog = new AlertDialog.Builder(ctx).create(); - alertDialog.setTitle(title); - alertDialog.setMessage(message); - alertDialog.setButton("OK", new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - alertDialog.dismiss(); - } - }); - alertDialog.show(); - } -} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java deleted file mode 100644 index c777d72..0000000 --- a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -package com.cyanogenmod.settings.device; - -import android.content.Context; - -import android.content.SharedPreferences; -import android.util.AttributeSet; -import android.preference.Preference; -import android.preference.ListPreference; -import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceManager; - -public class mDNIeMode extends ListPreference implements OnPreferenceChangeListener { - - private static String FILE = null; - - public mDNIeMode(Context context, AttributeSet attrs) { - super(context, attrs); - this.setOnPreferenceChangeListener(this); - FILE = context.getResources().getString(R.string.mdnie_mode_sysfs_file); - } - - public static boolean isSupported(String filePath) { - return Utils.fileExists(filePath); - } - - /** - * Restore mdnie user mode setting from SharedPreferences. (Write to kernel.) - * @param context The context to read the SharedPreferences from - */ - public static void restore(Context context) { - FILE = context.getResources().getString(R.string.mdnie_mode_sysfs_file); - if (!isSupported(FILE)) { - return; - } - - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_MODE, "0")); - } - - public boolean onPreferenceChange(Preference preference, Object newValue) { - Utils.writeValue(FILE, (String) newValue); - return true; - } - -} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java deleted file mode 100644 index bde9946..0000000 --- a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -package com.cyanogenmod.settings.device; - -import java.io.IOException; -import android.content.Context; -import android.util.AttributeSet; -import android.content.SharedPreferences; -import android.preference.Preference; -import android.preference.ListPreference; -import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceManager; - -public class mDNIeNegative extends ListPreference implements OnPreferenceChangeListener { - - private static String FILE = null; - - public mDNIeNegative(Context context, AttributeSet attrs) { - super(context, attrs); - this.setOnPreferenceChangeListener(this); - FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file); - } - - public static boolean isSupported(String filePath) { - return Utils.fileExists(filePath); - } - - /** - * Restore mdnie user mode setting from SharedPreferences. (Write to kernel.) - * @param context The context to read the SharedPreferences from - */ - public static void restore(Context context) { - FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file); - if (!isSupported(FILE)) { - return; - } - - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_NEGATIVE, "0")); - } - - public boolean onPreferenceChange(Preference preference, Object newValue) { - Utils.writeValue(FILE, (String) newValue); - return true; - } - -} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java deleted file mode 100644 index cbab69d..0000000 --- a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -package com.cyanogenmod.settings.device; - -import android.content.Context; - -import android.content.SharedPreferences; -import android.util.AttributeSet; -import android.preference.Preference; -import android.preference.ListPreference; -import android.preference.Preference.OnPreferenceChangeListener; -import android.preference.PreferenceManager; - -public class mDNIeScenario extends ListPreference implements OnPreferenceChangeListener { - - private static String FILE = null; - - public mDNIeScenario(Context context, AttributeSet attrs) { - super(context,attrs); - this.setOnPreferenceChangeListener(this); - FILE = context.getResources().getString(R.string.mdnie_scenario_sysfs_file); - } - - public static boolean isSupported(String filePath) { - return Utils.fileExists(filePath); - } - - /** - * Restore mdnie "camera" setting from SharedPreferences. (Write to kernel.) - * @param context The context to read the SharedPreferences from - */ - public static void restore(Context context) { - FILE = context.getResources().getString(R.string.mdnie_scenario_sysfs_file); - if (!isSupported(FILE)) { - return; - } - - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_SCENARIO, "0")); - } - - public boolean onPreferenceChange(Preference preference, Object newValue) { - Utils.writeValue(FILE, (String) newValue); - return true; - } - -} -- cgit v1.1