forked from upstream-mirrors/OpenTracks
Add spacing betwen recording button and recording status in app widget.
center align text in warning message.
This commit is contained in:
@@ -21,7 +21,7 @@ limitations under the License.
|
||||
<TextView
|
||||
android:background="@color/warning_background"
|
||||
android:drawableLeft="@drawable/warning"
|
||||
android:gravity="left"
|
||||
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"
|
||||
|
||||
@@ -353,6 +353,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>
|
||||
|
||||
-159
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user