diff options
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java b/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java index 7c63f34..96f6020 100644 --- a/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java +++ b/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java @@ -49,8 +49,6 @@ public class ButtonBacklightBrightness extends DialogPreference implements public static final String KEY_BUTTON_BACKLIGHT = "pre_navbar_button_backlight"; - private Window mWindow; - private BrightnessControl mButtonBrightness; private BrightnessControl mKeyboardBrightness; private BrightnessControl mActiveControl; @@ -150,10 +148,6 @@ public class ButtonBacklightBrightness extends DialogPreference implements } } }); - - if (getDialog() != null) { - mWindow = getDialog().getWindow(); - } updateBrightnessPreview(); } @@ -280,15 +274,17 @@ public class ButtonBacklightBrightness extends DialogPreference implements } private void updateBrightnessPreview() { - if (mWindow != null) { - LayoutParams params = mWindow.getAttributes(); - if (mActiveControl != null) { - params.buttonBrightness = (float) mActiveControl.getBrightness(false) / 255.0f; - } else { - params.buttonBrightness = -1; - } - mWindow.setAttributes(params); + if (getDialog() == null || getDialog().getWindow() == null) { + return; + } + Window window = getDialog().getWindow(); + LayoutParams params = window.getAttributes(); + if (mActiveControl != null) { + params.buttonBrightness = (float) mActiveControl.getBrightness(false) / 255.0f; + } else { + params.buttonBrightness = -1; } + window.setAttributes(params); } private void updateTimeoutEnabledState() { |