use of android.support.v7.preference.ListPreference in project android_packages_apps_crDroidSettings by crdroidandroid.
the class BatteryBar method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.battery_bar);
PreferenceScreen prefSet = getPreferenceScreen();
ContentResolver resolver = getActivity().getContentResolver();
int intColor;
String hexColor;
mBatteryBar = (ListPreference) prefSet.findPreference(PREF_BATT_BAR);
mBatteryBar.setValue((Settings.System.getIntForUser(resolver, Settings.System.STATUSBAR_BATTERY_BAR, 0, UserHandle.USER_CURRENT)) + "");
mBatteryBar.setSummary(mBatteryBar.getEntry());
mBatteryBar.setOnPreferenceChangeListener(this);
mBatteryBarNoNavbar = (ListPreference) prefSet.findPreference(PREF_BATT_BAR_NO_NAVBAR);
mBatteryBarNoNavbar.setValue((Settings.System.getIntForUser(resolver, Settings.System.STATUSBAR_BATTERY_BAR, 0, UserHandle.USER_CURRENT)) + "");
mBatteryBarNoNavbar.setSummary(mBatteryBarNoNavbar.getEntry());
mBatteryBarNoNavbar.setOnPreferenceChangeListener(this);
mBatteryBarStyle = (ListPreference) prefSet.findPreference(PREF_BATT_BAR_STYLE);
mBatteryBarStyle.setValue((Settings.System.getIntForUser(resolver, Settings.System.STATUSBAR_BATTERY_BAR_STYLE, 0, UserHandle.USER_CURRENT)) + "");
mBatteryBarStyle.setSummary(mBatteryBarStyle.getEntry());
mBatteryBarStyle.setOnPreferenceChangeListener(this);
mBatteryBarColor = (ColorPickerPreference) prefSet.findPreference(PREF_BATT_BAR_COLOR);
intColor = Settings.System.getIntForUser(resolver, Settings.System.STATUSBAR_BATTERY_BAR_COLOR, 0xff76c124, UserHandle.USER_CURRENT);
hexColor = ColorPickerPreference.convertToARGB(intColor);
mBatteryBarColor.setNewPreviewColor(intColor);
mBatteryBarColor.setSummary(hexColor);
mBatteryBarColor.setOnPreferenceChangeListener(this);
mBatteryBarChargingColor = (ColorPickerPreference) prefSet.findPreference(PREF_BATT_BAR_CHARGING_COLOR);
intColor = Settings.System.getIntForUser(resolver, Settings.System.STATUSBAR_BATTERY_BAR_CHARGING_COLOR, 0xffffc90f, UserHandle.USER_CURRENT);
hexColor = ColorPickerPreference.convertToARGB(intColor);
mBatteryBarChargingColor.setNewPreviewColor(intColor);
mBatteryBarChargingColor.setSummary(hexColor);
mBatteryBarChargingColor.setEnabled(Settings.System.getIntForUser(resolver, Settings.System.STATUSBAR_BATTERY_BAR_ENABLE_CHARGING_COLOR, 1, UserHandle.USER_CURRENT) == 1);
mBatteryBarChargingColor.setOnPreferenceChangeListener(this);
mBatteryBarBatteryLowColor = (ColorPickerPreference) prefSet.findPreference(PREF_BATT_BAR_BATTERY_LOW_COLOR);
intColor = Settings.System.getIntForUser(resolver, Settings.System.STATUSBAR_BATTERY_BAR_BATTERY_LOW_COLOR, 0xfff90028, UserHandle.USER_CURRENT);
hexColor = ColorPickerPreference.convertToARGB(intColor);
mBatteryBarBatteryLowColor.setNewPreviewColor(intColor);
mBatteryBarBatteryLowColor.setSummary(hexColor);
mBatteryBarBatteryLowColor.setOnPreferenceChangeListener(this);
mBatteryBarChargingAnimation = (SwitchPreference) prefSet.findPreference(PREF_BATT_ANIMATE);
mBatteryBarThickness = (CustomSeekBarPreference) prefSet.findPreference(PREF_BATT_BAR_WIDTH);
mBatteryBarThickness.setValue(Settings.System.getIntForUser(resolver, Settings.System.STATUSBAR_BATTERY_BAR_THICKNESS, 2, UserHandle.USER_CURRENT));
mBatteryBarThickness.setOnPreferenceChangeListener(this);
mBatteryBarUseChargingColor = (SwitchPreference) findPreference(PREF_BATT_USE_CHARGING_COLOR);
mBatteryBarUseChargingColor.setOnPreferenceChangeListener(this);
mBatteryBarBlendColor = (SwitchPreference) findPreference(PREF_BATT_BLEND_COLOR);
mBatteryBarBlendColorReverse = (SwitchPreference) findPreference(PREF_BATT_BLEND_COLOR_REVERSE);
/*
boolean hasNavBarByDefault = getResources().getBoolean(
com.android.internal.R.bool.config_showNavigationBar);
boolean enableNavigationBar = Settings.Secure.getIntForUser(resolver,
Settings.Secure.NAVIGATION_BAR_VISIBLE, hasNavBarByDefault ? 1 : 0, UserHandle.USER_CURRENT) == 1;
boolean batteryBarSupported = Settings.Secure.getIntForUser(resolver,
Settings.Secure.NAVIGATION_BAR_MODE, 0, UserHandle.USER_CURRENT) == 0;
if (!enableNavigationBar || !batteryBarSupported) {
*/
prefSet.removePreference(mBatteryBar);
/*
} else {
prefSet.removePreference(mBatteryBarNoNavbar);
}
*/
updateBatteryBarOptions();
}
use of android.support.v7.preference.ListPreference in project android_packages_apps_crDroidSettings by crdroidandroid.
the class OmniJaws method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.omnijaws_settings);
final PreferenceScreen prefScreen = getPreferenceScreen();
mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.weather_icon_pack_note);
mWeatherCategory = (PreferenceCategory) prefScreen.findPreference(CATEGORY_WEATHER);
if (mWeatherCategory != null && !isOmniJawsServiceInstalled()) {
prefScreen.removePreference(mWeatherCategory);
} else {
mWeatherIconPack = (ListPreference) findPreference(WEATHER_ICON_PACK);
String settingHeaderPackage = Settings.System.getStringForUser(getContentResolver(), Settings.System.OMNIJAWS_WEATHER_ICON_PACK, UserHandle.USER_CURRENT);
if (settingHeaderPackage == null) {
settingHeaderPackage = DEFAULT_WEATHER_ICON_PACKAGE + "." + DEFAULT_WEATHER_ICON_PREFIX;
}
List<String> entries = new ArrayList<String>();
List<String> values = new ArrayList<String>();
getAvailableWeatherIconPacks(entries, values);
mWeatherIconPack.setEntries(entries.toArray(new String[entries.size()]));
mWeatherIconPack.setEntryValues(values.toArray(new String[values.size()]));
int valueIndex = mWeatherIconPack.findIndexOfValue(settingHeaderPackage);
if (valueIndex == -1) {
// no longer found
settingHeaderPackage = DEFAULT_WEATHER_ICON_PACKAGE + "." + DEFAULT_WEATHER_ICON_PREFIX;
valueIndex = mWeatherIconPack.findIndexOfValue(settingHeaderPackage);
}
mWeatherIconPack.setValueIndex(valueIndex >= 0 ? valueIndex : 0);
mWeatherIconPack.setSummary(mWeatherIconPack.getEntry());
mWeatherIconPack.setOnPreferenceChangeListener(this);
}
}
use of android.support.v7.preference.ListPreference in project android_packages_apps_crDroidSettings by crdroidandroid.
the class Pulse method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pulse_settings);
ContentResolver resolver = getActivity().getContentResolver();
mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.pulse_help_policy_notice_summary);
mShowPulse = (SwitchPreference) findPreference("eos_fling_show_pulse");
mShowPulse.setChecked(Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_PULSE_ENABLED, 0, UserHandle.USER_CURRENT) == 1);
mShowPulse.setOnPreferenceChangeListener(this);
int renderMode = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_RENDER_STYLE_URI, RENDER_STYLE_SOLID_LINES, UserHandle.USER_CURRENT);
mRenderMode = (ListPreference) findPreference("pulse_render_mode");
mRenderMode.setValue(String.valueOf(renderMode));
mRenderMode.setOnPreferenceChangeListener(this);
mAutoColor = (SwitchPreference) findPreference("pulse_auto_color");
mAutoColor.setChecked(Settings.Secure.getIntForUser(getContentResolver(), Settings.Secure.PULSE_AUTO_COLOR, 0, UserHandle.USER_CURRENT) == 1);
mAutoColor.setOnPreferenceChangeListener(this);
PreferenceCategory fadingBarsCat = (PreferenceCategory) findPreference("pulse_fading_bars_category");
fadingBarsCat.setEnabled(renderMode == RENDER_STYLE_FADING_BARS);
PreferenceCategory solidBarsCat = (PreferenceCategory) findPreference("pulse_2");
solidBarsCat.setEnabled(renderMode == RENDER_STYLE_SOLID_LINES);
int pulseColor = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_PULSE_COLOR, Color.WHITE, UserHandle.USER_CURRENT);
mPulseColor = (ColorPickerPreference) findPreference("eos_fling_pulse_color");
mPulseColor.setNewPreviewColor(pulseColor);
mPulseColor.setOnPreferenceChangeListener(this);
mLavaLampEnabled = (SwitchPreference) findPreference("eos_fling_lavalamp");
mLavaLampEnabled.setChecked(Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_PULSE_LAVALAMP_ENABLED, 1, UserHandle.USER_CURRENT) == 1);
mLavaLampEnabled.setOnPreferenceChangeListener(this);
int customdimen = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_CUSTOM_DIMEN, 14, UserHandle.USER_CURRENT);
mCustomDimen = (CustomSeekBarPreference) findPreference(CUSTOM_DIMEN);
mCustomDimen.setValue(customdimen);
mCustomDimen.setOnPreferenceChangeListener(this);
int customdiv = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_CUSTOM_DIV, 16, UserHandle.USER_CURRENT);
mCustomDiv = (CustomSeekBarPreference) findPreference(CUSTOM_DIV);
mCustomDiv.setValue(customdiv);
mCustomDiv.setOnPreferenceChangeListener(this);
int filled = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_FILLED_BLOCK_SIZE, 4, UserHandle.USER_CURRENT);
mFilled = (CustomSeekBarPreference) findPreference(PULSE_BLOCK);
mFilled.setValue(filled);
mFilled.setOnPreferenceChangeListener(this);
int empty = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_EMPTY_BLOCK_SIZE, 1, UserHandle.USER_CURRENT);
mEmpty = (CustomSeekBarPreference) findPreference(EMPTY_BLOCK);
mEmpty.setValue(empty);
mEmpty.setOnPreferenceChangeListener(this);
int fudge = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_CUSTOM_FUDGE_FACTOR, 4, UserHandle.USER_CURRENT);
mFudge = (CustomSeekBarPreference) findPreference(FUDGE_FACOR);
mFudge.setValue(fudge);
mFudge.setOnPreferenceChangeListener(this);
int solidfudge = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_SOLID_FUDGE_FACTOR, 5, UserHandle.USER_CURRENT);
mSolidFudge = (CustomSeekBarPreference) findPreference(SOLID_FUDGE);
mSolidFudge.setValue(solidfudge);
mSolidFudge.setOnPreferenceChangeListener(this);
int speed = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_LAVALAMP_SOLID_SPEED, 10000, UserHandle.USER_CURRENT);
mSolidSpeed = (CustomSeekBarPreference) findPreference(SOLID_LAVAMP_SPEED);
mSolidSpeed.setValue(speed);
mSolidSpeed.setOnPreferenceChangeListener(this);
int fspeed = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_PULSE_LAVALAMP_SPEED, 10000, UserHandle.USER_CURRENT);
mFadingSpeed = (CustomSeekBarPreference) findPreference(FADING_LAVAMP_SPEED);
mFadingSpeed.setValue(fspeed);
mFadingSpeed.setOnPreferenceChangeListener(this);
int count = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_SOLID_UNITS_COUNT, 64, UserHandle.USER_CURRENT);
mSolidCount = (CustomSeekBarPreference) findPreference(PULSE_SOLID_UNITS_COUNT);
mSolidCount.setValue(count);
mSolidCount.setOnPreferenceChangeListener(this);
int opacity = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_SOLID_UNITS_OPACITY, 200, UserHandle.USER_CURRENT);
mSolidOpacity = (CustomSeekBarPreference) findPreference(PULSE_SOLID_UNITS_OPACITY);
mSolidOpacity.setValue(opacity);
mSolidOpacity.setOnPreferenceChangeListener(this);
int buttonsOpacity = Settings.Secure.getIntForUser(resolver, Settings.Secure.PULSE_CUSTOM_BUTTONS_OPACITY, 200, UserHandle.USER_CURRENT);
mNavButtonsOpacity = (CustomSeekBarPreference) findPreference(PULSE_CUSTOM_BUTTONS_OPACITY);
mNavButtonsOpacity.setValue(buttonsOpacity);
mNavButtonsOpacity.setOnPreferenceChangeListener(this);
}
Aggregations