Several minor fixes

- for TrackEdit and MarkerEdit, use windowSoftInputMode=stateHidden
- improve layout for the map in MapFragment.
- fix text size for API level < 14.
- fix bug when inserting a statistics marker with a modified name
This commit is contained in:
Jimmy Shih
2012-04-23 14:57:39 -07:00
parent 8f801b1bdb
commit 2ea4b09dcc
11 changed files with 66 additions and 14 deletions
+3 -1
View File
@@ -178,7 +178,9 @@ limitations under the License.
android:label="@string/settings_title" android:label="@string/settings_title"
android:name="com.google.android.apps.mytracks.SettingsActivity" /> android:name="com.google.android.apps.mytracks.SettingsActivity" />
<activity android:name="com.google.android.apps.mytracks.TrackDetailActivity" /> <activity android:name="com.google.android.apps.mytracks.TrackDetailActivity" />
<activity android:name="com.google.android.apps.mytracks.TrackEditActivity" /> <activity
android:name="com.google.android.apps.mytracks.TrackEditActivity"
android:windowSoftInputMode="stateHidden" />
<activity android:name="com.google.android.apps.mytracks.TrackListActivity" > <activity android:name="com.google.android.apps.mytracks.TrackListActivity" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
+5 -2
View File
@@ -27,11 +27,14 @@ limitations under the License.
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_width="fill_parent" /> android:layout_width="fill_parent" />
<TextView <TextView
android:background="@android:color/darker_gray" android:background="@color/background_warning"
android:drawableLeft="@android:drawable/ic_dialog_alert"
android:gravity="center"
android:id="@+id/map_message" android:id="@+id/map_message"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:padding="8dp" android:padding="8dp"
android:textColor="@android:color/primary_text_dark"
android:visibility="gone" android:visibility="gone"
style="@style/TextMedium" /> style="@style/TextMedium.WithIcon" />
</RelativeLayout> </RelativeLayout>
+1
View File
@@ -40,6 +40,7 @@ limitations under the License.
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:shrinkColumns="0,2" android:shrinkColumns="0,2"
android:stretchColumns="0,2" > android:stretchColumns="0,2" >
<include layout="@layout/stats_core" /> <include layout="@layout/stats_core" />
+33
View File
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2012 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<!-- The style for large size text -->
<style name="TextLarge" parent="@android:style/TextAppearance.DeviceDefault.Large">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
<!-- The style for medium size text -->
<style name="TextMedium" parent="@android:style/TextAppearance.DeviceDefault.Medium">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
<!-- The style for large size text -->
<style name="TextSmall" parent="@android:style/TextAppearance.DeviceDefault.Small">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
</resources>
+3
View File
@@ -21,6 +21,9 @@ limitations under the License.
<color name="red">#FFFF0000</color> <color name="red">#FFFF0000</color>
<color name="white">#FFFFFFFF</color> <color name="white">#FFFFFFFF</color>
<!-- holo_orange_dark -->
<color name="background_warning">#FFFF8800</color>
<!-- Chart colors by series. --> <!-- Chart colors by series. -->
<!-- Green and a transparent green --> <!-- Green and a transparent green -->
<color name="elevation_border">#FF339933</color> <color name="elevation_border">#FF339933</color>
+2 -2
View File
@@ -695,8 +695,8 @@ limitations under the License.
<string name="gps_need_to_enable" <string name="gps_need_to_enable"
translation_description="In the main view, the message on the top asking the user to enable translation_description="In the main view, the message on the top asking the user to enable
GPS."> GPS.">
Please tap here to go to \'Location &amp; security\' settings &amp; check Tap here to go to \'Location services\' settings &amp; check \'GPS satellites\'. Press the back
\'Use GPS satellites\'. Press the back button to return. button to return.
</string> </string>
<string name="gps_not_found" <string name="gps_not_found"
translation_description="On application start, message when there is no GPS on the device."> translation_description="On application start, message when there is no GPS on the device.">
+9 -3
View File
@@ -79,6 +79,7 @@ limitations under the License.
<item name="android:background">@android:color/background_light</item> <item name="android:background">@android:color/background_light</item>
<item name="android:gravity">right</item> <item name="android:gravity">right</item>
<item name="android:layout_width">fill_parent</item> <item name="android:layout_width">fill_parent</item>
<item name="android:paddingRight">8dp</item>
<item name="android:textColor">@android:color/primary_text_light</item> <item name="android:textColor">@android:color/primary_text_light</item>
</style> </style>
<!-- The style for the stats label --> <!-- The style for the stats label -->
@@ -97,12 +98,14 @@ limitations under the License.
<item name="android:gravity">right</item> <item name="android:gravity">right</item>
<item name="android:layout_weight">1</item> <item name="android:layout_weight">1</item>
<item name="android:layout_width">0dp</item> <item name="android:layout_width">0dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:textColor">@android:color/primary_text_light</item> <item name="android:textColor">@android:color/primary_text_light</item>
</style> </style>
<!-- The style for large size text --> <!-- The style for large size text -->
<style name="TextLarge" parent="@android:style/TextAppearance.DeviceDefault.Large"> <style name="TextLarge">
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:textSize">22sp</item>
</style> </style>
<!-- The style for large size text with an icon on the left --> <!-- The style for large size text with an icon on the left -->
<style name="TextLarge.WithIcon"> <style name="TextLarge.WithIcon">
@@ -110,9 +113,10 @@ limitations under the License.
<item name="android:gravity">center_vertical</item> <item name="android:gravity">center_vertical</item>
</style> </style>
<!-- The style for medium size text --> <!-- The style for medium size text -->
<style name="TextMedium" parent="@android:style/TextAppearance.DeviceDefault.Medium"> <style name="TextMedium">
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:textSize">18sp</item>
</style> </style>
<!-- The style for medium size text with an icon on the left --> <!-- The style for medium size text with an icon on the left -->
<style name="TextMedium.WithIcon"> <style name="TextMedium.WithIcon">
@@ -120,9 +124,11 @@ limitations under the License.
<item name="android:gravity">center_vertical</item> <item name="android:gravity">center_vertical</item>
</style> </style>
<!-- The style for large size text --> <!-- The style for large size text -->
<style name="TextSmall" parent="@android:style/TextAppearance.DeviceDefault.Small"> <style name="TextSmall">
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:textColor">?android:textColorSecondary</item>
<item name="android:textSize">14sp</item>
</style> </style>
<!-- Theme selector --> <!-- Theme selector -->
<style name="ThemeSelector" parent="android:Theme" /> <style name="ThemeSelector" parent="android:Theme" />
@@ -40,7 +40,7 @@ public class AbstractMyTracksActivity extends FragmentActivity {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() != android.R.id.home) { if (item.getItemId() != android.R.id.home) {
return false; return super.onOptionsItemSelected(item);
} }
onHomeSelected(); onHomeSelected();
return true; return true;
@@ -79,6 +79,8 @@ public class MarkerEditActivity extends AbstractMyTracksActivity {
boolean statistics = checkedId == R.id.marker_edit_type_statistics; boolean statistics = checkedId == R.id.marker_edit_type_statistics;
name.setText( name.setText(
statistics ? R.string.marker_edit_type_statistics : R.string.marker_edit_type_waypoint); statistics ? R.string.marker_edit_type_statistics : R.string.marker_edit_type_waypoint);
// Call selectAll so that all EditText have selectAllOnFocus style.
name.selectAll();
updateUiByMarkerType(statistics); updateUiByMarkerType(statistics);
} }
}); });
@@ -365,7 +365,7 @@ public class TrackDetailActivity extends AbstractMyTracksActivity {
startActivity(intent); startActivity(intent);
return true; return true;
default: default:
return false; return super.onOptionsItemSelected(item);
} }
} }
@@ -941,7 +941,7 @@ public class TrackRecordingService extends Service {
buildMarker(wpt, request); buildMarker(wpt, request);
break; break;
case STATISTICS: case STATISTICS:
buildStatisticsMarker(wpt); buildStatisticsMarker(wpt, request);
break; break;
} }
wpt.setTrackId(recordingTrackId); wpt.setTrackId(recordingTrackId);
@@ -987,9 +987,10 @@ public class TrackRecordingService extends Service {
* Build a statistics marker. * Build a statistics marker.
* A statistics marker holds the stats for the* last segment up to this marker. * A statistics marker holds the stats for the* last segment up to this marker.
* *
* @param waypoint The waypoint which will be populated with stats data. * @param waypoint The waypoint which will be populated with stats data
* @param request The waypoint creation request
*/ */
private void buildStatisticsMarker(Waypoint waypoint) { private void buildStatisticsMarker(Waypoint waypoint, WaypointCreationRequest request) {
DescriptionGenerator descriptionGenerator = new DescriptionGeneratorImpl(this); DescriptionGenerator descriptionGenerator = new DescriptionGeneratorImpl(this);
// Set stop and total time in the stats data // Set stop and total time in the stats data
@@ -1002,7 +1003,8 @@ public class TrackRecordingService extends Service {
// Set the rest of the waypoint data // Set the rest of the waypoint data
waypoint.setType(Waypoint.TYPE_STATISTICS); waypoint.setType(Waypoint.TYPE_STATISTICS);
waypoint.setName(getString(R.string.marker_edit_type_statistics)); waypoint.setName(request.getName() != null ? request.getName()
: getString(R.string.marker_edit_type_statistics));
waypoint.setStatistics(waypointStatsBuilder.getStatistics()); waypoint.setStatistics(waypointStatsBuilder.getStatistics());
waypoint.setDescription(descriptionGenerator.generateWaypointDescription(waypoint)); waypoint.setDescription(descriptionGenerator.generateWaypointDescription(waypoint));
waypoint.setIcon(getString(R.string.marker_statistics_icon_url)); waypoint.setIcon(getString(R.string.marker_statistics_icon_url));