HapeLee 1 год назад
Родитель
Сommit
3074f5a2cc
1 измененных файлов с 78 добавлено и 53 удалено
  1. 78 53
      app/src/main/res/layout/activity_book_info_edit.xml

+ 78 - 53
app/src/main/res/layout/activity_book_info_edit.xml

@@ -17,7 +17,7 @@
         android:layout_height="0dp"
         android:layout_weight="1"
         android:fillViewport="true">
-        <LinearLayout
+        <androidx.constraintlayout.widget.ConstraintLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical"
@@ -27,19 +27,24 @@
 
             <io.legato.kazusa.ui.widget.image.CoverImageView
                 android:id="@+id/iv_cover"
-                android:layout_width="90dp"
-                android:layout_height="130dp"
+                android:layout_width="120dp"
+                android:layout_height="172dp"
                 android:contentDescription="@string/img_cover"
                 android:scaleType="centerCrop"
                 android:layout_marginBottom="8dp"
-                android:src="@drawable/image_cover_default" />
+                android:src="@drawable/image_cover_default"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"/>
 
             <com.google.android.material.textfield.TextInputLayout
                 android:id="@+id/til_book_name"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:layout_marginTop="8dp"
+                style="@style/Widget.Material3.TextInputLayout.FilledBox.Dense"
                 android:layout_marginBottom="12dp"
-                android:hint="@string/book_name">
+                android:hint="@string/book_name"
+                app:layout_constraintTop_toBottomOf="@id/iv_cover">
 
                 <com.google.android.material.textfield.TextInputEditText
                     android:id="@+id/tie_book_name"
@@ -52,8 +57,11 @@
                 android:id="@+id/til_book_author"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:layout_marginTop="8dp"
+                style="@style/Widget.Material3.TextInputLayout.FilledBox.Dense"
                 android:layout_marginBottom="16dp"
-                android:hint="@string/author">
+                android:hint="@string/author"
+                app:layout_constraintTop_toBottomOf="@id/til_book_name">
 
                 <com.google.android.material.textfield.TextInputEditText
                     android:id="@+id/tie_book_author"
@@ -62,33 +70,15 @@
                     android:singleLine="true" />
             </com.google.android.material.textfield.TextInputLayout>
 
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:orientation="horizontal"
-                android:layout_gravity="center_vertical"
-                android:layout_marginBottom="12dp">
-
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:text="@string/book_type"
-                    android:layout_marginRight="8dp"
-                    tools:ignore="RtlHardcoded" />
-
-                <androidx.appcompat.widget.AppCompatSpinner
-                    android:id="@+id/sp_type"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:entries="@array/book_type" />
-            </LinearLayout>
-
             <com.google.android.material.textfield.TextInputLayout
                 android:id="@+id/til_cover_url"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginBottom="12dp"
-                android:hint="@string/cover_path">
+                android:layout_marginTop="8dp"
+                style="@style/Widget.Material3.TextInputLayout.FilledBox.Dense"
+                android:layout_marginBottom="16dp"
+                android:hint="@string/cover_path"
+                app:layout_constraintTop_toBottomOf="@id/til_book_author">
 
                 <com.google.android.material.textfield.TextInputEditText
                     android:id="@+id/tie_cover_url"
@@ -96,54 +86,89 @@
                     android:layout_height="wrap_content" />
             </com.google.android.material.textfield.TextInputLayout>
 
-            <LinearLayout
-                android:layout_width="match_parent"
+            <com.google.android.material.textfield.TextInputLayout
+                android:id="@+id/til_type"
+                style="@style/Widget.Material3.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="8dp"
+                android:hint="@string/book_type"
+                app:layout_constraintStart_toEndOf="@id/tv_refresh_cover"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintBottom_toBottomOf="@id/iv_cover">
+
+                <AutoCompleteTextView
+                    android:id="@+id/actv_type"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:inputType="none" />
+
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.button.MaterialButtonGroup
+                android:id="@+id/bot"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:orientation="horizontal"
-                android:layout_marginBottom="16dp">
+                android:orientation="vertical"
+                android:layout_marginStart="8dp"
+                android:layout_marginBottom="12dp"
+                app:layout_constraintStart_toEndOf="@id/iv_cover"
+                app:layout_constraintTop_toTopOf="@id/iv_cover"
+                app:layout_constraintBottom_toTopOf="@id/tv_refresh_cover">
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/tv_select_cover"
-                    android:layout_width="0dp"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    style="@style/Widget.Material3Expressive.Button.TonalButton"
-                    android:padding="8dp"
-                    android:text="@string/select_local_image" />
+                    android:textSize="14sp"
+                    app:iconPadding="4dp"
+                    android:text="@string/select_local_image"
+                    app:icon="@drawable/ic_save"
+                    style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
+                    android:padding="8dp" />
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/tv_change_cover"
-                    android:layout_width="0dp"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    style="@style/Widget.Material3Expressive.Button.TonalButton"
+                    app:icon="@drawable/ic_web_outline"
+                    android:textSize="14sp"
+                    app:iconPadding="4dp"
+                    style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
                     android:layout_marginStart="8dp"
                     android:padding="8dp"
                     android:text="@string/change_cover_source" />
 
-                <com.google.android.material.button.MaterialButton
-                    android:id="@+id/tv_refresh_cover"
-                    android:layout_width="0dp"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    style="@style/Widget.Material3Expressive.Button.TonalButton"
-                    android:layout_marginStart="8dp"
-                    android:padding="8dp"
-                    android:text="@string/refresh_cover" />
-            </LinearLayout>
+            </com.google.android.material.button.MaterialButtonGroup>
+
+            <com.google.android.material.button.MaterialButton
+                android:id="@+id/tv_refresh_cover"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                app:icon="@drawable/ic_change_source"
+                style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
+                android:layout_marginStart="8dp"
+
+                android:padding="8dp"
+                android:contentDescription="@string/refresh_cover"
+                app:layout_constraintBottom_toBottomOf="@id/iv_cover"
+                app:layout_constraintStart_toEndOf="@id/iv_cover"/>
 
             <com.google.android.material.textfield.TextInputLayout
                 android:id="@+id/til_book_jj"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:hint="@string/book_intro">
+                android:layout_marginTop="8dp"
+                style="@style/Widget.Material3.TextInputLayout.FilledBox.Dense"
+                android:hint="@string/book_intro"
+                app:layout_constraintTop_toBottomOf="@id/til_cover_url">
 
                 <com.google.android.material.textfield.TextInputEditText
                     android:id="@+id/tie_book_intro"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content" />
             </com.google.android.material.textfield.TextInputLayout>
-        </LinearLayout>
+        </androidx.constraintlayout.widget.ConstraintLayout>
     </androidx.core.widget.NestedScrollView>
 
 </LinearLayout>