aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2010-09-19 20:54:20 +0200
committerHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2010-09-19 20:54:20 +0200
commitd386bdeb8ef3f2429820a322222227a429548d91 (patch)
tree30a8e3ca0e80429c4971fcfdb53c9c53faa00ce3 /src
parent84cc9f94a03ad60799e46979731f22112dbc8396 (diff)
downloadBlueGPS-d386bdeb8ef3f2429820a322222227a429548d91.zip
BlueGPS-d386bdeb8ef3f2429820a322222227a429548d91.tar.gz
BlueGPS-d386bdeb8ef3f2429820a322222227a429548d91.tar.bz2
add new preferences options
add preferences in order to chose if we want to: * replace the internal GPS or * use a new location provider.
Diffstat (limited to 'src')
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java23
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java10
2 files changed, 32 insertions, 1 deletions
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
index 8ce8e62..9d4003d 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
@@ -37,6 +37,7 @@ import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.preference.Preference.OnPreferenceChangeListener;
+import android.test.mock.MockPackageManager;
import android.util.Log;
/**
@@ -98,6 +99,27 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
}
prefDevices.setEntryValues(entryValues);
prefDevices.setEntries(entries);
+// if (sharedPref.getBoolean(BluetoothGpsProviderService.PREF_START_GPS_PROVIDER, false)){
+ Preference pref = (Preference)findPreference(BluetoothGpsProviderService.PREF_TRACK_RECORDING);
+ pref.setEnabled(sharedPref.getBoolean(BluetoothGpsProviderService.PREF_START_GPS_PROVIDER, false));
+// }
+ pref = (Preference)findPreference(BluetoothGpsProviderService.PREF_MOCK_GPS_NAME);
+ String mockProvider = sharedPref.getString(BluetoothGpsProviderService.PREF_MOCK_GPS_NAME, getString(R.string.defaultMockGpsName));
+ pref.setSummary(getString(R.string.pref_mock_gps_name_summary,mockProvider));
+
+ pref = (Preference)findPreference(BluetoothGpsProviderService.PREF_GPS_LOCATION_PROVIDER);
+ if (sharedPref.getBoolean(BluetoothGpsProviderService.PREF_REPLACE_STD_GPS, true)){
+ String s = getString(R.string.pref_gps_location_provider_summary);
+ pref.setSummary(s);
+ Log.e("BT test", "loc. provider: "+s);
+ Log.e("BT test", "loc. provider: "+pref.getSummary());
+ } else {
+ String s = getString(R.string.pref_mock_gps_name_summary, mockProvider);
+ pref.setSummary(s);
+ Log.e("BT test", "loc. provider: "+s);
+ Log.e("BT test", "loc. provider: "+pref.getSummary());
+ }
+ this.onContentChanged();
}
@Override
@@ -140,5 +162,6 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
} else if (BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE.equals(key)){
updateDevicePreferenceSummary();
}
+ this.updateDevicePreferenceList();
}
} \ No newline at end of file
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
index 0ab972b..456c752 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
@@ -62,6 +62,9 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
public static final String ACTION_START_GPS_PROVIDER = "org.broeuschmeul.android.gps.bluetooth.provider.nmea.intent.action.START_GPS_PROVIDER";
public static final String ACTION_STOP_GPS_PROVIDER = "org.broeuschmeul.android.gps.bluetooth.provider.nmea.intent.action.STOP_GPS_PROVIDER";
public static final String PREF_START_GPS_PROVIDER = "startGps";
+ public static final String PREF_GPS_LOCATION_PROVIDER = "gpsLocationProviderKey";
+ public static final String PREF_REPLACE_STD_GPS = "replaceStdtGps";
+ public static final String PREF_MOCK_GPS_NAME = "mockGpsName";
public static final String PREF_TRACK_RECORDING = "trackRecording";
public static final String PREF_TRACK_MIN_DISTANCE = "trackMinDistance";
public static final String PREF_TRACK_MIN_TIME = "trackMinTime";
@@ -104,8 +107,13 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
notification.setLatestEventInfo(getApplicationContext(), this.getString(R.string.foreground_service_started_notification_title), this.getString(R.string.foreground_gps_provider_started_notification), myPendingIntent);
startForeground(R.string.foreground_gps_provider_started_notification, notification);
if (BluetoothAdapter.checkBluetoothAddress(deviceAddress)){
+ String mockProvider = LocationManager.GPS_PROVIDER;
+ if (! sharedPreferences.getBoolean(PREF_REPLACE_STD_GPS, true)){
+ mockProvider = sharedPreferences.getString(PREF_MOCK_GPS_NAME, getString(R.string.defaultMockGpsName));
+ }
gpsManager = new BlueetoothGpsManager(this, deviceAddress);
- gpsManager.enableMockLocationProvider(LocationManager.GPS_PROVIDER);
+ gpsManager.enableMockLocationProvider(mockProvider);
+// gpsManager.enableMockLocationProvider(LocationManager.GPS_PROVIDER);
gpsManager.enable();
if (! sharedPreferences.getBoolean(PREF_START_GPS_PROVIDER, false)){
edit.putBoolean(PREF_START_GPS_PROVIDER,true);