rename TrackDetail to TrackEditActivity

This commit is contained in:
Jimmy Shih
2012-03-27 16:41:14 -07:00
parent 6afa67acad
commit 0091755c70
8 changed files with 52 additions and 58 deletions
+2 -2
View File
@@ -245,8 +245,8 @@ limitations under the License.
android:value="com.google.android.apps.mytracks.SearchActivity" /> android:value="com.google.android.apps.mytracks.SearchActivity" />
</activity> </activity>
<activity <activity
android:label="@string/track_detail_title" android:label="@string/track_edit_title"
android:name="com.google.android.apps.mytracks.TrackDetail" > android:name="com.google.android.apps.mytracks.TrackEditActivity" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.EDIT" />
@@ -35,7 +35,7 @@ limitations under the License.
<TextView <TextView
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:text="@string/track_detail_track_name" android:text="@string/track_edit_track_name"
/> />
<LinearLayout <LinearLayout
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -53,8 +53,8 @@ limitations under the License.
/> />
<EditText <EditText
android:inputType="textAutoCorrect|textCapWords" android:inputType="textAutoCorrect|textCapWords"
android:hint="@string/track_detail_track_name" android:hint="@string/track_edit_track_name"
android:id="@+id/track_detail_track_name" android:id="@+id/track_edit_track_name"
android:imeOptions="actionNext" android:imeOptions="actionNext"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@@ -65,24 +65,24 @@ limitations under the License.
<TextView <TextView
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:text="@string/track_detail_activity_type" android:text="@string/track_edit_activity_type"
/> />
<AutoCompleteTextView <AutoCompleteTextView
android:id="@+id/track_detail_activity_type" android:id="@+id/track_edit_activity_type"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:hint="@string/track_detail_activity_type_hint" android:hint="@string/track_edit_activity_type_hint"
android:imeOptions="actionNext"/> android:imeOptions="actionNext"/>
<TextView <TextView
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:text="@string/track_detail_track_description" android:text="@string/track_edit_track_description"
/> />
<EditText <EditText
android:inputType="textAutoCorrect|textCapSentences" android:inputType="textAutoCorrect|textCapSentences"
android:hint="@string/track_detail_track_description" android:hint="@string/track_edit_track_description"
android:id="@+id/track_detail_track_description" android:id="@+id/track_edit_track_description"
android:imeOptions="actionDone" android:imeOptions="actionDone"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@@ -95,13 +95,13 @@ limitations under the License.
<LinearLayout style="@style/ButtonLayout"> <LinearLayout style="@style/ButtonLayout">
<LinearLayout style="@style/ButtonSpacer"/> <LinearLayout style="@style/ButtonSpacer"/>
<Button <Button
android:id="@+id/track_detail_save" android:id="@+id/track_edit_save"
android:layout_gravity="left" android:layout_gravity="left"
android:text="@string/generic_save" android:text="@string/generic_save"
style="@style/Button" style="@style/Button"
/> />
<Button <Button
android:id="@+id/track_detail_cancel" android:id="@+id/track_edit_cancel"
android:layout_gravity="right" android:layout_gravity="right"
android:text="@string/generic_cancel" android:text="@string/generic_cancel"
style="@style/Button" style="@style/Button"
+18 -25
View File
@@ -2237,40 +2237,33 @@ limitations under the License.
Total time Total time
</string> </string>
<!-- Track --> <!-- Track Edit -->
<string name="track_detail_activity_type" <string name="track_edit_activity_type"
translation_description="In the detail page for a track, the text field for the activity type, translation_description="In the page to edit a track, the title for the text field to edit the
including for examples. activity type, including some examples of activity types.">
Screenshot: track_detail.png">
Activity type (e.g. hiking, cycling, running...) Activity type (e.g. hiking, cycling, running...)
</string> </string>
<string name="track_detail_activity_type_hint" <string name="track_edit_activity_type_hint"
translation_description="In the detail page for a track, the hint in the 'Activity type' text translation_description="In the page to edit a track, the hint in the 'Activity type' text field
field when it is empty. when it is empty.">
Screenshot: track_detail.png">
Activity type Activity type
</string> </string>
<string name="track_detail_title" <string name="track_edit_title"
translation_description="In the detail page for a track, the title of the page. translation_description="The title of the page to edit a track.">
Edit track
Screenshot: track_detail.png">
Track details
</string> </string>
<string name="track_detail_track_description" <string name="track_edit_track_description"
translation_description="In the detail page for a track, the text field for the track translation_description="In the page to edit a track, the title for the text field to edit the
description. track description.">
Screenshot: track_detail.png">
Track description Track description
</string> </string>
<string name="track_detail_track_name" <string name="track_edit_track_name"
translation_description="In the detail page for a track, the text field for the track name. translation_description="In the page to edit a track, the title for the text field to edit the
track name.">
Screenshot: track_detail.png">
Track name Track name
</string> </string>
<!-- Track -->
<string name="track_icon_description" <string name="track_icon_description"
translation_description="The accessibility description for the track icon."> translation_description="The accessibility description for the track icon.">
Track Track
@@ -523,7 +523,8 @@ public class MapActivity extends com.google.android.maps.MapActivity
long trackId = dataHub.getSelectedTrackId(); long trackId = dataHub.getSelectedTrackId();
switch (item.getItemId()) { switch (item.getItemId()) {
case Constants.MENU_EDIT: case Constants.MENU_EDIT:
intent = new Intent(this, TrackDetail.class).putExtra(TrackDetail.TRACK_ID, trackId); intent = new Intent(this, TrackEditActivity.class)
.putExtra(TrackEditActivity.TRACK_ID, trackId);
startActivity(intent); startActivity(intent);
return true; return true;
case Constants.MENU_PLAY: case Constants.MENU_PLAY:
@@ -523,9 +523,9 @@ public class MyTracks extends TabActivity implements OnTouchListener {
serviceConnection.stop(); serviceConnection.stop();
if (currentTrackId > 0) { if (currentTrackId > 0) {
Intent intent = new Intent(MyTracks.this, TrackDetail.class); Intent intent = new Intent(MyTracks.this, TrackEditActivity.class)
intent.putExtra(TrackDetail.TRACK_ID, currentTrackId); .putExtra(TrackEditActivity.SHOW_CANCEL, false)
intent.putExtra(TrackDetail.SHOW_CANCEL, false); .putExtra(TrackEditActivity.TRACK_ID, currentTrackId);
startActivity(intent); startActivity(intent);
} }
} }
@@ -35,12 +35,12 @@ import android.widget.EditText;
* *
* @author Leif Hendrik Wilden * @author Leif Hendrik Wilden
*/ */
public class TrackDetail extends Activity implements OnClickListener { public class TrackEditActivity extends Activity implements OnClickListener {
public static final String TRACK_ID = "trackId"; public static final String TRACK_ID = "trackId";
public static final String SHOW_CANCEL = "showCancel"; public static final String SHOW_CANCEL = "showCancel";
private static final String TAG = TrackDetail.class.getSimpleName(); private static final String TAG = TrackEditActivity.class.getSimpleName();
private Long trackId; private Long trackId;
private MyTracksProviderUtils myTracksProviderUtils; private MyTracksProviderUtils myTracksProviderUtils;
@@ -53,7 +53,7 @@ public class TrackDetail extends Activity implements OnClickListener {
@Override @Override
protected void onCreate(Bundle bundle) { protected void onCreate(Bundle bundle) {
super.onCreate(bundle); super.onCreate(bundle);
setContentView(R.layout.track_detail); setContentView(R.layout.track_edit);
trackId = getIntent().getLongExtra(TRACK_ID, -1); trackId = getIntent().getLongExtra(TRACK_ID, -1);
if (trackId < 0) { if (trackId < 0) {
@@ -71,22 +71,22 @@ public class TrackDetail extends Activity implements OnClickListener {
return; return;
} }
trackName = (EditText) findViewById(R.id.track_detail_track_name); trackName = (EditText) findViewById(R.id.track_edit_track_name);
trackName.setText(track.getName()); trackName.setText(track.getName());
activityType = (AutoCompleteTextView) findViewById(R.id.track_detail_activity_type); activityType = (AutoCompleteTextView) findViewById(R.id.track_edit_activity_type);
activityType.setText(track.getCategory()); activityType.setText(track.getCategory());
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource( ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.activity_types, android.R.layout.simple_dropdown_item_1line); this, R.array.activity_types, android.R.layout.simple_dropdown_item_1line);
activityType.setAdapter(adapter); activityType.setAdapter(adapter);
trackDescription = (EditText) findViewById(R.id.track_detail_track_description); trackDescription = (EditText) findViewById(R.id.track_edit_track_description);
trackDescription.setText(track.getDescription()); trackDescription.setText(track.getDescription());
Button save = (Button) findViewById(R.id.track_detail_save); Button save = (Button) findViewById(R.id.track_edit_save);
save.setOnClickListener(this); save.setOnClickListener(this);
Button cancel = (Button) findViewById(R.id.track_detail_cancel); Button cancel = (Button) findViewById(R.id.track_edit_cancel);
if (getIntent().getBooleanExtra(SHOW_CANCEL, true)) { if (getIntent().getBooleanExtra(SHOW_CANCEL, true)) {
cancel.setOnClickListener(this); cancel.setOnClickListener(this);
cancel.setVisibility(View.VISIBLE); cancel.setVisibility(View.VISIBLE);
@@ -98,11 +98,11 @@ public class TrackDetail extends Activity implements OnClickListener {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.track_detail_save: case R.id.track_edit_save:
save(); save();
finish(); finish();
break; break;
case R.id.track_detail_cancel: case R.id.track_edit_cancel:
finish(); finish();
break; break;
default: default:
@@ -348,9 +348,9 @@ public class TrackListActivity extends FragmentActivity {
try { try {
service.endCurrentTrack(); service.endCurrentTrack();
if (recordingTrackId != -1L) { if (recordingTrackId != -1L) {
Intent intent = new Intent(this, TrackDetail.class) Intent intent = new Intent(this, TrackEditActivity.class)
.putExtra(TrackDetail.SHOW_CANCEL, false) .putExtra(TrackEditActivity.SHOW_CANCEL, false)
.putExtra(TrackDetail.TRACK_ID, recordingTrackId); .putExtra(TrackEditActivity.TRACK_ID, recordingTrackId);
startActivity(intent); startActivity(intent);
} }
recordingTrackId = -1L; recordingTrackId = -1L;
@@ -154,7 +154,7 @@ public class MyTracksTest extends ActivityInstrumentationTestCase2<MyTracks>{
// Watch for MyTracksDetails activity. // Watch for MyTracksDetails activity.
ActivityMonitor monitor = getInstrumentation().addMonitor( ActivityMonitor monitor = getInstrumentation().addMonitor(
TrackDetail.class.getName(), null, false); TrackEditActivity.class.getName(), null, false);
// Now, stop the track and make sure that it is still selected, but // Now, stop the track and make sure that it is still selected, but
// no longer recording. // no longer recording.
@@ -162,13 +162,13 @@ public class MyTracksTest extends ActivityInstrumentationTestCase2<MyTracks>{
// Check if we got back MyTracksDetails activity. // Check if we got back MyTracksDetails activity.
Activity activity = getInstrumentation().waitForMonitor(monitor); Activity activity = getInstrumentation().waitForMonitor(monitor);
assertTrue(activity instanceof TrackDetail); assertTrue(activity instanceof TrackEditActivity);
// TODO: Update track name and other properties and test if they were // TODO: Update track name and other properties and test if they were
// properly saved. // properly saved.
// Simulate a click on Save button. // Simulate a click on Save button.
final Button save = (Button) activity.findViewById(R.id.track_detail_save); final Button save = (Button) activity.findViewById(R.id.track_edit_save);
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {