diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/GPSButton.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/GPSButton.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/GPSButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/GPSButton.java index 32a1ea3..579d1d9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/GPSButton.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/GPSButton.java @@ -22,8 +22,8 @@ public class GPSButton extends PowerButton { public GPSButton() { mType = BUTTON_GPS; } @Override - protected void updateState() { - if(getGpsState(mView.getContext())) { + protected void updateState(Context context) { + if (getGpsState(context)) { mIcon = R.drawable.stat_gps_on; mState = STATE_ENABLED; } else { @@ -33,8 +33,7 @@ public class GPSButton extends PowerButton { } @Override - protected void toggleState() { - Context context = mView.getContext(); + protected void toggleState(Context context) { ContentResolver resolver = context.getContentResolver(); boolean enabled = getGpsState(context); Settings.Secure.setLocationProviderEnabled(resolver, @@ -42,11 +41,11 @@ public class GPSButton extends PowerButton { } @Override - protected boolean handleLongClick() { + protected boolean handleLongClick(Context context) { Intent intent = new Intent("android.settings.LOCATION_SOURCE_SETTINGS"); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - mView.getContext().startActivity(intent); + context.startActivity(intent); return true; } @@ -55,7 +54,7 @@ public class GPSButton extends PowerButton { return OBSERVED_URIS; } - private static boolean getGpsState(Context context) { + private boolean getGpsState(Context context) { ContentResolver resolver = context.getContentResolver(); return Settings.Secure.isLocationProviderEnabled(resolver, LocationManager.GPS_PROVIDER); |