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:
Jimmy Shih
2012-05-10 18:57:41 -07:00
parent b0207e5cd7
commit 2085e82312
4 changed files with 37 additions and 14 deletions
+16 -8
View File
@@ -31,19 +31,27 @@ limitations under the License.
android:orientation="vertical" > android:orientation="vertical" >
<TextView <TextView
android:id="@+id/marker_detail_waypoint_marker_type" android:id="@+id/marker_detail_waypoint_marker_type"
style="@style/TextLarge" /> style="@style/TextLarge.WithTopMargin" />
<TextView <TextView
android:id="@+id/marker_detail_waypoint_description" android:id="@+id/marker_detail_waypoint_description"
style="@style/TextLarge" /> style="@style/TextLarge.WithTopMargin" />
</LinearLayout> </LinearLayout>
<TableLayout <LinearLayout
android:id="@+id/marker_detail_statistics_section" android:id="@+id/marker_detail_statistics_section"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:paddingTop="8dp" android:orientation="vertical" >
android:shrinkColumns="0,2" <TextView
android:stretchColumns="0,2" > android:text="@string/marker_detail_statistics_title"
<include layout="@layout/stats_core" /> style="@style/TextLarge.WithTopMargin" />
</TableLayout> <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> </LinearLayout>
</ScrollView> </ScrollView>
+5
View File
@@ -965,6 +965,11 @@ limitations under the License.
%1$s marker type. E.g., 'building'."> %1$s marker type. E.g., 'building'.">
Marker type: %1$s Marker type: %1$s
</string> </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" <string name="marker_edit_marker_type"
translation_description="In the marker edit page, the label for the marker type, including some translation_description="In the marker edit page, the label for the marker type, including some
exmaples."> exmaples.">
+4
View File
@@ -122,6 +122,10 @@ limitations under the License.
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:textSize">22sp</item> <item name="android:textSize">22sp</item>
</style> </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 --> <!-- The style for medium size text -->
<style name="TextMedium"> <style name="TextMedium">
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
@@ -44,6 +44,10 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity {
private long markerId; private long markerId;
private Waypoint waypoint; private Waypoint waypoint;
private TextView name;
private View waypointSection;
private View statisticsSection;
@Override @Override
protected void onCreate(Bundle bundle) { protected void onCreate(Bundle bundle) {
super.onCreate(bundle); super.onCreate(bundle);
@@ -55,19 +59,21 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity {
finish(); finish();
return; 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); waypoint = MyTracksProviderUtils.Factory.get(this).getWaypoint(markerId);
if (waypoint == null) { if (waypoint == null) {
Log.d(TAG, "waypoint is null"); Log.d(TAG, "waypoint is null");
finish(); finish();
return; return;
} }
TextView name = (TextView) findViewById(R.id.marker_detail_name);
name.setText(getString(R.string.marker_detail_name, waypoint.getName())); 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) { if (waypoint.getType() == Waypoint.TYPE_WAYPOINT) {
waypointSection.setVisibility(View.VISIBLE); waypointSection.setVisibility(View.VISIBLE);
statisticsSection.setVisibility(View.GONE); statisticsSection.setVisibility(View.GONE);
@@ -83,7 +89,7 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity {
StatsUtils.setLocationValues(this, waypoint.getLocation(), false); StatsUtils.setLocationValues(this, waypoint.getLocation(), false);
} }
} }
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.marker_detail, menu); getMenuInflater().inflate(R.menu.marker_detail, menu);