forked from upstream-mirrors/OpenTracks
Fix two bugs.
- reload waypoint in MarkerDetailActivity onResume - In list item, if time/distance field is not available, use INVISIBLE rather than GONE.
This commit is contained in:
@@ -73,7 +73,8 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity implements De
|
|||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set waypoint, needed in onCreateOptionsMenu
|
||||||
waypoint = myTracksProviderUtils.getWaypoint(markerId);
|
waypoint = myTracksProviderUtils.getWaypoint(markerId);
|
||||||
if (waypoint == null) {
|
if (waypoint == null) {
|
||||||
Log.d(TAG, "waypoint is null");
|
Log.d(TAG, "waypoint is null");
|
||||||
@@ -95,6 +96,14 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity implements De
|
|||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
// Update waypoint in case it changed from an edit
|
||||||
|
waypoint = myTracksProviderUtils.getWaypoint(markerId);
|
||||||
|
if (waypoint == null) {
|
||||||
|
Log.d(TAG, "waypoint is null");
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
name.setText(getString(R.string.generic_name_line, waypoint.getName()));
|
name.setText(getString(R.string.generic_name_line, waypoint.getName()));
|
||||||
if (waypoint.getType() == WaypointType.WAYPOINT) {
|
if (waypoint.getType() == WaypointType.WAYPOINT) {
|
||||||
waypointSection.setVisibility(View.VISIBLE);
|
waypointSection.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
@@ -78,17 +78,18 @@ public class ListItemUtils {
|
|||||||
timeDistanceTextView.setTextAppearance(context, R.style.TextSmall);
|
timeDistanceTextView.setTextAppearance(context, R.style.TextSmall);
|
||||||
}
|
}
|
||||||
setTextView(timeDistanceTextView,
|
setTextView(timeDistanceTextView,
|
||||||
getTimeDistance(context, isRecording, isPaused, sharedOwner, totalTime, totalDistance));
|
getTimeDistance(context, isRecording, isPaused, sharedOwner, totalTime, totalDistance),
|
||||||
|
View.INVISIBLE);
|
||||||
|
|
||||||
String[] startTimeDisplay = getStartTime(isRecording, context, startTime);
|
String[] startTimeDisplay = getStartTime(isRecording, context, startTime);
|
||||||
TextView dateTextView = (TextView) view.findViewById(R.id.list_item_date);
|
TextView dateTextView = (TextView) view.findViewById(R.id.list_item_date);
|
||||||
setTextView(dateTextView, startTimeDisplay[0]);
|
setTextView(dateTextView, startTimeDisplay[0], View.GONE);
|
||||||
|
|
||||||
TextView timeTextView = (TextView) view.findViewById(R.id.list_item_time);
|
TextView timeTextView = (TextView) view.findViewById(R.id.list_item_time);
|
||||||
setTextView(timeTextView, startTimeDisplay[1]);
|
setTextView(timeTextView, startTimeDisplay[1], View.GONE);
|
||||||
|
|
||||||
TextView descriptionTextView = (TextView) view.findViewById(R.id.list_item_description);
|
TextView descriptionTextView = (TextView) view.findViewById(R.id.list_item_description);
|
||||||
setTextView(descriptionTextView, getDescription(isRecording, category, description));
|
setTextView(descriptionTextView, getDescription(isRecording, category, description), View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,10 +194,11 @@ public class ListItemUtils {
|
|||||||
*
|
*
|
||||||
* @param textView the text view
|
* @param textView the text view
|
||||||
* @param value the value for the text view
|
* @param value the value for the text view
|
||||||
|
* @param visibility visibility when value is not available
|
||||||
*/
|
*/
|
||||||
private static void setTextView(TextView textView, String value) {
|
private static void setTextView(TextView textView, String value, int visibility) {
|
||||||
if (value == null || value.length() == 0) {
|
if (value == null || value.length() == 0) {
|
||||||
textView.setVisibility(View.GONE);
|
textView.setVisibility(visibility);
|
||||||
} else {
|
} else {
|
||||||
textView.setVisibility(View.VISIBLE);
|
textView.setVisibility(View.VISIBLE);
|
||||||
textView.setText(value);
|
textView.setText(value);
|
||||||
|
|||||||
Reference in New Issue
Block a user