Merge heads
@@ -170,9 +170,7 @@ limitations under the License.
|
||||
<data android:scheme="file" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.google.android.apps.mytracks.MarkerEditActivity"
|
||||
android:theme="@style/MyTracks.DialogWhenLarge" />
|
||||
<activity android:name="com.google.android.apps.mytracks.MarkerEditActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.MarkerDetailActivity" />
|
||||
<activity android:name="com.google.android.apps.mytracks.MarkerListActivity" >
|
||||
<meta-data
|
||||
@@ -199,9 +197,7 @@ limitations under the License.
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="com.google.android.apps.mytracks.TrackListActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.google.android.apps.mytracks.TrackEditActivity"
|
||||
android:theme="@style/MyTracks.DialogWhenLarge" />
|
||||
<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" />
|
||||
@@ -231,8 +227,7 @@ limitations under the License.
|
||||
<activity android:name="com.google.android.apps.mytracks.settings.StatsSettingsActivity" />
|
||||
<activity
|
||||
android:label="@string/track_widget_config_title"
|
||||
android:name="com.google.android.apps.mytracks.widgets.TrackWidgetConfigActivity"
|
||||
android:theme="@style/MyTracks.DialogWhenLarge" >
|
||||
android:name="com.google.android.apps.mytracks.widgets.TrackWidgetConfigActivity" >
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
|
||||
</intent-filter>
|
||||
|
||||
|
Before Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.4 KiB |
@@ -52,6 +52,7 @@ limitations under the License.
|
||||
style="@style/ListItemDate" />
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<!-- Need to match the style set in ListItemUtils.setListItem -->
|
||||
<TextView
|
||||
android:id="@+id/list_item_time_distance"
|
||||
android:layout_gravity="bottom"
|
||||
|
||||
@@ -21,7 +21,7 @@ limitations under the License.
|
||||
<TextView
|
||||
android:background="@color/warning_background"
|
||||
android:drawableLeft="@drawable/warning"
|
||||
android:gravity="center"
|
||||
android:gravity="left|center_vertical"
|
||||
android:id="@+id/map_message"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -144,12 +144,7 @@ limitations under the License.
|
||||
style="@style/TrackWidgetButton" />
|
||||
<TextView
|
||||
android:id="@+id/track_widget_record_status"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:layout_width="0dp"
|
||||
android:singleLine="true"
|
||||
style="@style/TextSmall" />
|
||||
style="@style/TrackWidgetRecordStatus" />
|
||||
<ImageButton
|
||||
android:contentDescription="@string/icon_stop_recording"
|
||||
android:id="@+id/track_widget_stop_button"
|
||||
|
||||
@@ -144,12 +144,7 @@ limitations under the License.
|
||||
style="@style/TrackWidgetButton" />
|
||||
<TextView
|
||||
android:id="@+id/track_widget_record_status"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:layout_width="0dp"
|
||||
android:singleLine="true"
|
||||
style="@style/TextSmall" />
|
||||
style="@style/TrackWidgetRecordStatus" />
|
||||
<ImageButton
|
||||
android:contentDescription="@string/icon_stop_recording"
|
||||
android:id="@+id/track_widget_stop_button"
|
||||
|
||||
@@ -148,12 +148,7 @@ limitations under the License.
|
||||
style="@style/TrackWidgetButton" />
|
||||
<TextView
|
||||
android:id="@+id/track_widget_record_status"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:layout_width="0dp"
|
||||
android:singleLine="true"
|
||||
style="@style/TextSmall" />
|
||||
style="@style/TrackWidgetRecordStatus" />
|
||||
<ImageButton
|
||||
android:contentDescription="@string/icon_stop_recording"
|
||||
android:id="@+id/track_widget_stop_button"
|
||||
|
||||
@@ -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>
|
||||
@@ -27,16 +27,4 @@ limitations under the License.
|
||||
<item name="android:actionBarStyle">@style/ActionBarStyle.MyTracks</item>
|
||||
<item name="android:actionModeBackground">@drawable/action_mode_background_mytracks</item>
|
||||
</style>
|
||||
<style name="MyTracks.DialogWhenLarge" parent="android:Theme.Holo.DialogWhenLarge">
|
||||
<!-- Auto generated -->
|
||||
<item name="android:editTextBackground">@drawable/edit_text_holo_dark</item>
|
||||
<item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewMyTracks</item>
|
||||
<item name="android:listChoiceIndicatorMultiple">@drawable/btn_check_holo_dark</item>
|
||||
<item name="android:progressBarStyleHorizontal">@style/ProgressBarMyTracks</item>
|
||||
<item name="android:listChoiceBackgroundIndicator">@drawable/list_selector_holo_dark</item>
|
||||
<item name="android:activatedBackgroundIndicator">@drawable/activated_background_holo_dark</item>
|
||||
<!-- Manually added -->
|
||||
<item name="android:actionBarStyle">@style/ActionBarStyle.MyTracks</item>
|
||||
<item name="android:actionModeBackground">@drawable/action_mode_background_mytracks</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -37,24 +37,6 @@ limitations under the License.
|
||||
<!-- Same as TextChooseActivity in values/styles.xml except removing textSize and using textAppearance -->
|
||||
<item name="android:textAppearance">?android:attr/textAppearanceListItemSmall</item>
|
||||
</style>
|
||||
<!-- The style for large size text -->
|
||||
<style name="TextLarge" parent="@android:style/TextAppearance.DeviceDefault.Large">
|
||||
<!-- same as TextLarge in values/styles.xml except inheriting from a parent instead of specifying textSize -->
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
</style>
|
||||
<!-- The style for medium size text -->
|
||||
<style name="TextMedium" parent="@android:style/TextAppearance.DeviceDefault.Medium">
|
||||
<!-- same as TextMedium in values/styles.xml except inheriting from a parent instead of specifying textSize -->
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
</style>
|
||||
<!-- The style for small size text -->
|
||||
<style name="TextSmall" parent="@android:style/TextAppearance.DeviceDefault.Small">
|
||||
<!-- same as TextSmall in values/styles.xml except inheriting from a parent instead of specifying textSize -->
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
</style>
|
||||
<style name="TrackWidgetLabel">
|
||||
<!-- same as TrackWidgetLabel in values/styles.xml except adding textAllCaps -->
|
||||
<item name="android:layout_gravity">center_horizontal</item>
|
||||
|
||||
@@ -33,6 +33,6 @@ limitations under the License.
|
||||
<color name="track_color_fast">#F7DF0101</color> <!-- red color -->
|
||||
<color name="track_color_normal">#F75858FA</color> <!-- blue color -->
|
||||
<color name="track_color_slow">#F774DF00</color> <!-- green color -->
|
||||
<color name="track_controller_background">#FF272727</color> <!-- dark gray -->
|
||||
<color name="track_controller_background">#FF0E0E0E</color> <!-- dark gray -->
|
||||
<color name="warning_background">#FFFF8800</color> <!-- orange dark -->
|
||||
</resources>
|
||||
@@ -659,6 +659,13 @@ limitations under the License.
|
||||
translation_description="When exporting a track, the option to export to Google Drive.">
|
||||
Google Drive
|
||||
</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"
|
||||
translation_description="When exporting a track, the option to export to 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.">
|
||||
Google Spreadsheets
|
||||
</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"
|
||||
translation_description="The dialog title when exporting a track.">
|
||||
Export to…
|
||||
@@ -1334,11 +1349,6 @@ limitations under the License.
|
||||
translation_description="When sending to Google, the dialog title to choose a Google account.">
|
||||
Choose account
|
||||
</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"
|
||||
translation_description="When sending to Google, the dialog message when no Google account is
|
||||
found.">
|
||||
@@ -1360,11 +1370,6 @@ limitations under the License.
|
||||
%1$s: service name. 'Google Maps', 'Google Fusion Tables', or 'Google Spreadsheets'.">
|
||||
Sending to %1$s…
|
||||
</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"
|
||||
translation_description="When sending a track to Google, the label to name segments of a large
|
||||
track. E.g., 'track_name (Part 1)'.
|
||||
|
||||
@@ -206,14 +206,17 @@ limitations under the License.
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:layout_width">0dp</item>
|
||||
</style>
|
||||
<style name="Text">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
</style>
|
||||
<!-- text choose activity -->
|
||||
<style name="TextChooseActivity">
|
||||
<item name="android:textSize">18sp</item>
|
||||
</style>
|
||||
<!-- text large -->
|
||||
<style name="TextLarge">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<style name="TextLarge" parent="@style/Text">
|
||||
<item name="android:textSize">22sp</item>
|
||||
</style>
|
||||
<!-- text large with top margin -->
|
||||
@@ -221,9 +224,7 @@ limitations under the License.
|
||||
<item name="android:layout_marginTop">8dp</item>
|
||||
</style>
|
||||
<!-- text medium -->
|
||||
<style name="TextMedium">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<style name="TextMedium" parent="@style/Text">
|
||||
<item name="android:textSize">18sp</item>
|
||||
</style>
|
||||
<!-- text medium with icon -->
|
||||
@@ -232,15 +233,11 @@ limitations under the License.
|
||||
<item name="android:gravity">center_vertical</item>
|
||||
</style>
|
||||
<!-- text micro -->
|
||||
<style name="TextMicro">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<style name="TextMicro" parent="@style/Text">
|
||||
<item name="android:textSize">12sp</item>
|
||||
</style>
|
||||
<!-- text small -->
|
||||
<style name="TextSmall">
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
<style name="TextSmall" parent="@style/Text">
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
<!-- track widget bounding box -->
|
||||
@@ -353,6 +350,15 @@ limitations under the License.
|
||||
<item name="android:layout_height">30dp</item>
|
||||
<item name="android:layout_width">30dp</item>
|
||||
</style>
|
||||
<!-- track widget record status -->
|
||||
<style name="TrackWidgetRecordStatus" parent="@style/TextSmall">
|
||||
<item name="android:layout_gravity">center_vertical</item>
|
||||
<item name="android:layout_height">wrap_content</item>
|
||||
<item name="android:layout_marginLeft">8dp</item>
|
||||
<item name="android:layout_weight">2</item>
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:singleLine">true</item>
|
||||
</style>
|
||||
<!-- track widget stats container -->
|
||||
<style name="TrackWidgetStatsContainer">
|
||||
<item name="android:clickable">true</item>
|
||||
|
||||
@@ -25,5 +25,4 @@ limitations under the License.
|
||||
<item name="android:listViewWhiteStyle">@style/ListViewMyTracks.White</item>
|
||||
<item name="android:spinnerItemStyle">@style/SpinnerItemMyTracks</item>
|
||||
</style>
|
||||
<style name="MyTracks.DialogWhenLarge" />
|
||||
</resources>
|
||||
@@ -32,9 +32,6 @@ import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.util.Log;
|
||||
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.
|
||||
@@ -79,89 +76,49 @@ public class UploadResultActivity extends FragmentActivity implements ChooseActi
|
||||
if (id != DIALOG_RESULT_ID) {
|
||||
return null;
|
||||
}
|
||||
view = getLayoutInflater().inflate(R.layout.upload_result, null);
|
||||
|
||||
LinearLayout driveResult = (LinearLayout) view.findViewById(R.id.upload_result_drive_result);
|
||||
LinearLayout mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
|
||||
LinearLayout fusionTablesResult = (LinearLayout) view.findViewById(
|
||||
R.id.upload_result_fusion_tables_result);
|
||||
LinearLayout spreadsheetsResult = (LinearLayout) view.findViewById(
|
||||
R.id.upload_result_spreadsheets_result);
|
||||
|
||||
ImageView driveResultIcon = (ImageView) view.findViewById(R.id.upload_result_drive_result_icon);
|
||||
ImageView mapsResultIcon = (ImageView) view.findViewById(R.id.upload_result_maps_result_icon);
|
||||
ImageView fusionTablesResultIcon = (ImageView) view.findViewById(
|
||||
R.id.upload_result_fusion_tables_result_icon);
|
||||
ImageView spreadsheetsResultIcon = (ImageView) view.findViewById(
|
||||
R.id.upload_result_spreadsheets_result_icon);
|
||||
|
||||
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);
|
||||
int serviceName;
|
||||
int serviceUrl;
|
||||
boolean success;
|
||||
if (sendRequest.isSendDrive()) {
|
||||
serviceName = R.string.export_google_drive;
|
||||
serviceUrl = R.string.export_google_drive_url;
|
||||
success = sendRequest.isDriveSuccess();
|
||||
} else if (sendRequest.isSendMaps()) {
|
||||
serviceName = R.string.export_google_maps;
|
||||
serviceUrl = R.string.export_google_maps_url;
|
||||
success = sendRequest.isMapsSuccess();
|
||||
} else if (sendRequest.isSendFusionTables()) {
|
||||
serviceName = R.string.export_google_fusion_tables;
|
||||
serviceUrl = R.string.export_google_fusion_tables_url;
|
||||
success = sendRequest.isFusionTablesSuccess();
|
||||
} else {
|
||||
if (!sendRequest.isDriveSuccess()) {
|
||||
driveResultIcon.setImageResource(R.drawable.failure);
|
||||
driveResultIcon.setContentDescription(getString(R.string.generic_error_title));
|
||||
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);
|
||||
serviceName = R.string.export_google_spreadsheets;
|
||||
serviceUrl = R.string.export_google_spreadsheets_url;
|
||||
success = sendRequest.isSpreadsheetsSuccess();
|
||||
}
|
||||
|
||||
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)
|
||||
.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() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
finish();
|
||||
}
|
||||
}).setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
||||
})
|
||||
.setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
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
|
||||
if (!hasError && shareUrl != null) {
|
||||
if (success && shareUrl != null) {
|
||||
builder.setNegativeButton(
|
||||
R.string.share_track_share_url, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ListItemUtils {
|
||||
* @param totalDistance the total distance value
|
||||
* @param startTime the start time value
|
||||
* @param description the description value
|
||||
* @param sharedOwner if shared with me track, the owner, else null
|
||||
*/
|
||||
public static void setListItem(Context context, View view, boolean isRecording, boolean isPaused,
|
||||
int iconId, int iconContentDescriptionId, String name, String category, String totalTime,
|
||||
@@ -69,22 +70,25 @@ public class ListItemUtils {
|
||||
nameTextView.setText(name);
|
||||
|
||||
TextView timeDistanceTextView = (TextView) view.findViewById(R.id.list_item_time_distance);
|
||||
int color = isRecording ? context.getResources()
|
||||
.getColor(isPaused ? android.R.color.white : R.color.recording_text)
|
||||
: 0;
|
||||
if (isRecording) {
|
||||
timeDistanceTextView.setTextColor(context.getResources()
|
||||
.getColor(isPaused ? android.R.color.white : R.color.recording_text));
|
||||
} else {
|
||||
// Need to match the style set in list_item.xml
|
||||
timeDistanceTextView.setTextAppearance(context, R.style.TextSmall);
|
||||
}
|
||||
setTextView(timeDistanceTextView,
|
||||
getTimeDistance(context, isRecording, isPaused, sharedOwner, totalTime, totalDistance),
|
||||
color);
|
||||
getTimeDistance(context, isRecording, isPaused, sharedOwner, totalTime, totalDistance));
|
||||
|
||||
String[] startTimeDisplay = getStartTime(isRecording, context, startTime);
|
||||
TextView dateTextView = (TextView) view.findViewById(R.id.list_item_date);
|
||||
setTextView(dateTextView, startTimeDisplay[0], 0);
|
||||
setTextView(dateTextView, startTimeDisplay[0]);
|
||||
|
||||
TextView timeTextView = (TextView) view.findViewById(R.id.list_item_time);
|
||||
setTextView(timeTextView, startTimeDisplay[1], 0);
|
||||
setTextView(timeTextView, startTimeDisplay[1]);
|
||||
|
||||
TextView descriptionTextView = (TextView) view.findViewById(R.id.list_item_description);
|
||||
setTextView(descriptionTextView, getDescription(isRecording, category, description), 0);
|
||||
setTextView(descriptionTextView, getDescription(isRecording, category, description));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,15 +194,12 @@ public class ListItemUtils {
|
||||
* @param textView the text view
|
||||
* @param value the value for the text view
|
||||
*/
|
||||
private static void setTextView(TextView textView, String value, int color) {
|
||||
private static void setTextView(TextView textView, String value) {
|
||||
if (value == null || value.length() == 0) {
|
||||
textView.setVisibility(View.GONE);
|
||||
} else {
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
textView.setText(value);
|
||||
if (color != 0) {
|
||||
textView.setTextColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.io.sendtogoogle;
|
||||
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Tests the {@link UploadResultActivity}.
|
||||
*
|
||||
* @author Youtao Liu
|
||||
*/
|
||||
public class UploadResultActivityTest extends
|
||||
ActivityInstrumentationTestCase2<UploadResultActivity> {
|
||||
|
||||
private UploadResultActivity uploadResultActivity;
|
||||
private TextView errorFooter;
|
||||
private TextView successFooter;
|
||||
private LinearLayout mapsResult;
|
||||
private LinearLayout fusionTablesResult;
|
||||
private LinearLayout spreadsheetsResult;
|
||||
private ImageView mapsResultIcon;
|
||||
private ImageView fusionTablesResultIcon;
|
||||
private ImageView spreadsheetsResultIcon;
|
||||
|
||||
private String successTitle;
|
||||
private String errorTitle;
|
||||
|
||||
/**
|
||||
* This method is necessary for ActivityInstrumentationTestCase2.
|
||||
*/
|
||||
public UploadResultActivityTest() {
|
||||
super(UploadResultActivity.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the display of dialog when send to all and all sends are successful.
|
||||
*/
|
||||
public void testAllSuccess() {
|
||||
initialActivity(true, true, true, true, true, true);
|
||||
createDialogAndGetViews();
|
||||
assertEquals(View.VISIBLE, successFooter.getVisibility());
|
||||
assertEquals(View.GONE, errorFooter.getVisibility());
|
||||
|
||||
assertEquals(View.VISIBLE, mapsResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, fusionTablesResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
|
||||
|
||||
assertEquals(successTitle, mapsResultIcon.getContentDescription());
|
||||
assertEquals(successTitle, fusionTablesResultIcon.getContentDescription());
|
||||
assertEquals(successTitle, spreadsheetsResultIcon.getContentDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the display of dialog when send to all and all sends are failed.
|
||||
*/
|
||||
public void testAllFailed() {
|
||||
// Send all kinds but all failed.
|
||||
initialActivity(true, true, true, false, false, false);
|
||||
createDialogAndGetViews();
|
||||
assertEquals(View.GONE, successFooter.getVisibility());
|
||||
assertEquals(View.VISIBLE, errorFooter.getVisibility());
|
||||
|
||||
assertEquals(View.VISIBLE, mapsResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, fusionTablesResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
|
||||
|
||||
assertEquals(errorTitle, mapsResultIcon.getContentDescription());
|
||||
assertEquals(errorTitle, fusionTablesResultIcon.getContentDescription());
|
||||
assertEquals(errorTitle, spreadsheetsResultIcon.getContentDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the display of dialog when match following items:
|
||||
* <ul>
|
||||
* <li>Only send to Maps and Spreadsheets.</li>
|
||||
* <li>Send to Maps successful.</li>
|
||||
* <li>Send to Spreadsheets failed.</li>
|
||||
* </ul>
|
||||
*/
|
||||
public void testPartialSuccess() {
|
||||
initialActivity(true, false, true, true, false, false);
|
||||
createDialogAndGetViews();
|
||||
assertEquals(View.VISIBLE, errorFooter.getVisibility());
|
||||
|
||||
assertEquals(View.VISIBLE, mapsResult.getVisibility());
|
||||
assertEquals(View.GONE, fusionTablesResult.getVisibility());
|
||||
assertEquals(View.VISIBLE, spreadsheetsResult.getVisibility());
|
||||
|
||||
assertEquals(successTitle, mapsResultIcon.getContentDescription());
|
||||
assertEquals(errorTitle, spreadsheetsResultIcon.getContentDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Initials a {@link SendRequest} and then initials a activity to be tested.
|
||||
*
|
||||
* @param isSendMaps
|
||||
* @param isSendFusionTables
|
||||
* @param isSendSpreadsheets
|
||||
* @param isMapsSuccess
|
||||
* @param isFusionTablesSuccess
|
||||
* @param isSpreadsheetSuccess
|
||||
*/
|
||||
private void initialActivity(boolean isSendMaps, boolean isSendFusionTables, boolean isSendSpreadsheets,
|
||||
boolean isMapsSuccess, boolean isFusionTablesSuccess, boolean isSpreadsheetSuccess) {
|
||||
Intent intent = new Intent();
|
||||
SendRequest sendRequest = new SendRequest(1L);
|
||||
sendRequest.setSendMaps(isSendMaps);
|
||||
sendRequest.setSendFusionTables(isSendFusionTables);
|
||||
sendRequest.setSendSpreadsheets(isSendSpreadsheets);
|
||||
sendRequest.setMapsSuccess(isMapsSuccess);
|
||||
sendRequest.setFusionTablesSuccess(isFusionTablesSuccess);
|
||||
sendRequest.setSpreadsheetsSuccess(isSpreadsheetSuccess);
|
||||
intent.putExtra(SendRequest.SEND_REQUEST_KEY, sendRequest);
|
||||
setActivityIntent(intent);
|
||||
uploadResultActivity = this.getActivity();
|
||||
successTitle = uploadResultActivity.getString(R.string.generic_success_title);
|
||||
errorTitle = uploadResultActivity.getString(R.string.generic_error_title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates result dialog and gets views in the dialog.
|
||||
*/
|
||||
private void createDialogAndGetViews() {
|
||||
uploadResultActivity.onCreateDialog(UploadResultActivity.DIALOG_RESULT_ID);
|
||||
View view = uploadResultActivity.view;
|
||||
errorFooter = (TextView) view.findViewById(R.id.upload_result_error_footer);
|
||||
successFooter = (TextView) view.findViewById(R.id.upload_result_success_footer);
|
||||
|
||||
mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
|
||||
fusionTablesResult = (LinearLayout) view.findViewById(R.id.upload_result_fusion_tables_result);
|
||||
spreadsheetsResult = (LinearLayout) view.findViewById(R.id.upload_result_spreadsheets_result);
|
||||
|
||||
mapsResultIcon = (ImageView) view.findViewById(R.id.upload_result_maps_result_icon);
|
||||
fusionTablesResultIcon = (ImageView) view
|
||||
.findViewById(R.id.upload_result_fusion_tables_result_icon);
|
||||
spreadsheetsResultIcon = (ImageView) view.findViewById(R.id.upload_result_spreadsheets_result_icon);
|
||||
}
|
||||
}
|
||||