Add custom error message when trying to make a track public in Google Drive

This commit is contained in:
Jimmy Shih
2013-11-27 14:23:38 -08:00
parent 48ecf26a42
commit d0a9885a50
2 changed files with 18 additions and 3 deletions
+7
View File
@@ -674,6 +674,13 @@ limitations under the License.
%2$s service url. E.g, maps.google.com.">
An error has occurred. Unable to export to %1$s (%2$s). Please try again.
</string>
<string name="export_google_error_public"
translation_description="The error message when not able to make a track public.
%1$s service name. E.g, Google Drive.
%2$s service url. E.g, drive.google.com.">
Unable to make track public in %1$s (%2$s).
</string>
<string name="export_google_fusion_tables"
translation_description="When exporting a track, the option to export to Google Fusion Tables.">
Google Fusion Tables
@@ -97,9 +97,17 @@ public class UploadResultActivity extends FragmentActivity implements ChooseActi
success = sendRequest.isSpreadsheetsSuccess();
}
String message = getString(
success ? R.string.export_google_success : R.string.export_google_error,
getString(serviceName), getString(serviceUrl));
int messageId;
if (success) {
messageId = R.string.export_google_success;
} else {
if (sendRequest.isDriveSharePublic()) {
messageId = R.string.export_google_error_public;
} else {
messageId = R.string.export_google_error;
}
}
String message = getString(messageId, getString(serviceName), getString(serviceUrl));
AlertDialog.Builder builder = new AlertDialog.Builder(this).setCancelable(true)
.setIcon(success ? R.drawable.ic_dialog_success : android.R.drawable.ic_dialog_alert)
.setMessage(message)