Commit 4d006cbf authored by Hazem Ashmawy's avatar Hazem Ashmawy Committed by Commit Bot

[AW] DevUI: Polish WebView crash UI

Polish WebView crash UI layout:
- Use android material theme and support dark theme.
- Use an expandable list to show crashes where we show the important
  info (package name and crash capture time in the header) and show
  variation keys, upload status, report button in the expanded body.
- Use a more descriptive string for the reporting button
  "File bug report" instead of "Provide more info".
- For better visualization, show app icon next to package name to
  be easy to find by eye.
- Use ListViewAdapter#notifyDataSetChanged() instead of creating
  new adapter to optimize crash list updates.
- Update MainActivity to use the new two_line_list_item layout.

Bug: 948923
Test: Manually inspect the UI on SystemWebView on Android P and Android Q with dark mode switched on/off.
Change-Id: Ic9d4fffc6f24a409f06927b91b160280c5781e7b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899371
Commit-Queue: Hazem Ashmawy <hazems@chromium.org>
Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Reviewed-by: default avatarNate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713623}
parent b0a9322a
...@@ -52,6 +52,7 @@ android_library("devui_java") { ...@@ -52,6 +52,7 @@ android_library("devui_java") {
"//android_webview:common_crash_java", "//android_webview:common_crash_java",
"//base:base_java", "//base:base_java",
"//components/minidump_uploader:minidump_uploader_java", "//components/minidump_uploader:minidump_uploader_java",
"//third_party/android_deps:androidx_annotation_annotation_java",
"//ui/android:ui_java", "//ui/android:ui_java",
] ]
android_manifest_for_lint = system_webview_android_manifest android_manifest_for_lint = system_webview_android_manifest
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<!--suppress HardcodedText --> <!--suppress HardcodedText -->
<activity android:name="org.chromium.android_webview.devui.MainActivity" <activity android:name="org.chromium.android_webview.devui.MainActivity"
android:label="WebView DevTools" android:label="WebView DevTools"
android:theme="@android:style/Theme.DeviceDefault" android:theme="@style/Theme.DevUi.DayNight"
android:launchMode="singleTask" android:launchMode="singleTask"
android:process=":webview_apk"> {# Explicit process required for monochrome compatibility. #} android:process=":webview_apk"> {# Explicit process required for monochrome compatibility. #}
<intent-filter> <intent-filter>
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</activity> </activity>
<activity android:name="org.chromium.android_webview.devui.CrashesListActivity" <activity android:name="org.chromium.android_webview.devui.CrashesListActivity"
android:label="WebView Crashes" android:label="WebView Crashes"
android:theme="@android:style/Theme.DeviceDefault" android:theme="@style/Theme.DevUi.DayNight"
android:launchMode="singleTop" android:launchMode="singleTop"
android:process=":webview_apk"> {# Explicit process required for monochrome compatibility. #} android:process=":webview_apk"> {# Explicit process required for monochrome compatibility. #}
</activity> </activity>
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_crashes_list"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
...@@ -16,16 +15,23 @@ ...@@ -16,16 +15,23 @@
android:id="@+id/crashes_summary_textview" android:id="@+id/crashes_summary_textview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#A9A9A9" android:paddingTop="16dp"
android:textColor="#FFFFFF" android:paddingBottom="16dp"
android:textSize="20sp" android:paddingStart="10dp"
android:paddingBottom="5sp" android:paddingEnd="10dp"
android:paddingTop="5sp"/> android:textAppearance="?android:attr/textAppearanceLarge"/>
<ListView <!-- horizontal divider -->
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"/>
<!-- child divider is transparent (hidden) -->
<ExpandableListView
android:id="@+id/crashes_list" android:id="@+id/crashes_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="25dp"/> android:childDivider="#00000000"/>
</LinearLayout> </LinearLayout>
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_main"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
......
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 The Chromium Authors. All rights reserved. Use of this
source code is governed by a BSD-style license that can be found in the
LICENSE file.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="?android:attr/expandableListPreferredItemPaddingLeft"
android:paddingEnd="100dp"
android:orientation="vertical">
<include layout="@layout/two_line_sublist_item"
android:id="@+id/variations"/>
<include layout="@layout/two_line_sublist_item"
android:id="@+id/upload_status"/>
<!--suppress HardcodedText -->
<Button
android:id="@+id/crash_report_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="File bug report"
android:textAllCaps="false" />
</LinearLayout>
<!-- horizontal divider -->
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="16dp"
android:background="?android:attr/listDivider"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 The Chromium Authors. All rights reserved. Use of this
source code is governed by a BSD-style license that can be found in the
LICENSE file.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="?android:attr/expandableListPreferredItemPaddingLeft"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:gravity="center"
android:orientation="horizontal">
<!--suppress HardcodedText -->
<ImageView
android:layout_height="35dp"
android:layout_width="35dp"
android:id="@+id/crash_package_icon"
android:layout_marginEnd="2dp"
android:contentDescription="package icon"/>
<include layout="@layout/two_line_list_item"
android:id="@+id/crash_header"/>
</LinearLayout>
\ No newline at end of file
...@@ -5,37 +5,31 @@ ...@@ -5,37 +5,31 @@
LICENSE file. LICENSE file.
--> -->
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/crash_list_row"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="15dp" android:paddingTop="2dp"
android:paddingBottom="2dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:mode="twoLine"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView android:id="@android:id/text1"
android:id="@+id/crash_info_label"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textIsSelectable="true" android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" android:textStyle="bold"
android:textSize="16sp" android:textAlignment="viewStart"
android:paddingBottom="2dp" android:paddingTop="4dp"
android:paddingTop="2dp" android:paddingBottom="4dp"/>
android:background="#d3d3d3"/>
<TextView
android:id="@+id/crash_info_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textIsSelectable="true"/>
<!--suppress HardcodedText --> <TextView android:id="@android:id/text2"
<Button
android:id="@+id/crash_report_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Provide more info"/> android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewStart"
android:paddingTop="4dp"
android:paddingBottom="4dp"/>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 The Chromium Authors. All rights reserved. Use of this
source code is governed by a BSD-style license that can be found in the
LICENSE file.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:mode="twoLine"
android:orientation="vertical">
<TextView android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
android:textStyle="bold"
android:textAlignment="viewStart"
android:paddingTop="4dp"
android:paddingBottom="4dp"/>
<TextView android:id="@android:id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAlignment="viewStart"
android:paddingTop="4dp"
android:paddingBottom="4dp"/>
</LinearLayout>
\ No newline at end of file
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
LICENSE file. LICENSE file.
--> -->
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:app="http://schemas.android.com/apk/res-auto">
<group android:id="@+id/crashes_menu"> <group android:id="@+id/crashes_menu">
<!--suppress HardcodedText --> <!--suppress HardcodedText -->
<item <item
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.DevUi.DayNight" parent="@android:style/Theme.Material" />
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.DevUi.DayNight" parent="@android:style/Theme.Material.Light.DarkActionBar" />
</resources>
\ No newline at end of file
...@@ -94,7 +94,7 @@ public class MainActivity extends Activity { ...@@ -94,7 +94,7 @@ public class MainActivity extends Activity {
private final InfoItem[] mItems; private final InfoItem[] mItems;
public InfoListAdapter(InfoItem[] items) { public InfoListAdapter(InfoItem[] items) {
super(MainActivity.this, android.R.layout.simple_list_item_2, items); super(MainActivity.this, R.layout.two_line_list_item, items);
mItems = items; mItems = items;
} }
...@@ -103,7 +103,7 @@ public class MainActivity extends Activity { ...@@ -103,7 +103,7 @@ public class MainActivity extends Activity {
// If the the old view is already created then reuse it, else create a new one by layout // If the the old view is already created then reuse it, else create a new one by layout
// inflation. // inflation.
if (view == null) { if (view == null) {
view = getLayoutInflater().inflate(android.R.layout.simple_list_item_2, null, true); view = getLayoutInflater().inflate(R.layout.two_line_list_item, null, true);
} }
InfoItem item = mItems[position]; InfoItem item = mItems[position];
......
...@@ -1012,14 +1012,14 @@ ...@@ -1012,14 +1012,14 @@
android:launchMode="singleTop" android:launchMode="singleTop"
android:name="org.chromium.android_webview.devui.CrashesListActivity" android:name="org.chromium.android_webview.devui.CrashesListActivity"
android:process=":webview_apk" android:process=":webview_apk"
android:theme="@android:style/Theme.DeviceDefault"/> android:theme="@style/Theme.DevUi.DayNight"/>
<activity <activity
android:label="WebView android:label="WebView
DevTools" DevTools"
android:launchMode="singleTask" android:launchMode="singleTask"
android:name="org.chromium.android_webview.devui.MainActivity" android:name="org.chromium.android_webview.devui.MainActivity"
android:process=":webview_apk" android:process=":webview_apk"
android:theme="@android:style/Theme.DeviceDefault"> android:theme="@style/Theme.DevUi.DayNight">
<intent-filter> <intent-filter>
<action android:name="com.android.webview.SHOW_DEV_UI"/> <action android:name="com.android.webview.SHOW_DEV_UI"/>
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment