diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/AirplaneButton.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/AirplaneButton.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/AirplaneButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/AirplaneButton.java index 7e2f20c..e1820ef 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/AirplaneButton.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/AirplaneButton.java @@ -21,8 +21,8 @@ public class AirplaneButton extends PowerButton { public AirplaneButton() { mType = BUTTON_AIRPLANE; } @Override - protected void updateState() { - if (getState(mView.getContext())) { + protected void updateState(Context context) { + if (getState(context)) { mIcon = R.drawable.stat_airplane_on; mState = STATE_ENABLED; } else { @@ -32,8 +32,7 @@ public class AirplaneButton extends PowerButton { } @Override - protected void toggleState() { - Context context = mView.getContext(); + protected void toggleState(Context context) { boolean state = getState(context); Settings.System.putInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, state ? 0 : 1); @@ -45,11 +44,11 @@ public class AirplaneButton extends PowerButton { } @Override - protected boolean handleLongClick() { + protected boolean handleLongClick(Context context) { Intent intent = new Intent("android.settings.AIRPLANE_MODE_SETTINGS"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - mView.getContext().startActivity(intent); + context.startActivity(intent); return true; } @@ -58,7 +57,7 @@ public class AirplaneButton extends PowerButton { return OBSERVED_URIS; } - private static boolean getState(Context context) { + private boolean getState(Context context) { return Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON,0) == 1; } |