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);
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
||||||
searchEngine = new SearchEngine(myTracksProviderUtils);
|
searchEngine = new SearchEngine(myTracksProviderUtils);
|
||||||
searchRecentSuggestions = SearchEngineProvider.newHelper(this);
|
searchRecentSuggestions = SearchEngineProvider.newHelper(this);
|
||||||
myTracksLocationManager = new MyTracksLocationManager(this, Looper.myLooper());
|
|
||||||
|
|
||||||
listView = (ListView) findViewById(R.id.search_list);
|
listView = (ListView) findViewById(R.id.search_list);
|
||||||
listView.setEmptyView(findViewById(R.id.search_list_empty));
|
listView.setEmptyView(findViewById(R.id.search_list_empty));
|
||||||
@@ -263,12 +262,6 @@ public class SearchListActivity extends AbstractSendToGoogleActivity
|
|||||||
trackRecordingServiceConnection.unbind();
|
trackRecordingServiceConnection.unbind();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
myTracksLocationManager.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutResId() {
|
protected int getLayoutResId() {
|
||||||
return R.layout.search_list;
|
return R.layout.search_list;
|
||||||
@@ -395,9 +388,11 @@ 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());
|
||||||
LocationListener locationListener = new LocationListener() {
|
LocationListener locationListener = new LocationListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onLocationChanged(final Location location) {
|
public void onLocationChanged(final Location location) {
|
||||||
|
myTracksLocationManager.close();
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
Reference in New Issue
Block a user