Update upload result dialog for ICS.

This commit is contained in:
Jimmy Shih
2012-03-21 13:54:59 -07:00
parent 8337cda5b8
commit a8002ce13e
3 changed files with 141 additions and 133 deletions
+124 -110
View File
@@ -14,127 +14,141 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_height="fill_parent"
android:layout_width="fill_parent" android:layout_margin="8dp"
android:orientation="vertical"> android:layout_width="fill_parent" >
<ScrollView
android:layout_height="0dp" <LinearLayout
android:layout_margin="5dp" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_width="fill_parent"
android:layout_width="fill_parent"> android:orientation="vertical" >
<!-- Google Maps result -->
<LinearLayout <LinearLayout
android:id="@+id/upload_result_maps_result"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="wrap_content"
android:orientation="vertical"> android:orientation="horizontal" >
<!-- Header --> <ImageView
<TextView android:contentDescription="@string/generic_success_title"
android:layout_width="fill_parent" android:id="@+id/upload_result_maps_result_icon"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/send_google_result_header" android:layout_width="wrap_content"
style="?android:attr/textAppearanceLarge"/> android:src="@drawable/success" />
<!-- Google Maps result -->
<LinearLayout <LinearLayout
android:id="@+id/upload_result_maps_result"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_width="wrap_content"
android:orientation="horizontal"> android:orientation="vertical"
<ImageView android:paddingLeft="8dp" >
android:id="@+id/upload_result_maps_result_icon"
android:layout_gravity="center_vertical" <TextView
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:src="@drawable/success"/> style="@android:style/TextAppearance.DeviceDefault.Medium"
<LinearLayout android:text="@string/send_google_maps" />
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/send_google_maps"
style="?android:attr/textAppearanceMedium"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/send_google_maps_url"
style="?android:attr/textAppearanceSmall"/>
</LinearLayout>
</LinearLayout>
<!-- Google Fusion Tables result --> <TextView
<LinearLayout
android:id="@+id/upload_result_fusion_tables_result"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/upload_result_fusion_tables_result_icon"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:src="@drawable/success"/> style="@android:style/TextAppearance.DeviceDefault.Small"
<LinearLayout android:text="@string/send_google_maps_url" />
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/send_google_fusion_tables"
style="?android:attr/textAppearanceMedium"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/send_google_fusion_tables_url"
style="?android:attr/textAppearanceSmall"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
<!-- Google Docs result -->
<LinearLayout
android:id="@+id/upload_result_docs_result"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/upload_result_docs_result_icon"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/success"/>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical">
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/send_google_docs"
style="?android:attr/textAppearanceMedium"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/send_google_docs_url"
style="?android:attr/textAppearanceSmall"/>
</LinearLayout>
</LinearLayout>
<!-- Footer -->
<TextView
android:id="@+id/upload_result_success_footer"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/send_google_success_footer"
style="?android:attr/textAppearanceSmall"/>
<TextView
android:id="@+id/upload_result_error_footer"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/send_google_error"
style="?android:attr/textAppearanceLarge"/>
</LinearLayout> </LinearLayout>
</ScrollView>
</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:src="@drawable/success" />
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical"
android:paddingLeft="8dp" >
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="@android:style/TextAppearance.DeviceDefault.Medium"
android:text="@string/send_google_fusion_tables" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="@android:style/TextAppearance.DeviceDefault.Small"
android:text="@string/send_google_fusion_tables_url" />
</LinearLayout>
</LinearLayout>
<!-- Google Docs result -->
<LinearLayout
android:id="@+id/upload_result_docs_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_docs_result_icon"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/success" />
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical"
android:paddingLeft="8dp" >
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="@android:style/TextAppearance.DeviceDefault.Medium"
android:text="@string/send_google_docs" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="@android:style/TextAppearance.DeviceDefault.Small"
android:text="@string/send_google_docs_url" />
</LinearLayout>
</LinearLayout>
<!-- Footer -->
<TextView
android:id="@+id/upload_result_success_footer"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="8dp"
style="@android:style/TextAppearance.DeviceDefault.Small"
android:text="@string/send_google_success_footer" />
<TextView
android:id="@+id/upload_result_error_footer"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:padding="8dp"
style="@android:style/TextAppearance.DeviceDefault.Medium"
android:text="@string/send_google_error" />
</LinearLayout>
</ScrollView>
-7
View File
@@ -1304,13 +1304,6 @@ limitations under the License.
%1$s: service name. 'Google Maps', 'Google Fusion Tables', or 'Google Docs'."> %1$s: service name. 'Google Maps', 'Google Fusion Tables', or 'Google Docs'.">
Sending to %1$s. Please wait... Sending to %1$s. Please wait...
</string> </string>
<string name="send_google_result_header"
translation_description="When sending a track to Google, the header on the top of the result
page.
Screenshot: send_google_success.png">
Upload status:
</string>
<string name="send_google_result_share_url" <string name="send_google_result_share_url"
translation_description="When sending a track to Google, in the result dialog, the button on translation_description="When sending a track to Google, in the result dialog, the button on
the bottom to share with friends the URL of the uploaded track. the bottom to share with friends the URL of the uploaded track.
@@ -82,9 +82,7 @@ public class UploadResultActivity extends Activity {
protected Dialog onCreateDialog(int id) { protected Dialog onCreateDialog(int id) {
switch (id) { switch (id) {
case RESULT_DIALOG: case RESULT_DIALOG:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = getLayoutInflater().inflate(R.layout.upload_result, null); View view = getLayoutInflater().inflate(R.layout.upload_result, null);
builder.setView(view);
LinearLayout mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result); LinearLayout mapsResult = (LinearLayout) view.findViewById(R.id.upload_result_maps_result);
LinearLayout fusionTablesResult = (LinearLayout) view.findViewById( LinearLayout fusionTablesResult = (LinearLayout) view.findViewById(
@@ -107,6 +105,7 @@ public class UploadResultActivity extends Activity {
} else { } else {
if (!sendRequest.isMapsSuccess()) { if (!sendRequest.isMapsSuccess()) {
mapsResultIcon.setImageResource(R.drawable.failure); mapsResultIcon.setImageResource(R.drawable.failure);
mapsResultIcon.setContentDescription(getString(R.string.generic_error_title));
hasError = true; hasError = true;
} }
} }
@@ -116,6 +115,7 @@ public class UploadResultActivity extends Activity {
} else { } else {
if (!sendRequest.isFusionTablesSuccess()) { if (!sendRequest.isFusionTablesSuccess()) {
fusionTablesResultIcon.setImageResource(R.drawable.failure); fusionTablesResultIcon.setImageResource(R.drawable.failure);
fusionTablesResultIcon.setContentDescription(getString(R.string.generic_error_title));
hasError = true; hasError = true;
} }
} }
@@ -125,29 +125,28 @@ public class UploadResultActivity extends Activity {
} else { } else {
if (!sendRequest.isDocsSuccess()) { if (!sendRequest.isDocsSuccess()) {
docsResultIcon.setImageResource(R.drawable.failure); docsResultIcon.setImageResource(R.drawable.failure);
docsResultIcon.setContentDescription(getString(R.string.generic_error_title));
hasError = true; hasError = true;
} }
} }
if (hasError) { if (hasError) {
builder.setTitle(R.string.generic_error_title);
builder.setIcon(android.R.drawable.ic_dialog_alert);
successFooter.setVisibility(View.GONE); successFooter.setVisibility(View.GONE);
} else { } else {
builder.setTitle(R.string.generic_success_title);
builder.setIcon(android.R.drawable.ic_dialog_info);
errorFooter.setVisibility(View.GONE); errorFooter.setVisibility(View.GONE);
} }
builder.setCancelable(true); AlertDialog.Builder builder = new AlertDialog.Builder(this)
builder.setOnCancelListener(new DialogInterface.OnCancelListener() { .setCancelable(true)
@Override .setIcon(hasError ? android.R.drawable.ic_dialog_alert
public void onCancel(DialogInterface dialog) { : android.R.drawable.ic_dialog_info)
finish(); .setOnCancelListener(new DialogInterface.OnCancelListener() {
} @Override
}); public void onCancel(DialogInterface dialog) {
builder.setPositiveButton( finish();
getString(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) {
if (!sendRequest.isShowAll() && shareUrl != null) { if (!sendRequest.isShowAll() && shareUrl != null) {
@@ -155,7 +154,9 @@ public class UploadResultActivity extends Activity {
} }
finish(); finish();
} }
}); })
.setTitle(hasError ? R.string.generic_error_title : R.string.generic_success_title)
.setView(view);
// Add a Share URL button if showing all the options and a shareUrl // Add a Share URL button if showing all the options and a shareUrl
// exists // exists