forked from upstream-mirrors/OpenTracks
In marker detail page, add a label "Since last Statistics Marker".
In the marker detail page, on resume, update the waypoint in case it is returning from marker edit page.
This commit is contained in:
@@ -31,19 +31,27 @@ limitations under the License.
|
||||
android:orientation="vertical" >
|
||||
<TextView
|
||||
android:id="@+id/marker_detail_waypoint_marker_type"
|
||||
style="@style/TextLarge" />
|
||||
style="@style/TextLarge.WithTopMargin" />
|
||||
<TextView
|
||||
android:id="@+id/marker_detail_waypoint_description"
|
||||
style="@style/TextLarge" />
|
||||
style="@style/TextLarge.WithTopMargin" />
|
||||
</LinearLayout>
|
||||
<TableLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/marker_detail_statistics_section"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:paddingTop="8dp"
|
||||
android:shrinkColumns="0,2"
|
||||
android:stretchColumns="0,2" >
|
||||
<include layout="@layout/stats_core" />
|
||||
</TableLayout>
|
||||
android:orientation="vertical" >
|
||||
<TextView
|
||||
android:text="@string/marker_detail_statistics_title"
|
||||
style="@style/TextLarge.WithTopMargin" />
|
||||
<TableLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:paddingTop="8dp"
|
||||
android:shrinkColumns="0,2"
|
||||
android:stretchColumns="0,2" >
|
||||
<include layout="@layout/stats_core" />
|
||||
</TableLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -965,6 +965,11 @@ limitations under the License.
|
||||
%1$s marker type. E.g., 'building'.">
|
||||
Marker type: %1$s
|
||||
</string>
|
||||
<string name="marker_detail_statistics_title"
|
||||
translation_description="In the marker detail page, the title for the statistics section
|
||||
indicating that the data below are since the last Statistics marker.">
|
||||
Since last Statistics marker:
|
||||
</string>
|
||||
<string name="marker_edit_marker_type"
|
||||
translation_description="In the marker edit page, the label for the marker type, including some
|
||||
exmaples.">
|
||||
|
||||
@@ -122,6 +122,10 @@ limitations under the License.
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:textSize">22sp</item>
|
||||
</style>
|
||||
<!-- The style for large size text with top margin -->
|
||||
<style name="TextLarge.WithTopMargin">
|
||||
<item name="android:layout_marginTop">8dp</item>
|
||||
</style>
|
||||
<!-- The style for medium size text -->
|
||||
<style name="TextMedium">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
|
||||
@@ -44,6 +44,10 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity {
|
||||
private long markerId;
|
||||
private Waypoint waypoint;
|
||||
|
||||
private TextView name;
|
||||
private View waypointSection;
|
||||
private View statisticsSection;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
@@ -55,19 +59,21 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
name = (TextView) findViewById(R.id.marker_detail_name);
|
||||
waypointSection = findViewById(R.id.marker_detail_waypoint_section);
|
||||
statisticsSection = findViewById(R.id.marker_detail_statistics_section);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
waypoint = MyTracksProviderUtils.Factory.get(this).getWaypoint(markerId);
|
||||
if (waypoint == null) {
|
||||
Log.d(TAG, "waypoint is null");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
TextView name = (TextView) findViewById(R.id.marker_detail_name);
|
||||
name.setText(getString(R.string.marker_detail_name, waypoint.getName()));
|
||||
View waypointSection = findViewById(R.id.marker_detail_waypoint_section);
|
||||
View statisticsSection = findViewById(R.id.marker_detail_statistics_section);
|
||||
|
||||
if (waypoint.getType() == Waypoint.TYPE_WAYPOINT) {
|
||||
waypointSection.setVisibility(View.VISIBLE);
|
||||
statisticsSection.setVisibility(View.GONE);
|
||||
@@ -83,7 +89,7 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity {
|
||||
StatsUtils.setLocationValues(this, waypoint.getLocation(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.marker_detail, menu);
|
||||
|
||||
Reference in New Issue
Block a user