Use custom layout for ACRA report dialog, not default one.
Styling the default dialog was difficult and it doesn't obey some of the guidelines provided by the Android design docs: https://www.google.com/design/spec/components/dialogs.html#dialogs-specs (see "Content Guidelines") This change introduces a custom dialog extending the base ACRA reporting activity. Specifically, it introduces a padding of 24dp around the dialog contents.
This commit is contained in:
		
							parent
							
								
									e29b6cbdaf
								
							
						
					
					
						commit
						49d01e0ca3
					
				| @ -376,7 +376,8 @@ | ||||
|                 android:name="android.support.PARENT_ACTIVITY" | ||||
|                 android:value=".FDroid" /> | ||||
|         </activity> | ||||
|         <activity android:name="org.acra.CrashReportDialog" | ||||
|         <activity | ||||
|             android:name="org.fdroid.fdroid.CrashReportActivity" | ||||
|             android:theme="@style/AlertDialogThemeDark" | ||||
|             android:process=":error_report" | ||||
|             android:launchMode="singleInstance" | ||||
|  | ||||
							
								
								
									
										36
									
								
								F-Droid/res/layout/crash_report_dialog.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								F-Droid/res/layout/crash_report_dialog.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,36 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <LinearLayout | ||||
|     xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:orientation="vertical" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:paddingLeft="24dp" | ||||
|     android:paddingRight="24dp" | ||||
|     android:paddingBottom="24dp" | ||||
|     android:paddingTop="20dp" | ||||
|     > | ||||
| 
 | ||||
|     <TextView | ||||
|         android:id="@android:id/text1" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:text="@string/crash_dialog_text" | ||||
|         /> | ||||
| 
 | ||||
|     <TextView | ||||
|         android:id="@android:id/text2" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:layout_marginTop="20dp" | ||||
|         android:text="@string/crash_dialog_comment_prompt" | ||||
|         /> | ||||
| 
 | ||||
|     <EditText | ||||
|         android:id="@android:id/input" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:inputType="textMultiLine" | ||||
|         android:layout_marginTop="20dp" | ||||
|         /> | ||||
| 
 | ||||
| </LinearLayout> | ||||
							
								
								
									
										45
									
								
								F-Droid/src/org/fdroid/fdroid/CrashReportActivity.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								F-Droid/src/org/fdroid/fdroid/CrashReportActivity.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,45 @@ | ||||
| package org.fdroid.fdroid; | ||||
| 
 | ||||
| import android.content.DialogInterface; | ||||
| import android.os.Bundle; | ||||
| import android.support.v7.app.AlertDialog; | ||||
| import android.widget.EditText; | ||||
| 
 | ||||
| import org.acra.BaseCrashReportDialog; | ||||
| 
 | ||||
| public class CrashReportActivity extends BaseCrashReportDialog implements DialogInterface.OnDismissListener, DialogInterface.OnClickListener { | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         super.onCreate(savedInstanceState); | ||||
| 
 | ||||
|         final AlertDialog dialog = new AlertDialog.Builder(this) | ||||
|                 .setTitle(R.string.crash_dialog_title) | ||||
|                 .setIcon(android.R.drawable.ic_dialog_alert) | ||||
|                 .setView(R.layout.crash_report_dialog) | ||||
|                 .setPositiveButton(R.string.ok, this) | ||||
|                 .setNegativeButton(R.string.cancel, this) | ||||
|                 .create(); | ||||
| 
 | ||||
|         dialog.setCanceledOnTouchOutside(false); | ||||
|         dialog.setOnDismissListener(this); | ||||
|         dialog.show(); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onDismiss(DialogInterface dialog) { | ||||
|         finish(); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void onClick(DialogInterface dialog, int which) { | ||||
|         if (which == DialogInterface.BUTTON_POSITIVE) { | ||||
|             final String comment = ((EditText) findViewById(android.R.id.input)).getText().toString(); | ||||
|             sendCrash(comment, ""); | ||||
|         } else { | ||||
|             cancelReports(); | ||||
|         } | ||||
|         finish(); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @ -67,9 +67,7 @@ import sun.net.www.protocol.bluetooth.Handler; | ||||
| 
 | ||||
| @ReportsCrashes(mailTo = "reports@f-droid.org", | ||||
|                 mode = ReportingInteractionMode.DIALOG, | ||||
|                 resDialogTitle = R.string.crash_dialog_title, | ||||
|                 resDialogText = R.string.crash_dialog_text, | ||||
|                 resDialogCommentPrompt = R.string.crash_dialog_comment_prompt | ||||
|                 reportDialogClass = CrashReportActivity.class | ||||
|                 ) | ||||
| public class FDroidApp extends Application { | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Peter Serwylo
						Peter Serwylo