feat(ErrorDisplayItem): improve UI/UX with new design

Updates the design of the ErrorStatusDisplayItem to be more
user-friendly. The new design displays an error message indicating that
an error has occurred while attempting to display the item. It then
offers the choice of either view the item in the browser or copy the
error details.
This commit is contained in:
FineFindus
2024-06-13 20:42:16 +02:00
parent b38c78c50a
commit 14e6187efc
4 changed files with 110 additions and 18 deletions

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="8dp"
android:layout_marginHorizontal="16dp"
android:padding="16dp"
android:clipToPadding="false"
android:background="@drawable/bg_settings_banner">
<ImageView
android:id="@+id/icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="16dp"
android:scaleType="center"
android:importantForAccessibility="no"
android:tint="?colorM3OnPrimaryContainer"
android:background="@drawable/white_circle"
android:backgroundTint="?colorM3PrimaryContainer"
android:src="@drawable/ic_fluent_warning_24_regular" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_toEndOf="@id/icon"
android:layout_marginBottom="2dp"
android:textAppearance="@style/m3_title_medium"
android:textColor="?colorM3OnSurface"
android:singleLine="true"
android:gravity="center_vertical"
android:text="@string/mo_error_display_title"/>
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/icon"
android:layout_below="@id/title"
android:textAppearance="@style/m3_body_medium"
android:minHeight="20dp"
android:gravity="center_vertical"
android:textColor="?colorM3OnSurface"
android:text="@string/mo_error_display_text"/>
<Button
android:id="@+id/button_open_browser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/text"
android:layout_toEndOf="@id/icon"
android:layout_marginStart="-16dp"
android:layout_marginBottom="-10dp"
style="@style/Widget.Mastodon.M3.Button.Text"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:minWidth="0dp"
android:text="@string/open_in_browser"
tools:text="@string/resume_notifications_now"/>
<Button
android:id="@+id/button_copy_error_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/text"
android:layout_toEndOf="@id/button_open_browser"
android:layout_marginBottom="-10dp"
style="@style/Widget.Mastodon.M3.Button.Text"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:minWidth="0dp"
android:text="@string/mo_error_display_copy_error_details"/>
</RelativeLayout>

View File

@@ -133,4 +133,9 @@
<string name="export_settings_summary">Export all logged-in accounts\' settings and timelines</string>
<string name="import_settings_title">Import settings</string>
<string name="import_settings_summary">Import previously exported settings and timelines</string>
<!-- error display item -->
<string name="mo_error_display_title">Failed to display post</string>
<string name="mo_error_display_text">Something went wrong while loading this post. If the problem persists, please report it on our Issues page along with the error details.</string>
<string name="mo_error_display_copy_error_details">Copy details</string>
</resources>