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" />
</activity>
<activity
android:label="@string/track_detail_title"
android:name="com.google.android.apps.mytracks.TrackDetail" >
android:label="@string/track_edit_title"
android:name="com.google.android.apps.mytracks.TrackEditActivity" >
<intent-filter>
<action android:name="android.intent.action.EDIT" />
@@ -35,7 +35,7 @@ limitations under the License.
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/track_detail_track_name"
android:text="@string/track_edit_track_name"
/>
<LinearLayout
android:layout_height="wrap_content"
@@ -53,8 +53,8 @@ limitations under the License.
/>
<EditText
android:inputType="textAutoCorrect|textCapWords"
android:hint="@string/track_detail_track_name"
android:id="@+id/track_detail_track_name"
android:hint="@string/track_edit_track_name"
android:id="@+id/track_edit_track_name"
android:imeOptions="actionNext"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
@@ -65,24 +65,24 @@ limitations under the License.
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/track_detail_activity_type"
android:text="@string/track_edit_activity_type"
/>
<AutoCompleteTextView
android:id="@+id/track_detail_activity_type"
android:id="@+id/track_edit_activity_type"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:hint="@string/track_detail_activity_type_hint"
android:hint="@string/track_edit_activity_type_hint"
android:imeOptions="actionNext"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/track_detail_track_description"
android:text="@string/track_edit_track_description"
/>
<EditText
android:inputType="textAutoCorrect|textCapSentences"
android:hint="@string/track_detail_track_description"
android:id="@+id/track_detail_track_description"
android:hint="@string/track_edit_track_description"
android:id="@+id/track_edit_track_description"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
@@ -95,13 +95,13 @@ limitations under the License.
<LinearLayout style="@style/ButtonLayout">
<LinearLayout style="@style/ButtonSpacer"/>
<Button
android:id="@+id/track_detail_save"
android:id="@+id/track_edit_save"
android:layout_gravity="left"
android:text="@string/generic_save"
style="@style/Button"
/>
<Button
android:id="@+id/track_detail_cancel"
android:id="@+id/track_edit_cancel"
android:layout_gravity="right"
android:text="@string/generic_cancel"
style="@style/Button"
+18 -25
View File
@@ -2237,40 +2237,33 @@ limitations under the License.
Total time
</string>
<!-- Track -->
<string name="track_detail_activity_type"
translation_description="In the detail page for a track, the text field for the activity type,
including for examples.
Screenshot: track_detail.png">
<!-- Track Edit -->
<string name="track_edit_activity_type"
translation_description="In the page to edit a track, the title for the text field to edit the
activity type, including some examples of activity types.">
Activity type (e.g. hiking, cycling, running...)
</string>
<string name="track_detail_activity_type_hint"
translation_description="In the detail page for a track, the hint in the 'Activity type' text
field when it is empty.
Screenshot: track_detail.png">
<string name="track_edit_activity_type_hint"
translation_description="In the page to edit a track, the hint in the 'Activity type' text field
when it is empty.">
Activity type
</string>
<string name="track_detail_title"
translation_description="In the detail page for a track, the title of the page.
Screenshot: track_detail.png">
Track details
<string name="track_edit_title"
translation_description="The title of the page to edit a track.">
Edit track
</string>
<string name="track_detail_track_description"
translation_description="In the detail page for a track, the text field for the track
description.
Screenshot: track_detail.png">
<string name="track_edit_track_description"
translation_description="In the page to edit a track, the title for the text field to edit the
track description.">
Track description
</string>
<string name="track_detail_track_name"
translation_description="In the detail page for a track, the text field for the track name.
Screenshot: track_detail.png">
<string name="track_edit_track_name"
translation_description="In the page to edit a track, the title for the text field to edit the
track name.">
Track name
</string>
<!-- Track -->
<string name="track_icon_description"
translation_description="The accessibility description for the track icon.">
Track
@@ -523,7 +523,8 @@ public class MapActivity extends com.google.android.maps.MapActivity
long trackId = dataHub.getSelectedTrackId();
switch (item.getItemId()) {
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);
return true;
case Constants.MENU_PLAY:
@@ -523,9 +523,9 @@ public class MyTracks extends TabActivity implements OnTouchListener {
serviceConnection.stop();
if (currentTrackId > 0) {
Intent intent = new Intent(MyTracks.this, TrackDetail.class);
intent.putExtra(TrackDetail.TRACK_ID, currentTrackId);
intent.putExtra(TrackDetail.SHOW_CANCEL, false);
Intent intent = new Intent(MyTracks.this, TrackEditActivity.class)
.putExtra(TrackEditActivity.SHOW_CANCEL, false)
.putExtra(TrackEditActivity.TRACK_ID, currentTrackId);
startActivity(intent);
}
}
@@ -35,12 +35,12 @@ import android.widget.EditText;
*
* @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 SHOW_CANCEL = "showCancel";
private static final String TAG = TrackDetail.class.getSimpleName();
private static final String TAG = TrackEditActivity.class.getSimpleName();
private Long trackId;
private MyTracksProviderUtils myTracksProviderUtils;
@@ -53,7 +53,7 @@ public class TrackDetail extends Activity implements OnClickListener {
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.track_detail);
setContentView(R.layout.track_edit);
trackId = getIntent().getLongExtra(TRACK_ID, -1);
if (trackId < 0) {
@@ -71,22 +71,22 @@ public class TrackDetail extends Activity implements OnClickListener {
return;
}
trackName = (EditText) findViewById(R.id.track_detail_track_name);
trackName = (EditText) findViewById(R.id.track_edit_track_name);
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());
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.activity_types, android.R.layout.simple_dropdown_item_1line);
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());
Button save = (Button) findViewById(R.id.track_detail_save);
Button save = (Button) findViewById(R.id.track_edit_save);
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)) {
cancel.setOnClickListener(this);
cancel.setVisibility(View.VISIBLE);
@@ -98,11 +98,11 @@ public class TrackDetail extends Activity implements OnClickListener {
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.track_detail_save:
case R.id.track_edit_save:
save();
finish();
break;
case R.id.track_detail_cancel:
case R.id.track_edit_cancel:
finish();
break;
default:
@@ -348,9 +348,9 @@ public class TrackListActivity extends FragmentActivity {
try {
service.endCurrentTrack();
if (recordingTrackId != -1L) {
Intent intent = new Intent(this, TrackDetail.class)
.putExtra(TrackDetail.SHOW_CANCEL, false)
.putExtra(TrackDetail.TRACK_ID, recordingTrackId);
Intent intent = new Intent(this, TrackEditActivity.class)
.putExtra(TrackEditActivity.SHOW_CANCEL, false)
.putExtra(TrackEditActivity.TRACK_ID, recordingTrackId);
startActivity(intent);
}
recordingTrackId = -1L;
@@ -154,7 +154,7 @@ public class MyTracksTest extends ActivityInstrumentationTestCase2<MyTracks>{
// Watch for MyTracksDetails activity.
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
// no longer recording.
@@ -162,13 +162,13 @@ public class MyTracksTest extends ActivityInstrumentationTestCase2<MyTracks>{
// Check if we got back MyTracksDetails activity.
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
// properly saved.
// 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() {
@Override
public void run() {