#3101: Add image upload limit of 20 to custom selector (#5369)

* Add basic image limit warning to custom selector

* Block upload button when image limit is exceeded

* Complete basic functionality for upload limit: Disabled button, warning sign & toast

* Consolidate functionality between upload limit and not for upload marking

* Upload Limit: write unit tests and optimize control flow

* Upload Limit Tests: improve logic coverage and alter to stay valid if limit is changed

* Upload Limit: polish javadocs and add explanation to warning toast.

* Upload Limit: refactor variable names

* Upload Limit: change warning toast to dialog box, repurposing welcome dialog code & layout

* Upload Limit: remove error icon when the mark as not for upload button is pressed
This commit is contained in:
u7469570 2023-11-20 20:13:05 +11:00 committed by GitHub
parent 3118a8368b
commit 60764f6f73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 216 additions and 51 deletions

View file

@ -1,43 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
<merge xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/mainBackground"
app:layout_constraintTop_toTopOf="parent">
<ImageButton
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:contentDescription="@string/back"
android:focusable="true"
android:padding="@dimen/standard_gap"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="?attr/mainBackground">
app:srcCompat="?attr/custom_selector_back" />
<ImageButton
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/standard_gap"
android:clickable="true"
android:focusable="true"
app:srcCompat="?attr/custom_selector_back"
android:contentDescription="@string/back" />
<TextView
android:id="@+id/title"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="0dp"
android:layout_height="29dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/custom_selector_title"
android:textAlignment="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/image_limit_error"
app:layout_constraintStart_toEndOf="@+id/back"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/title"
android:textAlignment="center"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dimen_20"
app:layout_constraintStart_toEndOf="@id/back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:singleLine="true"
android:ellipsize="end"
android:text="@string/custom_selector_title"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" />
<ImageButton
android:id="@+id/image_limit_error"
android:layout_width="48dp"
android:layout_height="0dp"
android:background="#00FFFFFF"
android:contentDescription="@string/custom_selector_limit_error_desc"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
app:srcCompat="@drawable/ic_error_red_24dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</merge>