forked from upstream-mirrors/OpenTracks
Cleanup.
This commit is contained in:
@@ -165,7 +165,7 @@ public class SearchListActivity extends AbstractListActivity implements DeleteMa
|
|||||||
|
|
||||||
contentProviderUtils = new ContentProviderUtils(this);
|
contentProviderUtils = new ContentProviderUtils(this);
|
||||||
sharedPreferences = PreferencesUtils.getSharedPreferences(this);
|
sharedPreferences = PreferencesUtils.getSharedPreferences(this);
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(null);
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection();
|
||||||
searchEngine = new SearchEngine(contentProviderUtils);
|
searchEngine = new SearchEngine(contentProviderUtils);
|
||||||
|
|
||||||
arrayAdapter = new ArrayAdapter<Map<String, Object>>(this, R.layout.list_item, R.id.list_item_name) {
|
arrayAdapter = new ArrayAdapter<Map<String, Object>>(this, R.layout.list_item, R.id.list_item_name) {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class TrackEditActivity extends AbstractActivity implements ChooseActivit
|
|||||||
protected void onCreate(Bundle bundle) {
|
protected void onCreate(Bundle bundle) {
|
||||||
super.onCreate(bundle);
|
super.onCreate(bundle);
|
||||||
|
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(null);
|
trackRecordingServiceConnection = new TrackRecordingServiceConnection();
|
||||||
long trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1L);
|
long trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1L);
|
||||||
if (trackId == -1L) {
|
if (trackId == -1L) {
|
||||||
Log.e(TAG, "invalid trackId");
|
Log.e(TAG, "invalid trackId");
|
||||||
|
|||||||
@@ -53,8 +53,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
|||||||
private TrackDataHub trackDataHub;
|
private TrackDataHub trackDataHub;
|
||||||
private Handler handlerUpdateUI;
|
private Handler handlerUpdateUI;
|
||||||
|
|
||||||
//TODO Initialize immediately and remove in onDestroy()
|
private TrackRecordingServiceConnection trackRecordingServiceConnection = new TrackRecordingServiceConnection();
|
||||||
private TrackRecordingServiceConnection trackRecordingServiceConnection;
|
|
||||||
|
|
||||||
private TrackPoint lastTrackPoint = null;
|
private TrackPoint lastTrackPoint = null;
|
||||||
private TrackStatistics lastTrackStatistics = null;
|
private TrackStatistics lastTrackStatistics = null;
|
||||||
@@ -80,9 +79,6 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
|||||||
if (PreferencesUtils.getRecordingTrackId(getContext()) != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT) {
|
if (PreferencesUtils.getRecordingTrackId(getContext()) != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT) {
|
||||||
// A recording track id has been set -> Resumes track and starts timer.
|
// A recording track id has been set -> Resumes track and starts timer.
|
||||||
resumeTrackDataHub();
|
resumeTrackDataHub();
|
||||||
if (trackRecordingServiceConnection == null) {
|
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(null);
|
|
||||||
}
|
|
||||||
trackRecordingServiceConnection.startConnection(getContext());
|
trackRecordingServiceConnection.startConnection(getContext());
|
||||||
|
|
||||||
handlerUpdateUI.post(updateUIeachSecond);
|
handlerUpdateUI.post(updateUIeachSecond);
|
||||||
@@ -222,8 +218,6 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
resumeTrackDataHub();
|
resumeTrackDataHub();
|
||||||
PreferencesUtils.register(getContext(), sharedPreferenceChangeListener);
|
PreferencesUtils.register(getContext(), sharedPreferenceChangeListener);
|
||||||
|
|
||||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(null);
|
|
||||||
trackRecordingServiceConnection.startConnection(getContext());
|
trackRecordingServiceConnection.startConnection(getContext());
|
||||||
|
|
||||||
handlerUpdateUI.post(updateUIeachSecond);
|
handlerUpdateUI.post(updateUIeachSecond);
|
||||||
@@ -241,10 +235,7 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
|||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
if (trackRecordingServiceConnection != null) {
|
trackRecordingServiceConnection.unbind(getContext());
|
||||||
trackRecordingServiceConnection.unbind(getContext());
|
|
||||||
}
|
|
||||||
trackRecordingServiceConnection = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -296,6 +287,12 @@ public class StatisticsRecordingFragment extends Fragment implements TrackDataLi
|
|||||||
longitudeValue = null;
|
longitudeValue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
trackRecordingServiceConnection = null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTrackUpdated(final Track track) {
|
public void onTrackUpdated(final Track track) {
|
||||||
if (isResumed()) {
|
if (isResumed()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user