Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3cc549b authored by DvTonder's avatar DvTonder
Browse files

Quick Settings: Add 'OFF' text to GPS tile when off

Change-Id: I8a81e3cf8419a6c2e4305c844b5f6162ed14055d
parent 3810bf62
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ public class GPSTile extends QuickSettingsTile implements LocationGpsStateChange
        enabled = Settings.Secure.isLocationProviderEnabled(mContentResolver, LocationManager.GPS_PROVIDER);

        mOnClick = new OnClickListener() {

            @Override
            public void onClick(View v) {
                Settings.Secure.setLocationProviderEnabled(mContentResolver, LocationManager.GPS_PROVIDER, !enabled);
@@ -46,7 +45,6 @@ public class GPSTile extends QuickSettingsTile implements LocationGpsStateChange
        };

        mOnLongClick = new OnLongClickListener() {

            @Override
            public boolean onLongClick(View v) {
                startSettingsActivity(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
@@ -60,6 +58,7 @@ public class GPSTile extends QuickSettingsTile implements LocationGpsStateChange
    public void onReceive(Context context, Intent intent) {
        enabled = Settings.Secure.isLocationProviderEnabled(mContentResolver, LocationManager.GPS_PROVIDER);
        mLabel = mContext.getString(R.string.quick_settings_gps);
        setGenericLabel();
        applyGPSChanges();
    }

@@ -86,10 +85,14 @@ public class GPSTile extends QuickSettingsTile implements LocationGpsStateChange
        if (description != null) {
            mLabel = description;
        } else {
            mLabel = mContext.getString(R.string.quick_settings_gps);
            setGenericLabel();
        }
        applyGPSChanges();

    }

    private void setGenericLabel() {
        // Show OFF next to the GPS label when in OFF state, ON/IN USE is indicated by the color
        String label = mContext.getString(R.string.quick_settings_gps);
        mLabel = (enabled ? label : label + " " + mContext.getString(R.string.quick_settings_label_disabled));
    }
}