merge heads

This commit is contained in:
Jimmy Shih
2012-04-11 10:13:01 -07:00
11 changed files with 165 additions and 140 deletions
+1 -12
View File
@@ -193,18 +193,7 @@ limitations under the License.
</intent-filter>
</activity>
<activity android:name="com.google.android.apps.mytracks.TrackDetailActivity" />
<activity
android:label="@string/track_edit_title"
android:name="com.google.android.apps.mytracks.TrackEditActivity" >
<intent-filter>
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.google.track" />
</intent-filter>
</activity>
<activity android:name="com.google.android.apps.mytracks.TrackEditActivity" />
<activity android:name="com.google.android.apps.mytracks.TrackListActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -0,0 +1,26 @@
<?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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
<Button
android:id="@+id/track_edit_cancel"
android:text="@string/generic_cancel"
style="@style/BottomButton" />
<Button
android:id="@+id/track_edit_save"
android:text="@string/generic_save"
style="@style/BottomButton" />
</merge>
+1 -1
View File
@@ -24,7 +24,7 @@ limitations under the License.
android:layout_width="fill_parent" >
<include layout="@layout/welcome" />
</ScrollView>
<LinearLayout style="@style/BottomBar" >
<LinearLayout style="@style/BottomButtonBar" >
<include layout="@layout/help_buttons" />
</LinearLayout>
</LinearLayout>
@@ -486,7 +486,7 @@ limitations under the License.
</TableLayout>
</LinearLayout>
</ScrollView>
<LinearLayout style="@style/BottomBar" >
<LinearLayout style="@style/BottomButtonBar" >
<Button
android:id="@+id/waypointdetails_save"
android:text="@string/generic_save"
@@ -39,7 +39,7 @@ limitations under the License.
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<LinearLayout style="@style/BottomBar" >
<LinearLayout style="@style/BottomButtonBar" >
<Button
android:id="@+id/waypointslist_btn_insert_statistics"
android:text="@string/marker_list_insert_statistics"
+36 -73
View File
@@ -14,92 +14,55 @@ 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.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical"
>
android:orientation="vertical" >
<ScrollView
android:background="@color/black"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="fill_parent"
>
<LinearLayout
android:layout_width="fill_parent" >
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical"
android:padding="4dp"
>
android:padding="8dp" >
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/track_edit_track_name"
/>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal"
>
<ImageView
android:contentDescription="@string/track_icon_description"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:src="@drawable/track"
/>
<EditText
android:inputType="textAutoCorrect|textCapWords"
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"
android:selectAllOnFocus="true"
android:singleLine="true"
/>
</LinearLayout>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/track_edit_activity_type"
/>
<AutoCompleteTextView
android:id="@+id/track_edit_activity_type"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
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_edit_track_description"
/>
android:text="@string/track_edit_name"
style="@style/TrackEditLabelTextView" />
<EditText
android:inputType="textAutoCorrect|textCapSentences"
android:hint="@string/track_edit_track_description"
android:id="@+id/track_edit_track_description"
android:drawableLeft="@drawable/track"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:hint="@string/track_edit_name"
android:id="@+id/track_edit_name"
android:imeOptions="actionNext"
android:inputType="textAutoCorrect|textCapWords"
android:singleLine="true"
style="@style/TrackEditValueEditText" />
<TextView
android:text="@string/track_edit_activity_type"
style="@style/TrackEditLabelTextView" />
<AutoCompleteTextView
android:hint="@string/track_edit_activity_type_hint"
android:id="@+id/track_edit_activity_type"
android:imeOptions="actionNext"
android:singleLine="true"
style="@style/TrackEditValueEditText" />
<TextView
android:text="@string/track_edit_description"
style="@style/TrackEditLabelTextView" />
<EditText
android:hint="@string/track_edit_description"
android:id="@+id/track_edit_description"
android:imeOptions="actionDone"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:inputType="textAutoCorrect|textCapSentences"
android:maxLines="50"
android:selectAllOnFocus="true"
android:singleLine="false"
/>
style="@style/TrackEditValueEditText" />
</LinearLayout>
</ScrollView>
<LinearLayout style="@style/BottomBar" >
<Button
android:id="@+id/track_edit_save"
android:text="@string/generic_save"
style="@style/BottomButton" />
<Button
android:id="@+id/track_edit_cancel"
android:text="@string/generic_cancel"
style="@style/BottomButton" />
<LinearLayout style="@style/BottomButtonBar" >
<include layout="@layout/track_edit_buttons" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
@@ -0,0 +1,26 @@
<?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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
<Button
android:id="@+id/track_edit_save"
android:text="@string/generic_save"
style="@style/BottomButton" />
<Button
android:id="@+id/track_edit_cancel"
android:text="@string/generic_cancel"
style="@style/BottomButton" />
</merge>
+12 -12
View File
@@ -2193,28 +2193,28 @@ limitations under the License.
Track
</string>
<string name="track_edit_activity_type"
translation_description="In the page to edit a track, the title for the text field to edit the
translation_description="In the page to edit a track, the label for the text field to edit the
activity type, including some examples of activity types.">
Activity type (e.g. hiking, cycling, running...)
Activity type (e.g. hiking, cycling...)
</string>
<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_edit_title"
translation_description="The title of the page to edit a track.">
Edit track
</string>
<string name="track_edit_track_description"
translation_description="In the page to edit a track, the title for the text field to edit the
<string name="track_edit_description"
translation_description="In the page to edit a track, the label for the text field to edit the
track description.">
Track description
Description
</string>
<string name="track_edit_track_name"
translation_description="In the page to edit a track, the title for the text field to edit the
<string name="track_edit_name"
translation_description="In the page to edit a track, the label for the text field to edit the
track name.">
Track name
Name
</string>
<string name="track_edit_new_track_title"
translation_description="The title of the track edit page when saving a new track.">
New Track
</string>
<string name="track_list_delete_all_confirm_message"
translation_description="When deleting all the tracks, the confirmation dialog message informing
+18 -8
View File
@@ -17,14 +17,13 @@ limitations under the License.
<resources>
<style name="ThemeSelector" parent="android:Theme" />
<!-- Bottom Bar -->
<style name="BottomBar" parent="@android:style/DeviceDefault.ButtonBar">
<!-- The style for the bottom button bar -->
<style name="BottomButtonBar" parent="@android:style/DeviceDefault.ButtonBar">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:orientation">horizontal</item>
</style>
<!-- Bottom Button -->
<!-- The style for the bottom button -->
<style name="BottomButton" parent="@android:style/Widget.DeviceDefault.Button.Borderless">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
@@ -109,7 +108,19 @@ limitations under the License.
<item name="android:textColor">@color/stat_label_text</item>
</style>
<!-- The TextView showing the stats in the track list item -->
<!-- The style for the label in track_edit.xml -->
<style name="TrackEditLabelTextView" 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 the value in track_edit.xml -->
<style name="TrackEditValueEditText" parent="@android:style/TextAppearance.DeviceDefault.Medium">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:selectAllOnFocus">true</item>
</style>
<!-- The style for the stats in track_list_item.xml -->
<style name="TrackListItemStatsTextView" parent="@android:style/TextAppearance.DeviceDefault.Small">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
@@ -117,14 +128,13 @@ limitations under the License.
<item name="android:textColor">@color/green</item>
</style>
<!-- The welcome activity answer TextView -->
<!-- The style for the answer in welcome.xml -->
<style name="WelcomeAnswerTextView" parent="@android:style/TextAppearance.DeviceDefault.Small">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:paddingBottom">8dp</item>
</style>
<!-- The welcome activity question TextView -->
<!-- The style for the question in welcome.xml -->
<style name="WelcomeQuestionTextView" parent="@android:style/TextAppearance.DeviceDefault.Medium">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
@@ -13,15 +13,19 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
import com.google.android.apps.mytracks.content.Track;
import com.google.android.apps.mytracks.util.ApiAdapterFactory;
import com.google.android.maps.mytracks.R;
import android.app.Activity;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
@@ -32,7 +36,7 @@ import android.widget.EditText;
/**
* An activity that let's the user see and edit the user editable track meta
* data such as track name, activity type, and track description.
*
*
* @author Leif Hendrik Wilden
*/
public class TrackEditActivity extends Activity implements OnClickListener {
@@ -46,33 +50,34 @@ public class TrackEditActivity extends Activity implements OnClickListener {
private MyTracksProviderUtils myTracksProviderUtils;
private Track track;
private EditText trackName;
private EditText name;
private AutoCompleteTextView activityType;
private EditText trackDescription;
private EditText description;
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setVolumeControlStream(TextToSpeech.Engine.DEFAULT_STREAM);
ApiAdapterFactory.getApiAdapter().configureActionBarHomeAsUp(this);
setContentView(R.layout.track_edit);
trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1);
if (trackId < 0) {
Log.e(TAG, "invalid trackId.");
trackId = getIntent().getLongExtra(EXTRA_TRACK_ID, -1L);
if (trackId == -1L) {
Log.e(TAG, "invalid trackId");
finish();
return;
}
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(this);
track = myTracksProviderUtils.getTrack(trackId);
if (track == null) {
Log.e(TAG, "no track.");
Log.e(TAG, "no track");
finish();
return;
}
trackName = (EditText) findViewById(R.id.track_edit_track_name);
trackName.setText(track.getName());
name = (EditText) findViewById(R.id.track_edit_name);
name.setText(track.getName());
activityType = (AutoCompleteTextView) findViewById(R.id.track_edit_activity_type);
activityType.setText(track.getCategory());
@@ -80,40 +85,40 @@ public class TrackEditActivity extends Activity implements OnClickListener {
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_edit_track_description);
trackDescription.setText(track.getDescription());
description = (EditText) findViewById(R.id.track_edit_description);
description.setText(track.getDescription());
Button save = (Button) findViewById(R.id.track_edit_save);
save.setOnClickListener(this);
Button cancel = (Button) findViewById(R.id.track_edit_cancel);
if (getIntent().getBooleanExtra(EXTRA_SHOW_CANCEL, true)) {
setTitle(R.string.menu_edit);
cancel.setOnClickListener(this);
cancel.setVisibility(View.VISIBLE);
} else {
cancel.setVisibility(View.INVISIBLE);
setTitle(R.string.track_edit_new_track_title);
cancel.setVisibility(View.GONE);
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.track_edit_save:
save();
finish();
break;
case R.id.track_edit_cancel:
finish();
break;
default:
finish();
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() != android.R.id.home) {
return false;
}
finish();
return true;
}
private void save() {
track.setName(trackName.getText().toString());
track.setCategory(activityType.getText().toString());
track.setDescription(trackDescription.getText().toString());
myTracksProviderUtils.updateTrack(track);
@Override
public void onClick(View view) {
if (view.getId() == R.id.track_edit_save) {
track.setName(name.getText().toString());
track.setCategory(activityType.getText().toString());
track.setDescription(description.getText().toString());
myTracksProviderUtils.updateTrack(track);
}
finish();
}
}
@@ -387,14 +387,20 @@ public class TrackListActivity extends FragmentActivity {
ITrackRecordingService service = trackRecordingServiceConnection.getServiceIfBound();
if (service != null) {
try {
/*
* Remembers the recordingTrackId before endCurrentTrack sets the shared
* preferences, R.string.recording_track_key, to -1L, and the
* sharedPreferenceChangedListener sets the recordingTrackId variable to
* -1L.
*/
long trackId = recordingTrackId;
service.endCurrentTrack();
if (recordingTrackId != -1L) {
if (trackId != -1L) {
Intent intent = new Intent(this, TrackEditActivity.class)
.putExtra(TrackEditActivity.EXTRA_SHOW_CANCEL, false)
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, recordingTrackId);
.putExtra(TrackEditActivity.EXTRA_TRACK_ID, trackId);
startActivity(intent);
}
recordingTrackId = -1L;
} catch (Exception e) {
Log.d(TAG, "Unable to stop recording.", e);
}