Merge "Make bugreport details dialog confirm to Material Guidelines for Dialogs." into nyc-dev

This commit is contained in:
Felipe Leme
2016-03-01 00:56:34 +00:00
committed by Android (Google) Code Review
4 changed files with 41 additions and 17 deletions

View File

@@ -16,28 +16,44 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:paddingTop="15dp"
android:paddingStart="24dp"
android:paddingEnd="24dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:inputType="textNoSuggestions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bugreport_info_name"/>
<EditText
android:id="@+id/name"
android:maxLength="30"
android:singleLine="true"
android:selectAllOnFocus="true"
android:inputType="textNoSuggestions"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/bugreport_info_name"/>
android:text="@string/bugreport_info_title"/>
<EditText
android:id="@+id/title"
android:maxLength="80"
android:singleLine="true"
android:inputType="textAutoCorrect|textCapSentences"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/bugreport_info_title"/>
android:editable="false"
android:text="@string/bugreport_info_description"/>
<EditText
android:id="@+id/description"
android:singleLine="false"
android:inputType="textMultiLine"
android:inputType="textMultiLine|textAutoCorrect|textCapSentences"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/bugreport_info_description"/>
android:layout_height="wrap_content"/>
</LinearLayout>

View File

@@ -59,13 +59,16 @@
<!-- Title of the dialog asking for user-defined bug report details like name, title, and description. -->
<string name="bugreport_info_dialog_title">Bug report <xliff:g id="id">#%d</xliff:g> details</string>
<!-- Text of the hint asking for the bug report name, which when set will define a suffix in the
<!-- Text of the label identifying the bug report name, which when set will define a suffix in the
bug report file names. [CHAR LIMIT=30] -->
<string name="bugreport_info_name">Filename</string>
<!-- Text of hint asking for the bug report title, which when set will define the
<!-- Text of the label identifying the bug report title, which when set will define the
Subject of the email message. [CHAR LIMIT=60] -->
<string name="bugreport_info_title">Title</string>
<!-- Text of hint asking for the bug report description, which when set will describe
<string name="bugreport_info_title">Bug title</string>
<!-- Text of the label identifying the bug report description, which when set will describe
what the bug report is about. [CHAR LIMIT=NONE] -->
<string name="bugreport_info_description">Detailed description</string>
<string name="bugreport_info_description">Bug summary</string>
<!-- Label of button that save bugreport details. -->
<string name="save">Save</string>
</resources>

View File

@@ -601,7 +601,8 @@ public class BugreportProgressService extends Service {
// Most likely am killed Shell before user tapped the notification. Since system might
// be too busy anwyays, it's better to ignore the notification and switch back to the
// non-interactive mode (where the bugerport will be shared upon completion).
Log.d(TAG, "launchBugreportInfoDialog(" + id + "): cancel notification");
Log.w(TAG, "launchBugreportInfoDialog(): canceling notification because id " + id
+ " was not found");
// TODO: add test case to make sure notification is canceled.
NotificationManager.from(mContext).cancel(TAG, id);
return;
@@ -627,7 +628,8 @@ public class BugreportProgressService extends Service {
// Most likely am killed Shell before user tapped the notification. Since system might
// be too busy anwyays, it's better to ignore the notification and switch back to the
// non-interactive mode (where the bugerport will be shared upon completion).
Log.d(TAG, "takeScreenshot(" + id + ", " + delayed + "): cancel notification");
Log.w(TAG, "takeScreenshot(): canceling notification because id " + id
+ " was not found");
// TODO: add test case to make sure notification is canceled.
NotificationManager.from(mContext).cancel(TAG, id);
return;
@@ -1268,6 +1270,9 @@ public class BugreportProgressService extends Service {
if (hasFocus) {
return;
}
// Select-all is useful just initially, since the date-based filename is
// full of hyphens.
mInfoName.setSelectAllOnFocus(false);
sanitizeName();
}
});
@@ -1276,7 +1281,7 @@ public class BugreportProgressService extends Service {
.setView(view)
.setTitle(dialogTitle)
.setCancelable(false)
.setPositiveButton(context.getString(com.android.internal.R.string.ok),
.setPositiveButton(context.getString(R.string.save),
null)
.setNegativeButton(context.getString(com.android.internal.R.string.cancel),
new DialogInterface.OnClickListener()

View File

@@ -400,8 +400,8 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
DetailsUi detailsUi = new DetailsUi(mUiBot, ID);
detailsUi.assertName(NAME);
detailsUi.assertTitle(mContext.getString(R.string.bugreport_info_title));
detailsUi.assertDescription(mContext.getString(R.string.bugreport_info_description));
detailsUi.assertTitle("");
detailsUi.assertDescription("");
detailsUi.nameField.setText(NEW_NAME);
detailsUi.titleField.setText(TITLE);
detailsUi.descField.setText(DESCRIPTION);
@@ -415,8 +415,8 @@ public class BugreportReceiverTest extends InstrumentationTestCase {
detailsUi = new DetailsUi(mUiBot, ID2);
detailsUi.assertName(NAME2);
detailsUi.assertTitle(mContext.getString(R.string.bugreport_info_title));
detailsUi.assertDescription(mContext.getString(R.string.bugreport_info_description));
detailsUi.assertTitle("");
detailsUi.assertDescription("");
detailsUi.nameField.setText(NEW_NAME2);
detailsUi.titleField.setText(TITLE2);
detailsUi.descField.setText(DESCRIPTION2);