import android.app.AlertDialog;
import android.app.Dialog;
+import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
*/
public ApplicationLightPreference(Context context, AttributeSet attrs) {
super(context, attrs);
+ NotificationManager nm = context.getSystemService(NotificationManager.class);
mColorValue = DEFAULT_COLOR;
mOnValue = DEFAULT_TIME;
mOffValue = DEFAULT_TIME;
- mOnOffChangeable = context.getResources().getBoolean(
- com.android.internal.R.bool.config_ledCanPulse);
+ mOnOffChangeable = nm.deviceLightsCan(NotificationManager.LIGHTS_LED_PULSE);
init();
}
*/
public ApplicationLightPreference(Context context, int color, int onValue, int offValue) {
super(context, null);
+ NotificationManager nm = context.getSystemService(NotificationManager.class);
mColorValue = color;
mOnValue = onValue;
mOffValue = offValue;
- mOnOffChangeable = context.getResources().getBoolean(
- com.android.internal.R.bool.config_ledCanPulse);
+ mOnOffChangeable = nm.deviceLightsCan(NotificationManager.LIGHTS_LED_PULSE);
init();
}
protected void onBindView(View view) {
super.onBindView(view);
+ NotificationManager nm = getContext().getSystemService(NotificationManager.class);
+
mLightColorView = (ImageView) view.findViewById(R.id.light_color);
mOnValueView = (TextView) view.findViewById(R.id.textViewTimeOnValue);
mOffValueView = (TextView) view.findViewById(R.id.textViewTimeOffValue);
TextView tView = (TextView) view.findViewById(android.R.id.summary);
tView.setVisibility(View.GONE);
- if (!mResources.getBoolean(com.android.internal.R.bool.config_multiColorNotificationLed)) {
+ if (!nm.deviceLightsCan(NotificationManager.LIGHTS_RGB_NOTIFICATION)) {
mLightColorView.setVisibility(View.GONE);
}
package com.android.settings.notificationlight;
+import android.app.NotificationManager;
import android.content.ContentResolver;
import android.content.res.Resources;
import android.os.Bundle;
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.battery_light_settings);
+ final NotificationManager nm = getContext().getSystemService(NotificationManager.class);
+
PreferenceScreen prefSet = getPreferenceScreen();
PreferenceGroup mGeneralPrefs = (PreferenceGroup) prefSet.findPreference("general_section");
mLightEnabledPref = (CMSystemSettingSwitchPreference) prefSet.findPreference(LIGHT_ENABLED_PREF);
mPulseEnabledPref = (CMSystemSettingSwitchPreference) prefSet.findPreference(PULSE_ENABLED_PREF);
- if (!getResources().getBoolean(com.android.internal.R.bool.config_ledCanPulse) ||
- getResources().getBoolean(org.cyanogenmod.platform.internal.R.bool.config_useSegmentedBatteryLed)) {
+ if (!nm.deviceLightsCan(NotificationManager.LIGHTS_LED_PULSE) ||
+ nm.deviceLightsCan(NotificationManager.LIGHTS_SEGMENTED_BATTERY_LIGHTS) ) {
mGeneralPrefs.removePreference(mPulseEnabledPref);
}
// Does the Device support changing battery LED colors?
- if (getResources().getBoolean(com.android.internal.R.bool.config_multiColorBatteryLed)) {
+ if (nm.deviceLightsCan(NotificationManager.LIGHTS_RGB_BATTERY)) {
setHasOptionsMenu(true);
// Low, Medium and full color preferences
setView(layout);
setTitle(R.string.edit_light_settings);
- if (!getContext().getResources().getBoolean(
- com.android.internal.R.bool.config_multiColorNotificationLed)) {
+ if (!mNotificationManager.deviceLightsCan(NotificationManager.LIGHTS_RGB_NOTIFICATION)) {
mColorPicker.setVisibility(View.GONE);
mColorPanel.setVisibility(View.GONE);
mLightsDialogDivider.setVisibility(View.GONE);
import android.app.AlertDialog;
import android.app.Dialog;
+import android.app.NotificationManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
PreferenceScreen prefSet = getPreferenceScreen();
Resources resources = getResources();
+ final NotificationManager nm = getContext().getSystemService(NotificationManager.class);
+
PreferenceGroup mAdvancedPrefs = (PreferenceGroup) prefSet.findPreference("advanced_section");
// Get the system defined default notification color
} else {
mNotificationLedBrightnessPref.setOnPreferenceChangeListener(this);
}
- if (!resources.getBoolean(
- org.cyanogenmod.platform.internal.R.bool.config_multipleNotificationLeds)) {
+ if (!nm.deviceLightsCan(NotificationManager.LIGHTS_MULTIPLE_LED)) {
mAdvancedPrefs.removePreference(mMultipleLedsEnabledPref);
} else {
mMultipleLedsEnabledPref.setOnPreferenceChangeListener(this);
mPackages = new HashMap<String, Package>();
setHasOptionsMenu(true);
- mMultiColorLed = resources.getBoolean(com.android.internal.R.bool.config_multiColorNotificationLed);
+ mMultiColorLed = nm.deviceLightsCan(NotificationManager.LIGHTS_RGB_NOTIFICATION);
if (!mMultiColorLed) {
resetColors();
PreferenceGroup mGeneralPrefs = (PreferenceGroup) prefSet.findPreference("general_section");