forked from upstream-mirrors/OpenTracks
Update send to google result dialog.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 40 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB |
@@ -1,148 +0,0 @@
|
|||||||
<?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.
|
|
||||||
-->
|
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
style="@style/ScrollView" >
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="8dp" >
|
|
||||||
<!-- Google Drive result -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/upload_result_drive_result"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:orientation="horizontal" >
|
|
||||||
<ImageView
|
|
||||||
android:contentDescription="@string/generic_success_title"
|
|
||||||
android:id="@+id/upload_result_drive_result_icon"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:padding="4dp"
|
|
||||||
android:src="@drawable/success" />
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingLeft="8dp" >
|
|
||||||
<TextView
|
|
||||||
android:text="@string/export_google_drive"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/export_google_drive_url"
|
|
||||||
style="@style/TextSmall" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
<!-- Google Maps result -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/upload_result_maps_result"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:orientation="horizontal" >
|
|
||||||
<ImageView
|
|
||||||
android:contentDescription="@string/generic_success_title"
|
|
||||||
android:id="@+id/upload_result_maps_result_icon"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:padding="4dp"
|
|
||||||
android:src="@drawable/success" />
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingLeft="8dp" >
|
|
||||||
<TextView
|
|
||||||
android:text="@string/export_google_maps"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/export_google_maps_url"
|
|
||||||
style="@style/TextSmall" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
<!-- Google Fusion Tables result -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/upload_result_fusion_tables_result"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:orientation="horizontal" >
|
|
||||||
<ImageView
|
|
||||||
android:contentDescription="@string/generic_success_title"
|
|
||||||
android:id="@+id/upload_result_fusion_tables_result_icon"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:padding="4dp"
|
|
||||||
android:src="@drawable/success" />
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingLeft="8dp" >
|
|
||||||
<TextView
|
|
||||||
android:text="@string/export_google_fusion_tables"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/export_google_fusion_tables_url"
|
|
||||||
style="@style/TextSmall" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
<!-- Google Spreadsheets result -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/upload_result_spreadsheets_result"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:orientation="horizontal" >
|
|
||||||
<ImageView
|
|
||||||
android:contentDescription="@string/generic_success_title"
|
|
||||||
android:id="@+id/upload_result_spreadsheets_result_icon"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:padding="4dp"
|
|
||||||
android:src="@drawable/success" />
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingLeft="8dp" >
|
|
||||||
<TextView
|
|
||||||
android:text="@string/export_google_spreadsheets"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
<TextView
|
|
||||||
android:text="@string/export_google_spreadsheets_url"
|
|
||||||
style="@style/TextSmall" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
<!-- Footer -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/upload_result_success_footer"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:text="@string/send_google_success_footer"
|
|
||||||
style="@style/TextSmall" />
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/upload_result_error_footer"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:text="@string/send_google_error"
|
|
||||||
style="@style/TextMedium" />
|
|
||||||
</LinearLayout>
|
|
||||||
</ScrollView>
|
|
||||||
@@ -659,6 +659,13 @@ limitations under the License.
|
|||||||
translation_description="When exporting a track, the option to export to Google Drive.">
|
translation_description="When exporting a track, the option to export to Google Drive.">
|
||||||
Google Drive
|
Google Drive
|
||||||
</string>
|
</string>
|
||||||
|
<string name="export_google_error"
|
||||||
|
translation_description="When exporting a track, the error message.
|
||||||
|
|
||||||
|
%1$s: service name. E.g, Google Maps.
|
||||||
|
%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_fusion_tables"
|
<string name="export_google_fusion_tables"
|
||||||
translation_description="When exporting a track, the option to export to Google Fusion Tables.">
|
translation_description="When exporting a track, the option to export to Google Fusion Tables.">
|
||||||
Google Fusion Tables
|
Google Fusion Tables
|
||||||
@@ -691,6 +698,14 @@ limitations under the License.
|
|||||||
translation_description="When exporting a track, the option to export to Google Spreadsheets.">
|
translation_description="When exporting a track, the option to export to Google Spreadsheets.">
|
||||||
Google Spreadsheets
|
Google Spreadsheets
|
||||||
</string>
|
</string>
|
||||||
|
<string name="export_google_success"
|
||||||
|
translation_description="When sending a track to Google, the additional comment on the bottom of
|
||||||
|
the result page.
|
||||||
|
|
||||||
|
%1$s: service name. E.g, Google Maps.
|
||||||
|
%2$s: service url. E.g, maps.google.com.">
|
||||||
|
Track exported to %1$s (%2$s). It may take a few minutes for it to appear.
|
||||||
|
</string>
|
||||||
<string name="export_title"
|
<string name="export_title"
|
||||||
translation_description="The dialog title when exporting a track.">
|
translation_description="The dialog title when exporting a track.">
|
||||||
Export to…
|
Export to…
|
||||||
@@ -1334,11 +1349,6 @@ limitations under the License.
|
|||||||
translation_description="When sending to Google, the dialog title to choose a Google account.">
|
translation_description="When sending to Google, the dialog title to choose a Google account.">
|
||||||
Choose account
|
Choose account
|
||||||
</string>
|
</string>
|
||||||
<string name="send_google_error"
|
|
||||||
translation_description="When sending a track to Google, a message indicating that an error has
|
|
||||||
occurred and ask the user to try again.">
|
|
||||||
An error has occurred. Please try again.
|
|
||||||
</string>
|
|
||||||
<string name="send_google_no_account_message"
|
<string name="send_google_no_account_message"
|
||||||
translation_description="When sending to Google, the dialog message when no Google account is
|
translation_description="When sending to Google, the dialog message when no Google account is
|
||||||
found.">
|
found.">
|
||||||
@@ -1360,11 +1370,6 @@ limitations under the License.
|
|||||||
%1$s: service name. 'Google Maps', 'Google Fusion Tables', or 'Google Spreadsheets'.">
|
%1$s: service name. 'Google Maps', 'Google Fusion Tables', or 'Google Spreadsheets'.">
|
||||||
Sending to %1$s…
|
Sending to %1$s…
|
||||||
</string>
|
</string>
|
||||||
<string name="send_google_success_footer"
|
|
||||||
translation_description="When sending a track to Google, the additional comment on the bottom of
|
|
||||||
the result page.">
|
|
||||||
It may take a few minutes before new tracks appear.
|
|
||||||
</string>
|
|
||||||
<string name="send_google_track_part_label"
|
<string name="send_google_track_part_label"
|
||||||
translation_description="When sending a track to Google, the label to name segments of a large
|
translation_description="When sending a track to Google, the label to name segments of a large
|
||||||
track. E.g., 'track_name (Part 1)'.
|
track. E.g., 'track_name (Part 1)'.
|
||||||
|
|||||||
+28
-71
@@ -32,9 +32,6 @@ import android.os.Bundle;
|
|||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dialog to show the result of uploading to Google services.
|
* A dialog to show the result of uploading to Google services.
|
||||||
@@ -79,89 +76,49 @@ public class UploadResultActivity extends FragmentActivity implements ChooseActi
|
|||||||
if (id != DIALOG_RESULT_ID) {
|
if (id != DIALOG_RESULT_ID) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
view = getLayoutInflater().inflate(R.layout.upload_result, null);
|
int serviceName;
|
||||||
|
int serviceUrl;
|
||||||
LinearLayout driveResult = (LinearLayout) view.findViewById(R.id.upload_result_drive_result);
|
boolean success;
|
||||||
LinearLayout mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
|
if (sendRequest.isSendDrive()) {
|
||||||
LinearLayout fusionTablesResult = (LinearLayout) view.findViewById(
|
serviceName = R.string.export_google_drive;
|
||||||
R.id.upload_result_fusion_tables_result);
|
serviceUrl = R.string.export_google_drive_url;
|
||||||
LinearLayout spreadsheetsResult = (LinearLayout) view.findViewById(
|
success = sendRequest.isDriveSuccess();
|
||||||
R.id.upload_result_spreadsheets_result);
|
} else if (sendRequest.isSendMaps()) {
|
||||||
|
serviceName = R.string.export_google_maps;
|
||||||
ImageView driveResultIcon = (ImageView) view.findViewById(R.id.upload_result_drive_result_icon);
|
serviceUrl = R.string.export_google_maps_url;
|
||||||
ImageView mapsResultIcon = (ImageView) view.findViewById(R.id.upload_result_maps_result_icon);
|
success = sendRequest.isMapsSuccess();
|
||||||
ImageView fusionTablesResultIcon = (ImageView) view.findViewById(
|
} else if (sendRequest.isSendFusionTables()) {
|
||||||
R.id.upload_result_fusion_tables_result_icon);
|
serviceName = R.string.export_google_fusion_tables;
|
||||||
ImageView spreadsheetsResultIcon = (ImageView) view.findViewById(
|
serviceUrl = R.string.export_google_fusion_tables_url;
|
||||||
R.id.upload_result_spreadsheets_result_icon);
|
success = sendRequest.isFusionTablesSuccess();
|
||||||
|
|
||||||
TextView successFooter = (TextView) view.findViewById(R.id.upload_result_success_footer);
|
|
||||||
TextView errorFooter = (TextView) view.findViewById(R.id.upload_result_error_footer);
|
|
||||||
|
|
||||||
boolean hasError = false;
|
|
||||||
if (!sendRequest.isSendDrive()) {
|
|
||||||
driveResult.setVisibility(View.GONE);
|
|
||||||
} else {
|
} else {
|
||||||
if (!sendRequest.isDriveSuccess()) {
|
serviceName = R.string.export_google_spreadsheets;
|
||||||
driveResultIcon.setImageResource(R.drawable.failure);
|
serviceUrl = R.string.export_google_spreadsheets_url;
|
||||||
driveResultIcon.setContentDescription(getString(R.string.generic_error_title));
|
success = sendRequest.isSpreadsheetsSuccess();
|
||||||
hasError = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sendRequest.isSendMaps()) {
|
|
||||||
mapsResult.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
if (!sendRequest.isMapsSuccess()) {
|
|
||||||
mapsResultIcon.setImageResource(R.drawable.failure);
|
|
||||||
mapsResultIcon.setContentDescription(getString(R.string.generic_error_title));
|
|
||||||
hasError = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sendRequest.isSendFusionTables()) {
|
|
||||||
fusionTablesResult.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
if (!sendRequest.isFusionTablesSuccess()) {
|
|
||||||
fusionTablesResultIcon.setImageResource(R.drawable.failure);
|
|
||||||
fusionTablesResultIcon.setContentDescription(getString(R.string.generic_error_title));
|
|
||||||
hasError = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sendRequest.isSendSpreadsheets()) {
|
|
||||||
spreadsheetsResult.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
if (!sendRequest.isSpreadsheetsSuccess()) {
|
|
||||||
spreadsheetsResultIcon.setImageResource(R.drawable.failure);
|
|
||||||
spreadsheetsResultIcon.setContentDescription(getString(R.string.generic_error_title));
|
|
||||||
hasError = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasError) {
|
|
||||||
successFooter.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
errorFooter.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String message = getString(
|
||||||
|
success ? R.string.export_google_success : R.string.export_google_error,
|
||||||
|
getString(serviceName), getString(serviceUrl));
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this).setCancelable(true)
|
AlertDialog.Builder builder = new AlertDialog.Builder(this).setCancelable(true)
|
||||||
.setIcon(hasError ? android.R.drawable.ic_dialog_alert : android.R.drawable.ic_dialog_info)
|
.setIcon(success ? android.R.drawable.ic_dialog_info : android.R.drawable.ic_dialog_alert)
|
||||||
|
.setMessage(message)
|
||||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCancel(DialogInterface dialog) {
|
public void onCancel(DialogInterface dialog) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}).setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
})
|
||||||
|
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
}).setTitle(hasError ? R.string.generic_error_title : R.string.generic_success_title)
|
})
|
||||||
.setView(view);
|
.setTitle(success ? R.string.generic_success_title : R.string.generic_error_title);
|
||||||
|
|
||||||
// Add a Share URL button if shareUrl exists
|
// Add a Share URL button if shareUrl exists
|
||||||
if (!hasError && shareUrl != null) {
|
if (success && shareUrl != null) {
|
||||||
builder.setNegativeButton(
|
builder.setNegativeButton(
|
||||||
R.string.share_track_share_url, new DialogInterface.OnClickListener() {
|
R.string.share_track_share_url, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user