forked from upstream-mirrors/OpenTracks
Remove unused status message when sending to Google.
This commit is contained in:
@@ -969,13 +969,6 @@ limitations under the License.
|
|||||||
occurred and ask the user to try again.">
|
occurred and ask the user to try again.">
|
||||||
An error has occurred. Please try again.
|
An error has occurred. Please try again.
|
||||||
</string>
|
</string>
|
||||||
<string name="send_google_error_service"
|
|
||||||
translation_description="When sending a track to a Google service, a message indicating that an
|
|
||||||
error has occurred.
|
|
||||||
|
|
||||||
%1$s: service name. 'Google My Maps', 'Google Fusion Tables', or 'Google Docs'.">
|
|
||||||
There was an error while sending your track to %1$s.
|
|
||||||
</string>
|
|
||||||
<string name="send_google_existing_map"
|
<string name="send_google_existing_map"
|
||||||
translation_description="When sending a track to Google My Maps, the radio option to use an
|
translation_description="When sending a track to Google My Maps, the radio option to use an
|
||||||
existing map as opposed to create a new map.">
|
existing map as opposed to create a new map.">
|
||||||
@@ -1057,27 +1050,11 @@ limitations under the License.
|
|||||||
button on the bottom to send the track to the selected Google services.">
|
button on the bottom to send the track to the selected Google services.">
|
||||||
Send now
|
Send now
|
||||||
</string>
|
</string>
|
||||||
<string name="send_google_success_existing"
|
|
||||||
translation_description="When sending a track to a Google service, the message on the result
|
|
||||||
page indicating that the track is sent to an existing item in the service.
|
|
||||||
|
|
||||||
%1$s: service name. 'Google My Maps', 'Google Fusion Tables', or 'Google Docs'.
|
|
||||||
%2$s: service url. 'maps.google.com', 'google.com/fusiontable', or 'docs.google.com'.">
|
|
||||||
Your track has been sent to %1$s %2$s.
|
|
||||||
</string>
|
|
||||||
<string name="send_google_success_footer"
|
<string name="send_google_success_footer"
|
||||||
translation_description="When sending a track to Google, the additional comment on the bottom of
|
translation_description="When sending a track to Google, the additional comment on the bottom of
|
||||||
the result page.">
|
the result page.">
|
||||||
It may take a few minutes before new tracks appear.
|
It may take a few minutes before new tracks appear.
|
||||||
</string>
|
</string>
|
||||||
<string name="send_google_success_new"
|
|
||||||
translation_description="When sending a track to a Google service, the message on the result
|
|
||||||
page indicating that a new item has been created.
|
|
||||||
|
|
||||||
%1$s: service name. 'Google My Maps', 'Google Fusion Tables', or 'Google Docs'.
|
|
||||||
%2$s: service url. 'maps.google.com', 'google.com/fusiontable', or 'docs.google.com'.">
|
|
||||||
A new item has been created at %1$s %2$s.
|
|
||||||
</string>
|
|
||||||
<string name="send_google_title"
|
<string name="send_google_title"
|
||||||
translation_description="When sending a track to Google, the dialog title to choose the Google
|
translation_description="When sending a track to Google, the dialog title to choose the Google
|
||||||
services to send the track to. The user can choose Google My Maps, Google Fusion
|
services to send the track to. The user can choose Google My Maps, Google Fusion
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.google.android.apps.mytracks.content.Track;
|
|||||||
import com.google.android.apps.mytracks.io.docs.DocsHelper;
|
import com.google.android.apps.mytracks.io.docs.DocsHelper;
|
||||||
import com.google.android.apps.mytracks.io.gdata.GDataClientFactory;
|
import com.google.android.apps.mytracks.io.gdata.GDataClientFactory;
|
||||||
import com.google.android.apps.mytracks.io.gdata.GDataWrapper;
|
import com.google.android.apps.mytracks.io.gdata.GDataWrapper;
|
||||||
import com.google.android.apps.mytracks.io.sendtogoogle.SendType;
|
|
||||||
import com.google.android.common.gdata.AndroidXmlParserFactory;
|
import com.google.android.common.gdata.AndroidXmlParserFactory;
|
||||||
import com.google.android.maps.mytracks.R;
|
import com.google.android.maps.mytracks.R;
|
||||||
import com.google.wireless.gdata.client.GDataClient;
|
import com.google.wireless.gdata.client.GDataClient;
|
||||||
@@ -55,10 +54,7 @@ public class SendToDocs {
|
|||||||
private final ProgressIndicator progressIndicator;
|
private final ProgressIndicator progressIndicator;
|
||||||
private final boolean metricUnits;
|
private final boolean metricUnits;
|
||||||
|
|
||||||
private boolean createdNewSpreadSheet = false;
|
|
||||||
|
|
||||||
private boolean success = true;
|
private boolean success = true;
|
||||||
private String statusMessage = "";
|
|
||||||
private Runnable onCompletion = null;
|
private Runnable onCompletion = null;
|
||||||
|
|
||||||
|
|
||||||
@@ -92,12 +88,7 @@ public class SendToDocs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void doUpload(long trackId) {
|
private void doUpload(long trackId) {
|
||||||
// TODO
|
|
||||||
String errorFormat = activity.getString(R.string.send_google_error_service);
|
|
||||||
String serviceName = activity.getString(SendType.DOCS.getServiceName());
|
|
||||||
statusMessage = String.format(errorFormat, serviceName);
|
|
||||||
success = false;
|
success = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (trackId == -1) {
|
if (trackId == -1) {
|
||||||
Log.w(Constants.TAG, "Cannot get track id.");
|
Log.w(Constants.TAG, "Cannot get track id.");
|
||||||
@@ -117,13 +108,6 @@ public class SendToDocs {
|
|||||||
|
|
||||||
Log.d(Constants.TAG, "SendToDocs: Uploading to spreadsheet");
|
Log.d(Constants.TAG, "SendToDocs: Uploading to spreadsheet");
|
||||||
success = uploadToDocs(track);
|
success = uploadToDocs(track);
|
||||||
if (success) {
|
|
||||||
String successFormat = createdNewSpreadSheet
|
|
||||||
? activity.getString(R.string.send_google_success_new)
|
|
||||||
: activity.getString(R.string.send_google_success_existing);
|
|
||||||
String url = activity.getString(SendType.DOCS.getServiceUrl());
|
|
||||||
statusMessage = String.format(successFormat, serviceName, url);
|
|
||||||
}
|
|
||||||
Log.d(Constants.TAG, "SendToDocs: Done.");
|
Log.d(Constants.TAG, "SendToDocs: Done.");
|
||||||
} finally {
|
} finally {
|
||||||
if (onCompletion != null) {
|
if (onCompletion != null) {
|
||||||
@@ -136,10 +120,6 @@ public class SendToDocs {
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatusMessage() {
|
|
||||||
return statusMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnCompletion(Runnable onCompletion) {
|
public void setOnCompletion(Runnable onCompletion) {
|
||||||
this.onCompletion = onCompletion;
|
this.onCompletion = onCompletion;
|
||||||
}
|
}
|
||||||
@@ -222,7 +202,6 @@ public class SendToDocs {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
progressIndicator.setProgressValue(80);
|
progressIndicator.setProgressValue(80);
|
||||||
createdNewSpreadSheet = true;
|
|
||||||
|
|
||||||
if (spreadsheetId == null) {
|
if (spreadsheetId == null) {
|
||||||
progressIndicator.setProgressValue(85);
|
progressIndicator.setProgressValue(85);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class SendToFusionTables implements Runnable {
|
|||||||
* Listener invoked when sending to fusion tables completes.
|
* Listener invoked when sending to fusion tables completes.
|
||||||
*/
|
*/
|
||||||
public interface OnSendCompletedListener {
|
public interface OnSendCompletedListener {
|
||||||
void onSendCompleted(String tableId, boolean success, String statusMessage);
|
void onSendCompleted(String tableId, boolean success);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The GData service id for Fusion Tables. */
|
/** The GData service id for Fusion Tables. */
|
||||||
@@ -169,9 +169,6 @@ public class SendToFusionTables implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void doUpload() {
|
private void doUpload() {
|
||||||
String errorFormat = context.getString(R.string.send_google_error_service);
|
|
||||||
String serviceName = context.getString(SendType.FUSION_TABLES.getServiceName());
|
|
||||||
String statusMessage = String.format(errorFormat, serviceName);
|
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
try {
|
try {
|
||||||
progressIndicator.setProgressValue(PROGRESS_INITIALIZATION);
|
progressIndicator.setProgressValue(PROGRESS_INITIALIZATION);
|
||||||
@@ -190,6 +187,7 @@ public class SendToFusionTables implements Runnable {
|
|||||||
// Create a new table:
|
// Create a new table:
|
||||||
progressIndicator.setProgressValue(PROGRESS_FUSION_TABLE_CREATE);
|
progressIndicator.setProgressValue(PROGRESS_FUSION_TABLE_CREATE);
|
||||||
String creatingFormat = context.getString(R.string.send_google_progress_creating);
|
String creatingFormat = context.getString(R.string.send_google_progress_creating);
|
||||||
|
String serviceName = context.getString(SendType.FUSION_TABLES.getServiceName());
|
||||||
progressIndicator.setProgressMessage(String.format(creatingFormat, serviceName));
|
progressIndicator.setProgressMessage(String.format(creatingFormat, serviceName));
|
||||||
if (!createNewTable(track) || !makeTableUnlisted()) {
|
if (!createNewTable(track) || !makeTableUnlisted()) {
|
||||||
return;
|
return;
|
||||||
@@ -211,18 +209,14 @@ public class SendToFusionTables implements Runnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String successFormat = context.getString(R.string.send_google_success_new);
|
|
||||||
String url = context.getString(SendType.FUSION_TABLES.getServiceUrl());
|
|
||||||
statusMessage = String.format(successFormat, serviceName, url);
|
|
||||||
Log.d(Constants.TAG, "SendToFusionTables: Done: " + success);
|
Log.d(Constants.TAG, "SendToFusionTables: Done: " + success);
|
||||||
progressIndicator.setProgressValue(PROGRESS_COMPLETE);
|
progressIndicator.setProgressValue(PROGRESS_COMPLETE);
|
||||||
} finally {
|
} finally {
|
||||||
final boolean finalSuccess = success;
|
final boolean finalSuccess = success;
|
||||||
final String finalStatusMessage = statusMessage;
|
|
||||||
context.runOnUiThread(new Runnable() {
|
context.runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (onCompletion != null) {
|
if (onCompletion != null) {
|
||||||
onCompletion.onSendCompleted(tableId, finalSuccess, finalStatusMessage);
|
onCompletion.onSendCompleted(tableId, finalSuccess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class SendToMyMaps implements Runnable {
|
|||||||
private int totalSegmentsUploaded;
|
private int totalSegmentsUploaded;
|
||||||
|
|
||||||
public interface OnSendCompletedListener {
|
public interface OnSendCompletedListener {
|
||||||
void onSendCompleted(String mapId, boolean success, String statusMessage);
|
void onSendCompleted(String mapId, boolean success);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SendToMyMaps(Activity context, String mapId, AuthManager auth,
|
public SendToMyMaps(Activity context, String mapId, AuthManager auth,
|
||||||
@@ -99,9 +99,6 @@ public class SendToMyMaps implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void doUpload() {
|
private void doUpload() {
|
||||||
String errorFormat = context.getString(R.string.send_google_error_service);
|
|
||||||
String serviceName = context.getString(SendType.MYMAPS.getServiceName());
|
|
||||||
String statusMessage = String.format(errorFormat, serviceName);
|
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
try {
|
try {
|
||||||
progressIndicator.setProgressMessage(
|
progressIndicator.setProgressMessage(
|
||||||
@@ -132,6 +129,7 @@ public class SendToMyMaps implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String creatingFormat = context.getString(R.string.send_google_progress_creating);
|
String creatingFormat = context.getString(R.string.send_google_progress_creating);
|
||||||
|
String serviceName = context.getString(SendType.MYMAPS.getServiceName());
|
||||||
progressIndicator.setProgressMessage(String.format(creatingFormat, serviceName));
|
progressIndicator.setProgressMessage(String.format(creatingFormat, serviceName));
|
||||||
|
|
||||||
StringBuilder mapIdBuilder = new StringBuilder();
|
StringBuilder mapIdBuilder = new StringBuilder();
|
||||||
@@ -175,12 +173,6 @@ public class SendToMyMaps implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
|
||||||
String successFormat = isNewMap ? context.getString(R.string.send_google_success_new)
|
|
||||||
: context.getString(R.string.send_google_success_existing);
|
|
||||||
String url = context.getString(SendType.MYMAPS.getServiceUrl());
|
|
||||||
statusMessage = String.format(successFormat, serviceName, url);
|
|
||||||
}
|
|
||||||
Log.d(TAG, "SendToMyMaps: Done: " + success);
|
Log.d(TAG, "SendToMyMaps: Done: " + success);
|
||||||
progressIndicator.setProgressValue(100);
|
progressIndicator.setProgressValue(100);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -189,11 +181,10 @@ public class SendToMyMaps implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean finalSuccess = success;
|
final boolean finalSuccess = success;
|
||||||
final String finalStatusMessage = statusMessage;
|
|
||||||
context.runOnUiThread(new Runnable() {
|
context.runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (onCompletion != null) {
|
if (onCompletion != null) {
|
||||||
onCompletion.onSendCompleted(mapId, finalSuccess, finalStatusMessage);
|
onCompletion.onSendCompleted(mapId, finalSuccess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -67,9 +67,6 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
private static final String STATE_SEND_TO_MAPS = "mapsSend";
|
private static final String STATE_SEND_TO_MAPS = "mapsSend";
|
||||||
private static final String STATE_SEND_TO_FUSION_TABLES = "fusionSend";
|
private static final String STATE_SEND_TO_FUSION_TABLES = "fusionSend";
|
||||||
private static final String STATE_SEND_TO_DOCS = "docsSend";
|
private static final String STATE_SEND_TO_DOCS = "docsSend";
|
||||||
private static final String STATE_DOCS_MESSAGE = "docsMsg";
|
|
||||||
private static final String STATE_FUSION_TABLES_MESSAGE = "fusionMsg";
|
|
||||||
private static final String STATE_MAPS_MESSAGE = "mapsMsg";
|
|
||||||
private static final String STATE_DOCS_SUCCESS = "docsSuccess";
|
private static final String STATE_DOCS_SUCCESS = "docsSuccess";
|
||||||
private static final String STATE_FUSION_SUCCESS = "fusionSuccess";
|
private static final String STATE_FUSION_SUCCESS = "fusionSuccess";
|
||||||
private static final String STATE_MAPS_SUCCESS = "mapsSuccess";
|
private static final String STATE_MAPS_SUCCESS = "mapsSuccess";
|
||||||
@@ -134,10 +131,6 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
private boolean sendToMyMapsSuccess = false;
|
private boolean sendToMyMapsSuccess = false;
|
||||||
private boolean sendToFusionTablesSuccess = false;
|
private boolean sendToFusionTablesSuccess = false;
|
||||||
private boolean sendToDocsSuccess = false;
|
private boolean sendToDocsSuccess = false;
|
||||||
// TODO: Make these be used for showing results
|
|
||||||
private String sendToMyMapsMessage;
|
|
||||||
private String sendToFusionTablesMessage;
|
|
||||||
private String sendToDocsMessage;
|
|
||||||
|
|
||||||
// Send result information, used to share a link.
|
// Send result information, used to share a link.
|
||||||
private String sendToMyMapsMapId;
|
private String sendToMyMapsMapId;
|
||||||
@@ -259,10 +252,6 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
sendToFusionTablesSuccess = savedInstanceState.getBoolean(STATE_FUSION_SUCCESS);
|
sendToFusionTablesSuccess = savedInstanceState.getBoolean(STATE_FUSION_SUCCESS);
|
||||||
sendToDocsSuccess = savedInstanceState.getBoolean(STATE_DOCS_SUCCESS);
|
sendToDocsSuccess = savedInstanceState.getBoolean(STATE_DOCS_SUCCESS);
|
||||||
|
|
||||||
sendToMyMapsMessage = savedInstanceState.getString(STATE_MAPS_MESSAGE);
|
|
||||||
sendToFusionTablesMessage = savedInstanceState.getString(STATE_FUSION_TABLES_MESSAGE);
|
|
||||||
sendToDocsMessage = savedInstanceState.getString(STATE_DOCS_MESSAGE);
|
|
||||||
|
|
||||||
sendToMyMapsMapId = savedInstanceState.getString(STATE_MAP_ID);
|
sendToMyMapsMapId = savedInstanceState.getString(STATE_MAP_ID);
|
||||||
sendToFusionTablesTableId = savedInstanceState.getString(STATE_TABLE_ID);
|
sendToFusionTablesTableId = savedInstanceState.getString(STATE_TABLE_ID);
|
||||||
|
|
||||||
@@ -280,10 +269,6 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
outState.putBoolean(STATE_FUSION_SUCCESS, sendToFusionTablesSuccess);
|
outState.putBoolean(STATE_FUSION_SUCCESS, sendToFusionTablesSuccess);
|
||||||
outState.putBoolean(STATE_DOCS_SUCCESS, sendToDocsSuccess);
|
outState.putBoolean(STATE_DOCS_SUCCESS, sendToDocsSuccess);
|
||||||
|
|
||||||
outState.putString(STATE_MAPS_MESSAGE, sendToMyMapsMessage);
|
|
||||||
outState.putString(STATE_FUSION_TABLES_MESSAGE, sendToFusionTablesMessage);
|
|
||||||
outState.putString(STATE_DOCS_MESSAGE, sendToDocsMessage);
|
|
||||||
|
|
||||||
outState.putString(STATE_MAP_ID, sendToMyMapsMapId);
|
outState.putString(STATE_MAP_ID, sendToMyMapsMapId);
|
||||||
outState.putString(STATE_TABLE_ID, sendToFusionTablesTableId);
|
outState.putString(STATE_TABLE_ID, sendToFusionTablesTableId);
|
||||||
|
|
||||||
@@ -428,9 +413,7 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
|
|
||||||
SendToMyMaps.OnSendCompletedListener onCompletion = new SendToMyMaps.OnSendCompletedListener() {
|
SendToMyMaps.OnSendCompletedListener onCompletion = new SendToMyMaps.OnSendCompletedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSendCompleted(String mapId, boolean success, String statusMessage) {
|
public void onSendCompleted(String mapId, boolean success) {
|
||||||
// TODO: Use this message
|
|
||||||
sendToMyMapsMessage = statusMessage;
|
|
||||||
sendToMyMapsSuccess = success;
|
sendToMyMapsSuccess = success;
|
||||||
if (sendToMyMapsSuccess) {
|
if (sendToMyMapsSuccess) {
|
||||||
sendToMyMapsMapId = mapId;
|
sendToMyMapsMapId = mapId;
|
||||||
@@ -489,9 +472,7 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
|
|
||||||
OnSendCompletedListener onCompletion = new OnSendCompletedListener() {
|
OnSendCompletedListener onCompletion = new OnSendCompletedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSendCompleted(String tableId, boolean success, String statusMessage) {
|
public void onSendCompleted(String tableId, boolean success) {
|
||||||
// TODO: Use this message
|
|
||||||
sendToFusionTablesMessage = statusMessage;
|
|
||||||
sendToFusionTablesSuccess = success;
|
sendToFusionTablesSuccess = success;
|
||||||
if (sendToFusionTablesSuccess) {
|
if (sendToFusionTablesSuccess) {
|
||||||
sendToFusionTablesTableId = tableId;
|
sendToFusionTablesTableId = tableId;
|
||||||
@@ -562,11 +543,7 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
Runnable onCompletion = new Runnable() {
|
Runnable onCompletion = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
setProgressValue(100);
|
setProgressValue(100);
|
||||||
|
|
||||||
// TODO: Use this message
|
|
||||||
sendToDocsMessage = sender.getStatusMessage();
|
|
||||||
sendToDocsSuccess = sender.wasSuccess();
|
sendToDocsSuccess = sender.wasSuccess();
|
||||||
|
|
||||||
executeStateMachine(SendState.SEND_TO_DOCS_DONE);
|
executeStateMachine(SendState.SEND_TO_DOCS_DONE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -871,11 +848,8 @@ public class SendActivity extends Activity implements ProgressIndicator {
|
|||||||
private void resetState() {
|
private void resetState() {
|
||||||
currentState = SendState.SEND_OPTIONS;
|
currentState = SendState.SEND_OPTIONS;
|
||||||
sendToMyMapsMapId = null;
|
sendToMyMapsMapId = null;
|
||||||
sendToMyMapsMessage = "";
|
|
||||||
sendToMyMapsSuccess = true;
|
sendToMyMapsSuccess = true;
|
||||||
sendToFusionTablesMessage = "";
|
|
||||||
sendToFusionTablesSuccess = true;
|
sendToFusionTablesSuccess = true;
|
||||||
sendToDocsMessage = "";
|
|
||||||
sendToDocsSuccess = true;
|
sendToDocsSuccess = true;
|
||||||
sendToFusionTablesTableId = null;
|
sendToFusionTablesTableId = null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user