forked from upstream-mirrors/OpenTracks
Cleanup.
This commit is contained in:
@@ -284,7 +284,7 @@ public class TrackListActivity extends AbstractListActivity implements ConfirmDe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
updateMenuItems(gpsStatusValue.isGpsStarted(), recordingStatus.isRecording());
|
updateGpsMenuItem(gpsStatusValue.isGpsStarted(), recordingStatus.isRecording());
|
||||||
|
|
||||||
SearchView searchView = (SearchView) searchMenuItem.getActionView();
|
SearchView searchView = (SearchView) searchMenuItem.getActionView();
|
||||||
searchView.setQuery("", false);
|
searchView.setQuery("", false);
|
||||||
@@ -396,22 +396,13 @@ public class TrackListActivity extends AbstractListActivity implements ConfirmDe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the menu items with not fixed icon for gps option.
|
|
||||||
*
|
|
||||||
* @param isGpsStarted true if gps is started
|
|
||||||
* @param isRecording true if recording
|
|
||||||
*/
|
|
||||||
private void updateMenuItems(boolean isGpsStarted, boolean isRecording) {
|
|
||||||
updateGpsMenuItem(isGpsStarted, isRecording);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the menu items with the icon specified.
|
* Updates the menu items with the icon specified.
|
||||||
*
|
*
|
||||||
* @param isGpsStarted true if gps is started
|
* @param isGpsStarted true if gps is started
|
||||||
* @param isRecording true if recording
|
* @param isRecording true if recording
|
||||||
*/
|
*/
|
||||||
|
//TODO Check if if can be avoided to call this outside of onGpsStatusChanged()
|
||||||
private void updateGpsMenuItem(boolean isGpsStarted, boolean isRecording) {
|
private void updateGpsMenuItem(boolean isGpsStarted, boolean isRecording) {
|
||||||
if (startGpsMenuItem != null) {
|
if (startGpsMenuItem != null) {
|
||||||
startGpsMenuItem.setVisible(!isRecording);
|
startGpsMenuItem.setVisible(!isRecording);
|
||||||
@@ -529,25 +520,25 @@ public class TrackListActivity extends AbstractListActivity implements ConfirmDe
|
|||||||
public void recordStart() {
|
public void recordStart() {
|
||||||
if (recordingStatus.getTrackId() == null) {
|
if (recordingStatus.getTrackId() == null) {
|
||||||
// Not recording -> Recording
|
// Not recording -> Recording
|
||||||
updateMenuItems(false, true);
|
updateGpsMenuItem(false, true);
|
||||||
Intent newIntent = IntentUtils.newIntent(TrackListActivity.this, TrackRecordingActivity.class);
|
Intent newIntent = IntentUtils.newIntent(TrackListActivity.this, TrackRecordingActivity.class);
|
||||||
startActivity(newIntent);
|
startActivity(newIntent);
|
||||||
} else if (recordingStatus.isPaused()) {
|
} else if (recordingStatus.isPaused()) {
|
||||||
// Paused -> Resume
|
// Paused -> Resume
|
||||||
updateMenuItems(false, true);
|
updateGpsMenuItem(false, true);
|
||||||
trackRecordingServiceConnection.resumeTrack();
|
trackRecordingServiceConnection.resumeTrack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recordPause() {
|
public void recordPause() {
|
||||||
updateMenuItems(false, true);
|
updateGpsMenuItem(false, true);
|
||||||
trackRecordingServiceConnection.pauseTrack();
|
trackRecordingServiceConnection.pauseTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recordStop() {
|
public void recordStop() {
|
||||||
updateMenuItems(false, false);
|
updateGpsMenuItem(false, false);
|
||||||
trackRecordingServiceConnection.stopRecording(TrackListActivity.this);
|
trackRecordingServiceConnection.stopRecording(TrackListActivity.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user