- Fix flag in My Tracks notification to update the previous notification.

- move chart settings above settings
- remove My Tracks Importer, thus just using My Tracks
- rename to Save all to SD card...
- rename to Import from SD card
This commit is contained in:
Jimmy Shih
2012-04-27 13:24:00 -07:00
parent 1a23ba673c
commit 20eec8d30a
14 changed files with 111 additions and 124 deletions
+1 -2
View File
@@ -138,12 +138,10 @@ limitations under the License.
<activity
android:label="@string/menu_aggregated_statistics"
android:name="com.google.android.apps.mytracks.AggregatedStatsActivity" />
<activity android:name="com.google.android.apps.mytracks.ExportActivity" />
<activity
android:label="@string/menu_help"
android:name="com.google.android.apps.mytracks.HelpActivity" />
<activity
android:label="@string/my_tracks_importer"
android:name="com.google.android.apps.mytracks.ImportActivity" >
<intent-filter>
<action android:name="android.intent.action.ATTACH_DATA" />
@@ -168,6 +166,7 @@ limitations under the License.
android:name="android.app.default_searchable"
android:value="com.google.android.apps.mytracks.SearchListActivity" />
</activity>
<activity android:name="com.google.android.apps.mytracks.SaveAllActivity" />
<activity
android:launchMode="singleTop"
android:name="com.google.android.apps.mytracks.SearchListActivity" >

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

