forked from upstream-mirrors/OpenTracks
merge heads
This commit is contained in:
@@ -62,7 +62,6 @@ public abstract class Constants {
|
||||
public static final int MENU_MY_LOCATION = 1;
|
||||
public static final int MENU_TOGGLE_LAYERS = 2;
|
||||
public static final int MENU_CHART_SETTINGS = 3;
|
||||
public static final int MENU_CURRENT_SEGMENT = 4;
|
||||
|
||||
/*
|
||||
* Context menu ids:
|
||||
|
||||
@@ -33,8 +33,6 @@ import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.Window;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
@@ -68,12 +66,6 @@ public class StatsActivity extends Activity implements TrackDataListener {
|
||||
*/
|
||||
private long startTime = -1;
|
||||
|
||||
/**
|
||||
* If true, the statistics for the current segment are shown, otherwise
|
||||
* for the full track.
|
||||
*/
|
||||
private boolean showCurrentSegment = false;
|
||||
|
||||
private TrackDataHub dataHub;
|
||||
private SharedPreferences preferences;
|
||||
|
||||
@@ -191,37 +183,6 @@ public class StatsActivity extends Activity implements TrackDataListener {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
MenuItem currentSegment = menu.add(0,
|
||||
Constants.MENU_CURRENT_SEGMENT, 0, R.string.current_segment);
|
||||
currentSegment.setIcon(R.drawable.ic_menu_lastsegment);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
MenuItem item = menu.findItem(Constants.MENU_CURRENT_SEGMENT);
|
||||
if (item != null) {
|
||||
item.setTitle(showCurrentSegment
|
||||
? getString(R.string.current_track)
|
||||
: getString(R.string.current_segment));
|
||||
}
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case Constants.MENU_CURRENT_SEGMENT:
|
||||
showCurrentSegment = !showCurrentSegment;
|
||||
// TODO: Re-read only the data that interests us
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the given location fields (latitude, longitude, altitude) and all
|
||||
* other fields.
|
||||
|
||||
@@ -292,7 +292,8 @@ public class TrackDataHub {
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
if (isStarted() || listenerHandlerThread.isAlive()) {
|
||||
if (isStarted() ||
|
||||
(listenerHandlerThread != null && listenerHandlerThread.isAlive())) {
|
||||
Log.e(TAG, "Forgot to stop() TrackDataHub");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user