diff options
Diffstat (limited to 'AdvancedDisplay/src/com/cyanogenmod')
8 files changed, 0 insertions, 845 deletions
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<TabInfo> mTabs = new ArrayList<TabInfo>(); - - 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<mTabs.size(); i++) { - if (mTabs.get(i) == tag) { - mViewPager.setCurrentItem(i); - } - } - } - - public void onTabUnselected(Tab tab, FragmentTransaction ft) { - } - - public void onTabReselected(Tab tab, FragmentTransaction ft) { - } - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: - DisplaySettings.this.onBackPressed(); - default: - return super.onOptionsItemSelected(item); - } - } -} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java deleted file mode 100644 index 7b64a4f..0000000 --- a/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java +++ /dev/null @@ -1,79 +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.res.Resources; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.preference.CheckBoxPreference; -import android.preference.ListPreference; -import android.preference.Preference; -import android.preference.PreferenceActivity; -import android.preference.PreferenceCategory; -import android.preference.PreferenceFragment; -import android.preference.PreferenceManager; -import android.preference.PreferenceScreen; -import android.util.Log; - -import com.cyanogenmod.settings.device.R; - -public class ScreenFragmentActivity extends PreferenceFragment { - - private static final String PREF_ENABLED = "1"; - private static final String TAG = "DisplaySettings_Screen"; - private mDNIeScenario mmDNIeScenario; - private mDNIeMode mmDNIeMode; - private mDNIeNegative mmDNIeNegative; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.screen_preferences); - PreferenceScreen preferenceScreen = getPreferenceScreen(); - Resources res = getResources(); - - /* mDNIe */ - mmDNIeScenario = (mDNIeScenario) findPreference(DisplaySettings.KEY_MDNIE_SCENARIO); - mmDNIeScenario.setEnabled(mDNIeScenario.isSupported(res.getString(R.string.mdnie_scenario_sysfs_file))); - - mmDNIeMode = (mDNIeMode) findPreference(DisplaySettings.KEY_MDNIE_MODE); - mmDNIeMode.setEnabled(mDNIeMode.isSupported(res.getString(R.string.mdnie_mode_sysfs_file))); - - mmDNIeNegative = (mDNIeNegative) findPreference(DisplaySettings.KEY_MDNIE_NEGATIVE); - mmDNIeNegative.setEnabled(mDNIeNegative.isSupported(res.getString(R.string.mdnie_negative_sysfs_file))); - - } - - @Override - public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { - - String key = preference.getKey(); - Log.w(TAG, "key: " + key); - - return true; - } - - public static boolean isSupported(String FILE) { - return Utils.fileExists(FILE); - } - - public static void restore(Context context) { - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - } -} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/SeekBarPreference.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/SeekBarPreference.java deleted file mode 100644 index 9f614c8..0000000 --- a/AdvancedDisplay/src/com/cyanogenmod/settings/device/SeekBarPreference.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (C) 2013 The ChameleonOS 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.res.TypedArray; -import android.preference.Preference; -import android.util.AttributeSet; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewParent; -import android.widget.RelativeLayout; -import android.widget.SeekBar; -import android.widget.SeekBar.OnSeekBarChangeListener; -import android.widget.TextView; - -import com.cyanogenmod.settings.device.R; - -public class SeekBarPreference extends Preference implements OnSeekBarChangeListener { - - private final String TAG = getClass().getName(); - - private static final String ANDROIDNS = "http://schemas.android.com/apk/res/android"; - private static final String ADVANCEDDISPLAY = "http://schemas.android.com/apk/res/com.cyanogenmod.settings.device"; - private static final int DEFAULT_VALUE = 50; - - private int mMaxValue = 100; - private int mMinValue = 0; - private int mInterval = 1; - private int mCurrentValue; - private String mUnitsLeft = ""; - private String mUnitsRight = ""; - private SeekBar mSeekBar; - private TextView mTitle; - - private TextView mStatusText; - - public SeekBarPreference(Context context, AttributeSet attrs) { - super(context, attrs); - initPreference(context, attrs); - } - - public SeekBarPreference(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - initPreference(context, attrs); - } - - private void initPreference(Context context, AttributeSet attrs) { - setValuesFromXml(attrs); - mSeekBar = new SeekBar(context, attrs); - mSeekBar.setMax(mMaxValue - mMinValue); - mSeekBar.setOnSeekBarChangeListener(this); - } - - private void setValuesFromXml(AttributeSet attrs) { - mMaxValue = attrs.getAttributeIntValue(ANDROIDNS, "max", 100); - mMinValue = attrs.getAttributeIntValue(ADVANCEDDISPLAY, "min", 0); - mUnitsLeft = getAttributeStringValue(attrs, ADVANCEDDISPLAY, "unitsLeft", ""); - String units = getAttributeStringValue(attrs, ADVANCEDDISPLAY, "units", ""); - mUnitsRight = getAttributeStringValue(attrs, ADVANCEDDISPLAY, "unitsRight", units); - try { - String newInterval = attrs.getAttributeValue(ADVANCEDDISPLAY, "interval"); - if(newInterval != null) - mInterval = Integer.parseInt(newInterval); - } - catch(Exception e) { - Log.e(TAG, "Invalid interval value", e); - } - } - - private String getAttributeStringValue(AttributeSet attrs, String namespace, String name, String defaultValue) { - String value = attrs.getAttributeValue(namespace, name); - if(value == null) - value = defaultValue; - - return value; - } - - @Override - public void onDependencyChanged(Preference dependency, boolean disableDependent) { - super.onDependencyChanged(dependency, disableDependent); - this.setShouldDisableView(true); - if (mTitle != null) - mTitle.setEnabled(!disableDependent); - if (mSeekBar != null) - mSeekBar.setEnabled(!disableDependent); - } - - @Override - protected View onCreateView(ViewGroup parent){ - - RelativeLayout layout = null; - try { - LayoutInflater mInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); - layout = (RelativeLayout)mInflater.inflate(R.layout.seek_bar_preference, parent, false); - mTitle = (TextView) layout.findViewById(android.R.id.title); - } - catch(Exception e) - { - Log.e(TAG, "Error creating seek bar preference", e); - } - return layout; - } - - @Override - public void onBindView(View view) { - super.onBindView(view); - try - { - // move our seekbar to the new view we've been given - ViewParent oldContainer = mSeekBar.getParent(); - ViewGroup newContainer = (ViewGroup) view.findViewById(R.id.seekBarPrefBarContainer); - - if (oldContainer != newContainer) { - // remove the seekbar from the old view - if (oldContainer != null) { - ((ViewGroup) oldContainer).removeView(mSeekBar); - } - // remove the existing seekbar (there may not be one) and add ours - newContainer.removeAllViews(); - newContainer.addView(mSeekBar, ViewGroup.LayoutParams.FILL_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT); - } - } - catch(Exception ex) { - Log.e(TAG, "Error binding view: " + ex.toString()); - } - updateView(view); - } - - /** - * Update a SeekBarPreference view with our current state - * @param view - */ - protected void updateView(View view) { - - try { - RelativeLayout layout = (RelativeLayout)view; - mStatusText = (TextView)layout.findViewById(R.id.seekBarPrefValue); - mStatusText.setText(String.valueOf(mCurrentValue)); - mStatusText.setMinimumWidth(30); - mSeekBar.setProgress(mCurrentValue - mMinValue); - - TextView unitsRight = (TextView)layout.findViewById(R.id.seekBarPrefUnitsRight); - unitsRight.setText(mUnitsRight); - TextView unitsLeft = (TextView)layout.findViewById(R.id.seekBarPrefUnitsLeft); - unitsLeft.setText(mUnitsLeft); - } - catch(Exception e) { - Log.e(TAG, "Error updating seek bar preference", e); - } - } - - @Override - public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { - int newValue = progress + mMinValue; - if(newValue > 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; - } - -} |