Merge branch 'acra-dialog-styles' into 'master'

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.

I couldn't find design specs on the specific spacing between different elements _within_ the dialog, so I used the same spacing of 20dp suggested to use between the title and the main body of the dialog.

At the very least, this change should make it easier to update styles in the future if somebody suggests improvements to the layout of the dialog.

### Before

![acra-dialog.1](/uploads/9540290fcbe245f8b573506c6a982332/acra-dialog.1.png)

### After

![acra-dialog.2](/uploads/2cad0213101f53edfd32dab69cafa757/acra-dialog.2.png)


See merge request !186
This commit is contained in:
Daniel Martí 2016-01-03 17:42:17 +00:00
commit 87fb293348
4 changed files with 90 additions and 4 deletions

View File

@ -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"

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
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>
</ScrollView>

View File

@ -0,0 +1,44 @@
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)
.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();
}
}

View File

@ -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 {