summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java
index a9f17bc..cf8ed2d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/FlashlightButton.java
@@ -20,8 +20,8 @@ public class FlashlightButton extends PowerButton {
public FlashlightButton() { mType = BUTTON_FLASHLIGHT; }
@Override
- protected void updateState() {
- boolean enabled = Settings.System.getInt(mView.getContext().getContentResolver(), Settings.System.TORCH_STATE, 0) == 1;
+ protected void updateState(Context context) {
+ boolean enabled = Settings.System.getInt(context.getContentResolver(), Settings.System.TORCH_STATE, 0) == 1;
if(enabled) {
mIcon = R.drawable.stat_flashlight_on;
mState = STATE_ENABLED;
@@ -32,8 +32,7 @@ public class FlashlightButton extends PowerButton {
}
@Override
- protected void toggleState() {
- Context context = mView.getContext();
+ protected void toggleState(Context context) {
boolean bright = Settings.System.getInt(context.getContentResolver(),
Settings.System.EXPANDED_FLASH_MODE, 0) == 1;
Intent i = new Intent("net.cactii.flash2.TOGGLE_FLASHLIGHT");
@@ -42,13 +41,13 @@ public class FlashlightButton extends PowerButton {
}
@Override
- protected boolean handleLongClick() {
+ protected boolean handleLongClick(Context context) {
// it may be better to make an Intent action for the Torch
// we may want to look at that option later
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("net.cactii.flash2", "net.cactii.flash2.MainActivity");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- mView.getContext().startActivity(intent);
+ context.startActivity(intent);
return true;
}