Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mateor@mateor-HP-Pavilion-dv6700:~/android/system/CM10b/packages/apps/Settings$ git diff 625e239c73327bb71dda2ff3e460d1609c2bd73d
- diff --git a/res/values/arrays.xml b/res/values/arrays.xml
- index 88dbdfd..c7c9116 100644
- --- a/res/values/arrays.xml
- +++ b/res/values/arrays.xml
- @@ -1119,6 +1119,15 @@
- <item>1</item>
- <item>2</item>
- </string-array>
- +
- + <!-- GPS location port -->
- + <string-array name="location_entries_gps_source">
- + <item>Use Internal GPS</item>
- + </string-array>
- +
- + <string-array name="location_values_gps_source" translatable="false">
- + <item>0</item>
- + </string-array>
- <!-- CyanogenMod port ENDS -->
- </resources>
- diff --git a/res/values/strings.xml b/res/values/strings.xml
- index 68960ba..9f23e4f 100644
- --- a/res/values/strings.xml
- +++ b/res/values/strings.xml
- @@ -2319,6 +2319,14 @@
- <!-- [CHAR LIMIT=45] Section heading for location sources -->
- <string name="location_sources_heading">Location sources</string>
- + <!-- CyanogenMod10 feature port START-->
- + <!-- GPS Source selection -->
- + <string name="location_gps_source_title">GPS source</string>
- + <string name="location_gps_source_summary">Choose to use either an external
- + <string name="location_gps_source_notification_title">Alert</string>
- + <string name="location_gps_source_notification">The GPS source has been swi
- + <!-- CyanogenMod10 port END -->
- +
- <!-- About --> <skip />
- <!-- Main settings screen, setting title for the user to go into the About
- <string name="about_settings" product="tablet">About tablet</string>
- diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
- index ab212d8..c2c1c3b 100644
- --- a/res/xml/location_settings.xml
- +++ b/res/xml/location_settings.xml
- @@ -41,6 +41,16 @@
- android:dependency="location_toggle"
- android:persistent="false" />
- + <!-- CyanogenMod10 feature port START -->
- + <!-- GPS Source pref -->
- + <ListPreference android:key="location_gps_source"
- + android:dialogTitle="@string/location_gps_source_title"
- + android:title="@string/location_gps_source_title"
- + android:summary="@string/location_gps_source_summary"
- + android:entries="@array/location_entries_gps_source"
- + android:entryValues="@array/location_values_gps_source" />
- + <!-- CyanogenMod10 feature END -->
- +
- <!-- Disabled to avoid confusion on devices with no AGPS
- For Google experience devices we want AGPS on by default (if supported) so
- <CheckBoxPreference
- diff --git a/src/com/android/settings/LocationSettings.java b/src/com/android/se
- index cfbbe26..0152601 100644
- --- a/src/com/android/settings/LocationSettings.java
- +++ b/src/com/android/settings/LocationSettings.java
- @@ -19,11 +19,13 @@ package com.android.settings;
- import android.content.ContentQueryMap;
- import android.content.ContentResolver;
- +import android.content.DialogInterface;
- import android.content.Context;
- import android.content.Intent;
- import android.database.Cursor;
- import android.location.LocationManager;
- import android.preference.CheckBoxPreference;
- +import android.preference.ListPreference;
- import android.preference.Preference;
- import android.preference.PreferenceScreen;
- import android.preference.SwitchPreference;
- @@ -34,6 +36,14 @@ import android.widget.TextView;
- import java.util.Observable;
- import java.util.Observer;
- +import java.util.ArrayList;
- +
- +import android.bluetooth.BluetoothAdapter;
- +import android.bluetooth.BluetoothDevice;
- +import android.app.AlertDialog;
- +import android.app.Dialog;
- +import android.location.LocationManager;
- +import android.widget.Toast;
- /**
- * Gesture lock pattern settings.
- @@ -51,6 +61,7 @@ public class LocationSettings extends SettingsPreferenceFragme
- private CheckBoxPreference mGps;
- private CheckBoxPreference mAssistedGps;
- private SwitchPreference mLocationAccess;
- + private ListPreference mGPSBTPref;
- // These provide support for receiving notification when Location Manager s
- // This is necessary because the Network Location Provider can change setti
- @@ -92,6 +103,31 @@ public class LocationSettings extends SettingsPreferenceFrag
- mAssistedGps = (CheckBoxPreference) root.findPreference(KEY_ASSISTED_GP
- mLocationAccess.setOnPreferenceChangeListener(this);
- +
- + //add BT gps devices -- from CM10
- + mGPSBTPref = (ListPreference) findPreference("location_gps_source");
- + ArrayList<CharSequence> entries = new ArrayList<CharSequence>();
- + for (String e : getResources().getStringArray(R.array.location_entries_
- + entries.add(e);
- + }
- + ArrayList<CharSequence> values = new ArrayList<CharSequence>();
- + for (String v: getResources().getStringArray(R.array.location_values_gp
- + values.add(v);
- + }
- + // add known bonded BT devices
- + BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter
- + if ((mBluetoothAdapter != null) && (mBluetoothAdapter.isEnabled())) {
- + for (BluetoothDevice d : mBluetoothAdapter.getBondedDevices()) {
- + String dname = d.getName() + " - " + d.getAddress();
- + entries.add(dname);
- + values.add(d.getAddress());
- + }
- + }
- + mGPSBTPref.setEntries(entries.toArray(new CharSequence[entries.size()])
- + mGPSBTPref.setEntryValues(values.toArray(new CharSequence[values.size()
- + mGPSBTPref.setDefaultValue("0");
- + mGPSBTPref.setOnPreferenceChangeListener(this);
- +
- return root;
- }
- @@ -180,6 +216,24 @@ public class LocationSettings extends SettingsPreferenceFra
- @Override
- public boolean onPreferenceChange(Preference pref, Object newValue) {
- if (pref.getKey().equals(KEY_LOCATION_TOGGLE)) {
- +
- + String oldPref = Settings.System.getString(getContentResolver(),
- + Settings.Secure.EXTERNAL_GPS_BT_DEVICE);
- + String newPref = newValue == null ? "0" : (String) newValue;
- + // "0" represents the internal GPS.
- + Settings.System.putString(getContentResolver(), Settings.Secure.EXT
- + newPref);
- + if (!oldPref.equals(newPref) && ("0".equals(oldPref) || "0".equals(
- + LocationManager locationManager =
- + (LocationManager) this.getSystemService(Context.LOCATION_SE
- + locationManager.setGPSSource(newPref);
- + // Show msg to inform user that source has been switched
- + Toast.makeText(this.getActivity(),
- + getResources().getString(R.string.location_gps_source_n
- + Toast.LENGTH_LONG).show();
- + }
- +
- + // Original action
- onToggleLocationAccess((Boolean) newValue);
- }
- return true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement