forked from upstream-mirrors/OpenTracks
merge heads
This commit is contained in:
@@ -166,7 +166,6 @@ public class SearchListActivity extends AbstractSendToGoogleActivity
|
|||||||
private TrackRecordingServiceConnection trackRecordingServiceConnection;
|
private TrackRecordingServiceConnection trackRecordingServiceConnection;
|
||||||
private SearchEngine searchEngine;
|
private SearchEngine searchEngine;
|
||||||
private SearchRecentSuggestions searchRecentSuggestions;
|
private SearchRecentSuggestions searchRecentSuggestions;
|
||||||
private MyTracksLocationManager myTracksLocationManager;
|
|
||||||
private ArrayAdapter<Map<String, Object>> arrayAdapter;
|
private ArrayAdapter<Map<String, Object>> arrayAdapter;
|
||||||
|
|
||||||
private boolean metricUnits = PreferencesUtils.METRIC_UNITS_DEFAULT;
|
private boolean metricUnits = PreferencesUtils.METRIC_UNITS_DEFAULT;
|
||||||
@@ -388,7 +387,8 @@ public class SearchListActivity extends AbstractSendToGoogleActivity
|
|||||||
final String textQuery = intent.getStringExtra(SearchManager.QUERY);
|
final String textQuery = intent.getStringExtra(SearchManager.QUERY);
|
||||||
setTitle(textQuery);
|
setTitle(textQuery);
|
||||||
|
|
||||||
myTracksLocationManager = new MyTracksLocationManager(this, Looper.myLooper());
|
final MyTracksLocationManager myTracksLocationManager = new MyTracksLocationManager(
|
||||||
|
this, Looper.myLooper());
|
||||||
LocationListener locationListener = new LocationListener() {
|
LocationListener locationListener = new LocationListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onLocationChanged(final Location location) {
|
public void onLocationChanged(final Location location) {
|
||||||
|
|||||||
+17
-17
@@ -44,6 +44,23 @@ import android.util.Log;
|
|||||||
*/
|
*/
|
||||||
public class MyTracksLocationManager {
|
public class MyTracksLocationManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Observer for Google location settings.
|
||||||
|
*
|
||||||
|
* @author Jimmy Shih
|
||||||
|
*/
|
||||||
|
private class GoogleSettingsObserver extends ContentObserver {
|
||||||
|
|
||||||
|
public GoogleSettingsObserver() {
|
||||||
|
super(new Handler());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(boolean selfChange) {
|
||||||
|
isAllowed = isUseLocationForServicesOn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static final String TAG = MyTracksLocationManager.class.getSimpleName();
|
private static final String TAG = MyTracksLocationManager.class.getSimpleName();
|
||||||
|
|
||||||
private static final String GOOGLE_SETTINGS_CONTENT_URI = "content://com.google.settings/partner";
|
private static final String GOOGLE_SETTINGS_CONTENT_URI = "content://com.google.settings/partner";
|
||||||
@@ -125,23 +142,6 @@ public class MyTracksLocationManager {
|
|||||||
contentResolver.unregisterContentObserver(observer);
|
contentResolver.unregisterContentObserver(observer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Observer for Google location settings.
|
|
||||||
*
|
|
||||||
* @author Jimmy Shih
|
|
||||||
*/
|
|
||||||
private class GoogleSettingsObserver extends ContentObserver {
|
|
||||||
|
|
||||||
public GoogleSettingsObserver() {
|
|
||||||
super(new Handler());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onChange(boolean selfChange) {
|
|
||||||
isAllowed = isUseLocationForServicesOn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if allowed to access the location manager. Returns true if
|
* Returns true if allowed to access the location manager. Returns true if
|
||||||
* there is no Google location settings or the Google location settings allows
|
* there is no Google location settings or the Google location settings allows
|
||||||
|
|||||||
Reference in New Issue
Block a user