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

Commit 7f62e607 authored by sssemil's avatar sssemil Committed by Abhisek Devkota
Browse files

Update location tile(2/2)

Change-Id: I367ec9bdedbd576125228ca33a5eebd136433112
parent 92579671
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -345,14 +345,14 @@
    </string-array>

    <string-array name="entries_location_widget" translatable="false">
        <!-- Off is always preset -->
        <item>@string/cm_location_mode_off</item>
        <item>@string/cm_location_mode_battery_saving</item>
        <item>@string/cm_location_mode_device_only</item>
        <item>@string/cm_location_mode_high_accuracy</item>
    </string-array>

    <string-array name="values_location_widget" translatable="false">
        <!-- Off is always preset -->
        <item>0</item>
        <item>1</item>
        <item>2</item>
        <item>3</item>
+2 −0
Original line number Diff line number Diff line
@@ -409,6 +409,8 @@
    <string name="cm_sound_mode_sound">Sound</string>
    <string name="cm_sound_mode_soundVibrate">Sound &amp; Vibrate</string>
    <string name="pref_location_mode_title">Location modes</string>
    <string name="pref_location_mode_summary">Uncheck all for default(old) 2&amp;2 mode</string>
    <string name="cm_location_mode_off">Location off</string>
    <string name="cm_location_mode_battery_saving">Battery saving</string>
    <string name="cm_location_mode_device_only">Device only</string>
    <string name="cm_location_mode_high_accuracy">High accuracy</string>
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@
            android:key="pref_location_mode"
            android:dialogTitle="@string/pref_location_mode_title"
            android:title="@string/pref_location_mode_title"
            android:summary="@string/pref_location_mode_summary"
            android:entries="@array/entries_location_widget"
            android:entryValues="@array/values_location_widget" />

+3 −3
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ public class QuickSettings extends SettingsPreferenceFragment implements
                String[] modes = getResources().getStringArray(R.array.values_location_widget);
                int count = modes.length;
                for (int i = 0; i < count; i++) {
                    int mask = (int) Math.pow(2, i + 1); // Off is always preset
                    int mask = (int) Math.pow(2, i);
                    if ((currentLocatorMode & mask) == mask) {
                        currentModes.add(modes[i]);
                    }
@@ -210,12 +210,12 @@ public class QuickSettings extends SettingsPreferenceFragment implements
            updateSummary(value, mRingMode, R.string.pref_ring_mode_summary);
            return true;
        } else if (preference == mLocationMode) {
            int currentLocatorMode = 1; // Off is always preset
            int currentLocatorMode = 0;
            String[] currentModes = ((Set<String>) newValue).toArray(new String[]{});
            int count = currentModes.length;
            for (int i = 0; i < count; i++) {
                int index = mLocationMode.findIndexOfValue(currentModes[i]);
                currentLocatorMode |= (int) Math.pow(2, index + 1); // Off is always preset
                currentLocatorMode |= (int) Math.pow(2, index);
            }
            Settings.System.putIntForUser(resolver, Settings.System.EXPANDED_LOCATION_MODE,
                    currentLocatorMode, UserHandle.USER_CURRENT);