+4 -4
View File
@@ -84,14 +84,14 @@ limitations under the License.
android:icon="@drawable/menu_satellite_mode"
android:id="@+id/track_detail_satellite_mode"
android:title="@string/menu_satellite_mode"/>
<item
android:icon="@drawable/menu_chart_settings"
android:id="@+id/track_detail_chart_settings"
android:title="@string/menu_chart_settings"/>
<item
android:icon="@drawable/menu_sensor_state"
android:id="@+id/track_detail_sensor_state"
android:title="@string/menu_sensor_state"/>
<item
android:icon="@drawable/menu_chart_settings"
android:id="@+id/track_detail_chart_settings"
android:title="@string/menu_chart_settings"/>
<item
android:icon="@drawable/menu_settings"
android:id="@+id/track_detail_settings"
+10 -10
View File
@@ -32,18 +32,18 @@ limitations under the License.
android:showAsAction="always|collapseActionView"
android:title="@string/menu_search"/>
<item
android:icon="@drawable/menu_import_all"
android:id="@+id/track_list_import_all"
android:title="@string/menu_import_all"/>
android:icon="@drawable/menu_import"
android:id="@+id/track_list_import"
android:title="@string/menu_import"/>
<item
android:icon="@drawable/menu_export_all"
android:id="@+id/track_list_export_all"
android:title="@string/menu_export_all">
android:icon="@drawable/menu_save_all"
android:id="@+id/track_list_save_all"
android:title="@string/menu_save_all">
<menu>
<item android:id="@+id/track_list_export_gpx"/>
<item android:id="@+id/track_list_export_kml"/>
<item android:id="@+id/track_list_export_csv"/>
<item android:id="@+id/track_list_export_tcx"/>
<item android:id="@+id/track_list_save_all_gpx"/>
<item android:id="@+id/track_list_save_all_kml"/>
<item android:id="@+id/track_list_save_all_csv"/>
<item android:id="@+id/track_list_save_all_tcx"/>
</menu>
</item>
<item
+26 -38
View File
@@ -637,22 +637,6 @@ limitations under the License.
Terms of Service
</string>
<!-- Export -->
<string name="export_error"
translation_description="When exporting all the tracks to the SD card, a toast message
indicating error.">
Unable to export.
</string>
<string name="export_progress_message"
translation_description="When exporting all the tracks to the SD card, the progress message.">
Exporting all tracks...
</string>
<string name="export_success"
translation_description="When exporting all the tracks to the SD card, a toast message
indicating success.">
Export finished.
</string>
<!-- Generic Strings -->
<string name="generic_add"
translation_description="The text on a button to say add.">
@@ -1066,25 +1050,13 @@ limitations under the License.
translation_description="In the menu, to edit a track or a marker.">
Edit
</string>
<string name="menu_export_all"
translation_description="In the menu, to export all the tracks to the SD card. This menu item
has a submenu.">
Export all...
</string>
<string name="menu_export_all_format"
translation_description="Under the 'Export all' menu option, the option to export all tracks as
a certain file format.
%1$s: file format. 'GPX', 'KML', 'CSV', or 'TCX'.">
Export as %1$s
</string>
<string name="menu_help"
translation_description="In the menu, to go to the help page.">
Help
</string>
<string name="menu_import_all"
translation_description="In the menu, to import all the tracks from the SD card.">
Import all
<string name="menu_import"
translation_description="In the menu, to import tracks from the SD card.">
Import from SD card
</string>
<string name="menu_insert_marker"
translation_description="In the menu, to insert a marker.">
@@ -1119,12 +1091,17 @@ limitations under the License.
submenu.">
Save to SD card...
</string>
<string name="menu_save_all"
translation_description="In the menu, to save all the tracks to the SD card. This menu item has
a submenu.">
Save all to SD card...
</string>
<string name="menu_save_format"
translation_description="Under the 'Save to SD card...' menu option, the option to save a track
translation_description="Under the save to SD card menu option, the option to save a track
as a certain file format.
%1$s: file format. 'GPX', 'KML', 'CSV', or 'TCX'.">
As a %1$s file
Save as %1$s
</string>
<string name="menu_search"
translation_description="In the menu, to start a textual search for tracks or waypoints.">
@@ -1191,11 +1168,6 @@ limitations under the License.
translation_description="The My Tracks application name.">
My Tracks
</string>
<string name="my_tracks_importer"
translation_description="When opening a GPX file from a file manager, the name of the My Tracks
application that can import the file to My Tracks.">
My Tracks Importer
</string>
<string name="my_tracks_recording_service"
translation_description="When viewing the 'Running services' on Android, the name of the My
Tracks service that is recording a track in the background.
@@ -1253,6 +1225,22 @@ limitations under the License.
Preferred Units
</string>
<!-- Save All -->
<string name="save_all_error"
translation_description="When saving all the tracks to the SD card, a toast message indicating
error.">
Unable to save.
</string>
<string name="save_all_progress_message"
translation_description="When saving all the tracks to the SD card, the progress message.">
Saving all tracks...
</string>
<string name="save_all_success"
translation_description="When saving all the tracks to the SD card, a toast message indicating
success.">
Save finished.
</string>
<!-- SD Card -->
<string name="sd_card_canceled"
translation_description="When exporting a track to the SD card, a message indicating that the
@@ -28,17 +28,17 @@ import android.os.Bundle;
import android.widget.Toast;
/**
* An activity to export all the tracks to the SD card.
* An activity to save all the tracks to the SD card.
*
* @author Sandor Dornbush
*/
public class ExportActivity extends Activity {
public class SaveAllActivity extends Activity {
public static final String EXTRA_TRACK_FILE_FORMAT = "track_file_format";
private static final int DIALOG_PROGRESS_ID = 0;
private ExportAsyncTask exportAsyncTask;
private SaveAllAsyncTask saveAllAsyncTask;
private ProgressDialog progressDialog;
@Override
@@ -46,22 +46,22 @@ public class ExportActivity extends Activity {
super.onCreate(savedInstanceState);
Object retained = getLastNonConfigurationInstance();
if (retained instanceof ExportAsyncTask) {
exportAsyncTask = (ExportAsyncTask) retained;
exportAsyncTask.setActivity(this);
if (retained instanceof SaveAllAsyncTask) {
saveAllAsyncTask = (SaveAllAsyncTask) retained;
saveAllAsyncTask.setActivity(this);
} else {
Intent intent = getIntent();
TrackFileFormat trackFileFormat = intent.getParcelableExtra(EXTRA_TRACK_FILE_FORMAT);
exportAsyncTask = new ExportAsyncTask(this, trackFileFormat);
exportAsyncTask.execute();
saveAllAsyncTask = new SaveAllAsyncTask(this, trackFileFormat);
saveAllAsyncTask.execute();
}
}
@Override
public Object onRetainNonConfigurationInstance() {
exportAsyncTask.setActivity(null);
return exportAsyncTask;
saveAllAsyncTask.setActivity(null);
return saveAllAsyncTask;
}
@Override
@@ -70,10 +70,10 @@ public class ExportActivity extends Activity {
return null;
}
progressDialog = DialogUtils.createHorizontalProgressDialog(
this, R.string.export_progress_message, new DialogInterface.OnCancelListener() {
this, R.string.save_all_progress_message, new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
exportAsyncTask.cancel(true);
saveAllAsyncTask.cancel(true);
finish();
}
});
@@ -102,7 +102,7 @@ public class ExportActivity extends Activity {
/**
* Sets the progress dialog value.
*
* @param number the number of tracks exported
* @param number the number of tracks saved
* @param max the maximum number of tracks
*/
public void setProgressDialogValue(int number, int max) {
@@ -31,13 +31,13 @@ import android.os.AsyncTask;
import android.os.PowerManager.WakeLock;
/**
* AsyncTask to export all the tracks to the SD card.
* AsyncTask to save all the tracks to the SD card.
*
* @author Jimmy Shih
*/
public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
public class SaveAllAsyncTask extends AsyncTask<Void, Integer, Boolean> {
private ExportActivity exportActivity;
private SaveAllActivity saveAllActivity;
private final TrackFileFormat trackFileFormat;
private final Context context;
private final MyTracksProviderUtils myTracksProviderUtils;
@@ -56,40 +56,40 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
/**
* Creates an AsyncTask.
*
* @param exportActivity the activity currently associated with this AsyncTask
* @param saveAllActivity the activity currently associated with this AsyncTask
* @param trackFileFormat the track file format
*/
public ExportAsyncTask(ExportActivity exportActivity, TrackFileFormat trackFileFormat) {
this.exportActivity = exportActivity;
public SaveAllAsyncTask(SaveAllActivity saveAllActivity, TrackFileFormat trackFileFormat) {
this.saveAllActivity = saveAllActivity;
this.trackFileFormat = trackFileFormat;
context = exportActivity.getApplicationContext();
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(exportActivity);
context = saveAllActivity.getApplicationContext();
myTracksProviderUtils = MyTracksProviderUtils.Factory.get(saveAllActivity);
// Get the wake lock if not recording
if (PreferencesUtils.getRecordingTrackId(exportActivity) == -1L) {
wakeLock = SystemUtils.acquireWakeLock(exportActivity, wakeLock);
if (PreferencesUtils.getRecordingTrackId(saveAllActivity) == -1L) {
wakeLock = SystemUtils.acquireWakeLock(saveAllActivity, wakeLock);
}
success = false;
completed = false;
messageId = R.string.export_error;
messageId = R.string.save_all_error;
}
/**
* Sets the current {@link ExportActivity} associated with this AyncTask.
* Sets the current {@link SaveAllActivity} associated with this AyncTask.
*
* @param exportActivity the current {@link ExportActivity}, can be null
* @param saveAllActivity the current {@link SaveAllActivity}, can be null
*/
public void setActivity(ExportActivity exportActivity) {
this.exportActivity = exportActivity;
if (completed && exportActivity != null) {
exportActivity.onAsyncTaskCompleted(success, messageId);
public void setActivity(SaveAllActivity saveAllActivity) {
this.saveAllActivity = saveAllActivity;
if (completed && saveAllActivity != null) {
saveAllActivity.onAsyncTaskCompleted(success, messageId);
}
}
@Override
protected void onPreExecute() {
if (exportActivity != null) {
exportActivity.showProgressDialog();
if (saveAllActivity != null) {
saveAllActivity.showProgressDialog();
}
}
@@ -99,7 +99,7 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
try {
cursor = myTracksProviderUtils.getTracksCursor(null, null, TracksColumns._ID);
if (cursor == null) {
messageId = R.string.export_success;
messageId = R.string.save_all_success;
return true;
}
int count = cursor.getCount();
@@ -123,7 +123,7 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
}
publishProgress(i + 1, count);
}
messageId = R.string.export_success;
messageId = R.string.save_all_success;
return true;
} finally {
if (cursor != null) {
@@ -138,8 +138,8 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
@Override
protected void onProgressUpdate(Integer... values) {
if (exportActivity != null) {
exportActivity.setProgressDialogValue(values[0], values[1]);
if (saveAllActivity != null) {
saveAllActivity.setProgressDialogValue(values[0], values[1]);
}
}
@@ -147,8 +147,8 @@ public class ExportAsyncTask extends AsyncTask<Void, Integer, Boolean> {
protected void onPostExecute(Boolean result) {
success = result;
completed = true;
if (exportActivity != null) {
exportActivity.onAsyncTaskCompleted(success, messageId);
if (saveAllActivity != null) {
saveAllActivity.onAsyncTaskCompleted(success, messageId);
}
}
@@ -159,8 +159,8 @@ public class TrackListActivity extends FragmentActivity {
private MenuItem recordTrackMenuItem;
private MenuItem stopRecordingMenuItem;
private MenuItem searchMenuItem;
private MenuItem importAllMenuItem;
private MenuItem exportAllMenuItem;
private MenuItem importMenuItem;
private MenuItem saveAllMenuItem;
private MenuItem deleteAllMenuItem;
@Override
@@ -319,20 +319,20 @@ public class TrackListActivity extends FragmentActivity {
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.track_list, menu);
String fileTypes[] = getResources().getStringArray(R.array.file_types);
menu.findItem(R.id.track_list_export_gpx)
.setTitle(getString(R.string.menu_export_all_format, fileTypes[0]));
menu.findItem(R.id.track_list_export_kml)
.setTitle(getString(R.string.menu_export_all_format, fileTypes[1]));
menu.findItem(R.id.track_list_export_csv)
.setTitle(getString(R.string.menu_export_all_format, fileTypes[2]));
menu.findItem(R.id.track_list_export_tcx)
.setTitle(getString(R.string.menu_export_all_format, fileTypes[3]));
menu.findItem(R.id.track_list_save_all_gpx)
.setTitle(getString(R.string.menu_save_format, fileTypes[0]));
menu.findItem(R.id.track_list_save_all_kml)
.setTitle(getString(R.string.menu_save_format, fileTypes[1]));
menu.findItem(R.id.track_list_save_all_csv)
.setTitle(getString(R.string.menu_save_format, fileTypes[2]));
menu.findItem(R.id.track_list_save_all_tcx)
.setTitle(getString(R.string.menu_save_format, fileTypes[3]));
recordTrackMenuItem = menu.findItem(R.id.track_list_record_track);
stopRecordingMenuItem = menu.findItem(R.id.track_list_stop_recording);
searchMenuItem = menu.findItem(R.id.track_list_search);
importAllMenuItem = menu.findItem(R.id.track_list_import_all);
exportAllMenuItem = menu.findItem(R.id.track_list_export_all);
importMenuItem = menu.findItem(R.id.track_list_import);
saveAllMenuItem = menu.findItem(R.id.track_list_save_all);
deleteAllMenuItem = menu.findItem(R.id.track_list_delete_all);
ApiAdapterFactory.getApiAdapter().configureSearchWidget(this, searchMenuItem);
@@ -360,11 +360,11 @@ public class TrackListActivity extends FragmentActivity {
if (stopRecordingMenuItem != null) {
stopRecordingMenuItem.setVisible(isRecording);
}
if (importAllMenuItem != null) {
importAllMenuItem.setVisible(!isRecording);
if (importMenuItem != null) {
importMenuItem.setVisible(!isRecording);
}
if (exportAllMenuItem != null) {
exportAllMenuItem.setVisible(!isRecording);
if (saveAllMenuItem != null) {
saveAllMenuItem.setVisible(!isRecording);
}
if (deleteAllMenuItem != null) {
deleteAllMenuItem.setVisible(!isRecording);
@@ -385,29 +385,29 @@ public class TrackListActivity extends FragmentActivity {
return true;
case R.id.track_list_search:
return ApiAdapterFactory.getApiAdapter().handleSearchMenuSelection(this);
case R.id.track_list_import_all:
case R.id.track_list_import:
intent = IntentUtils.newIntent(this, ImportActivity.class)
.putExtra(ImportActivity.EXTRA_IMPORT_ALL, true);
startActivity(intent);
return true;
case R.id.track_list_export_gpx:
intent = IntentUtils.newIntent(this, ExportActivity.class)
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.GPX);
case R.id.track_list_save_all_gpx:
intent = IntentUtils.newIntent(this, SaveAllActivity.class)
.putExtra(SaveAllActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.GPX);
startActivity(intent);
return true;
case R.id.track_list_export_kml:
intent = IntentUtils.newIntent(this, ExportActivity.class)
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML);
case R.id.track_list_save_all_kml:
intent = IntentUtils.newIntent(this, SaveAllActivity.class)
.putExtra(SaveAllActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.KML);
startActivity(intent);
return true;
case R.id.track_list_export_csv:
intent = IntentUtils.newIntent(this, ExportActivity.class)
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.CSV);
case R.id.track_list_save_all_csv:
intent = IntentUtils.newIntent(this, SaveAllActivity.class)
.putExtra(SaveAllActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.CSV);
startActivity(intent);
return true;
case R.id.track_list_export_tcx:
intent = IntentUtils.newIntent(this, ExportActivity.class)
.putExtra(ExportActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.TCX);
case R.id.track_list_save_all_tcx:
intent = IntentUtils.newIntent(this, SaveAllActivity.class)
.putExtra(SaveAllActivity.EXTRA_TRACK_FILE_FORMAT, (Parcelable) TrackFileFormat.TCX);
startActivity(intent);
return true;
case R.id.track_list_delete_all:
@@ -486,11 +486,11 @@ public class TrackRecordingService extends Service {
private void showNotification() {
if (isRecording) {
Notification notification = new Notification(
R.drawable.my_tracks_notification_icon, null /* tickerText */,
System.currentTimeMillis());
R.drawable.my_tracks_notification_icon, null, System.currentTimeMillis());
Intent intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, recordingTrackId);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0);
PendingIntent contentIntent = PendingIntent.getActivity(
this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(this, getString(R.string.my_tracks_app_name),
getString(R.string.track_record_notification), contentIntent);
notification.flags += Notification.FLAG_NO_CLEAR;