forked from upstream-mirrors/OpenTracks
In SearchListActivity, only start MyTracksLocationManager when needed.
This commit is contained in:
@@ -187,7 +187,6 @@ public class SearchListActivity extends AbstractSendToGoogleActivity
|
||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
||||
searchEngine = new SearchEngine(myTracksProviderUtils);
|
||||
searchRecentSuggestions = SearchEngineProvider.newHelper(this);
|
||||
myTracksLocationManager = new MyTracksLocationManager(this, Looper.myLooper());
|
||||
|
||||
listView = (ListView) findViewById(R.id.search_list);
|
||||
listView.setEmptyView(findViewById(R.id.search_list_empty));
|
||||
@@ -263,12 +262,6 @@ public class SearchListActivity extends AbstractSendToGoogleActivity
|
||||
trackRecordingServiceConnection.unbind();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
myTracksLocationManager.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
return R.layout.search_list;
|
||||
@@ -395,9 +388,11 @@ public class SearchListActivity extends AbstractSendToGoogleActivity
|
||||
final String textQuery = intent.getStringExtra(SearchManager.QUERY);
|
||||
setTitle(textQuery);
|
||||
|
||||
myTracksLocationManager = new MyTracksLocationManager(this, Looper.myLooper());
|
||||
LocationListener locationListener = new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(final Location location) {
|
||||
myTracksLocationManager.close();
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user