Browse Source

Add back missing start/end margins in manga info header (#5352)

* Add missing margin to phone UI

Also, remove unnecessary code

* Add missing margin to tablet UI

* Use LinearLayout instead
Andreas 3 years ago
parent
commit
d961492380

+ 39 - 35
app/src/main/res/layout-sw720dp/manga_info_header.xml

@@ -135,46 +135,50 @@
 
     </LinearLayout>
 
-    <com.google.android.material.button.MaterialButton
-        android:id="@+id/btn_favorite"
-        style="@style/Theme.Widget.Button.Action"
+    <LinearLayout
+        android:id="@+id/manga_actions"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
         android:layout_marginTop="8dp"
-        android:text="@string/add_to_library"
-        app:icon="@drawable/ic_favorite_border_24dp"
-        app:layout_constraintEnd_toStartOf="@+id/btn_tracking"
-        app:layout_constraintHorizontal_bias="0.5"
+        android:layout_marginEnd="16dp"
+        android:orientation="horizontal"
+        app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/manga_detail" />
+        app:layout_constraintTop_toBottomOf="@+id/manga_detail">
 
-    <com.google.android.material.button.MaterialButton
-        android:id="@+id/btn_tracking"
-        style="@style/Theme.Widget.Button.Action"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:text="@string/manga_tracking_tab"
-        android:visibility="gone"
-        app:icon="@drawable/ic_sync_24dp"
-        app:layout_constraintEnd_toStartOf="@+id/btn_webview"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toEndOf="@+id/btn_favorite"
-        app:layout_constraintTop_toTopOf="@+id/btn_favorite"
-        tools:visibility="visible" />
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btn_favorite"
+            style="@style/Theme.Widget.Button.Action"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@string/add_to_library"
+            app:icon="@drawable/ic_favorite_border_24dp" />
 
-    <com.google.android.material.button.MaterialButton
-        android:id="@+id/btn_webview"
-        style="@style/Theme.Widget.Button.Action"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:text="@string/action_web_view"
-        android:visibility="gone"
-        app:icon="@drawable/ic_public_24dp"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toEndOf="@+id/btn_tracking"
-        app:layout_constraintTop_toTopOf="@+id/btn_favorite"
-        tools:visibility="visible" />
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btn_tracking"
+            style="@style/Theme.Widget.Button.Action"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@string/manga_tracking_tab"
+            android:visibility="gone"
+            app:icon="@drawable/ic_sync_24dp"
+            tools:visibility="visible" />
+
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btn_webview"
+            style="@style/Theme.Widget.Button.Action"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@string/action_web_view"
+            android:visibility="gone"
+            app:icon="@drawable/ic_public_24dp"
+            tools:visibility="visible" />
+
+    </LinearLayout>
 
     <androidx.constraintlayout.motion.widget.MotionLayout
         android:id="@+id/manga_summary_section"
@@ -184,7 +188,7 @@
         app:layoutDescription="@xml/manga_summary_section_scene"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/btn_favorite">
+        app:layout_constraintTop_toBottomOf="@id/manga_actions">
 
         <TextView
             android:id="@+id/manga_summary_text"

+ 37 - 36
app/src/main/res/layout/manga_info_header.xml

@@ -126,55 +126,56 @@
 
     </LinearLayout>
 
-    <com.google.android.material.button.MaterialButton
-        android:id="@+id/btn_favorite"
-        style="@style/Theme.Widget.Button.Action"
+    <LinearLayout
+        android:id="@+id/manga_actions"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:text="@string/add_to_library"
-        app:icon="@drawable/ic_favorite_border_24dp"
-        app:layout_constraintEnd_toStartOf="@+id/btn_tracking"
-        app:layout_constraintHorizontal_bias="0.5"
+        android:orientation="horizontal"
+        app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/backdrop" />
+        app:layout_constraintTop_toBottomOf="@id/backdrop">
 
-    <com.google.android.material.button.MaterialButton
-        android:id="@+id/btn_tracking"
-        style="@style/Theme.Widget.Button.Action"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:text="@string/manga_tracking_tab"
-        android:visibility="gone"
-        app:icon="@drawable/ic_sync_24dp"
-        app:layout_constraintEnd_toStartOf="@+id/btn_webview"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toEndOf="@+id/btn_favorite"
-        app:layout_constraintTop_toTopOf="@+id/btn_favorite"
-        tools:visibility="visible" />
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btn_favorite"
+            style="@style/Theme.Widget.Button.Action"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@string/add_to_library"
+            app:icon="@drawable/ic_favorite_border_24dp" />
 
-    <com.google.android.material.button.MaterialButton
-        android:id="@+id/btn_webview"
-        style="@style/Theme.Widget.Button.Action"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:text="@string/action_web_view"
-        android:visibility="gone"
-        app:icon="@drawable/ic_public_24dp"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0.5"
-        app:layout_constraintStart_toEndOf="@+id/btn_tracking"
-        app:layout_constraintTop_toTopOf="@+id/btn_favorite"
-        tools:visibility="visible" />
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btn_tracking"
+            style="@style/Theme.Widget.Button.Action"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@string/manga_tracking_tab"
+            android:visibility="gone"
+            app:icon="@drawable/ic_sync_24dp"
+            tools:visibility="visible" />
+
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btn_webview"
+            style="@style/Theme.Widget.Button.Action"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:text="@string/action_web_view"
+            android:visibility="gone"
+            app:icon="@drawable/ic_public_24dp"
+            tools:visibility="visible" />
+
+    </LinearLayout>
 
     <androidx.constraintlayout.motion.widget.MotionLayout
         android:id="@+id/manga_summary_section"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="8dp"
         app:layoutDescription="@xml/manga_summary_section_scene"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/btn_favorite">
+        app:layout_constraintTop_toBottomOf="@+id/manga_actions">
 
         <TextView
             android:id="@+id/manga_summary_text"

+ 25 - 30
app/src/main/res/xml/manga_info_header_scene.xml

@@ -11,24 +11,6 @@
     </Transition>
 
     <ConstraintSet android:id="@+id/start">
-        <Constraint
-            android:id="@+id/btn_tracking"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            motion:layout_constraintEnd_toStartOf="@+id/btn_webview"
-            motion:layout_constraintHorizontal_bias="0.5"
-            motion:layout_constraintStart_toEndOf="@+id/btn_favorite"
-            motion:layout_constraintTop_toTopOf="@+id/btn_favorite"
-            motion:visibilityMode="ignore" />
-        <Constraint
-            android:id="@+id/btn_webview"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            motion:layout_constraintEnd_toEndOf="parent"
-            motion:layout_constraintHorizontal_bias="0.5"
-            motion:layout_constraintStart_toEndOf="@+id/btn_tracking"
-            motion:layout_constraintTop_toTopOf="@+id/btn_favorite"
-            motion:visibilityMode="ignore" />
         <Constraint
             android:id="@+id/manga_summary_section"
             android:layout_width="match_parent"
@@ -36,8 +18,17 @@
             android:layout_marginTop="8dp"
             motion:layout_constraintEnd_toEndOf="parent"
             motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toBottomOf="@+id/btn_favorite"
+            motion:layout_constraintTop_toBottomOf="@id/manga_actions"
             motion:visibilityMode="ignore" />
+        <Constraint
+            motion:layout_constraintEnd_toEndOf="parent"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            motion:layout_constraintTop_toBottomOf="@id/backdrop"
+            motion:layout_constraintStart_toStartOf="parent"
+            android:id="@+id/manga_actions"
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="16dp" />
     </ConstraintSet>
 
     <ConstraintSet android:id="@+id/end">
@@ -68,14 +59,6 @@
             motion:layout_constraintEnd_toEndOf="parent"
             motion:layout_constraintStart_toStartOf="parent"
             motion:layout_constraintTop_toTopOf="parent" />
-        <Constraint
-            android:id="@+id/btn_favorite"
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            motion:layout_constraintEnd_toStartOf="@+id/btn_tracking"
-            motion:layout_constraintHorizontal_bias="0.5"
-            motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toBottomOf="@id/manga_detail" />
         <Constraint
             android:id="@+id/btn_favorite"
             android:layout_width="0dp"
@@ -84,7 +67,8 @@
             motion:layout_constraintEnd_toStartOf="@+id/btn_tracking"
             motion:layout_constraintHorizontal_bias="0.5"
             motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toBottomOf="@id/manga_detail" />
+            motion:layout_constraintTop_toBottomOf="@id/manga_detail"
+            android:layout_marginStart="16dp" />
         <Constraint
             android:id="@+id/manga_detail"
             android:layout_width="0dp"
@@ -122,7 +106,8 @@
             motion:layout_constraintHorizontal_bias="0.5"
             motion:layout_constraintStart_toEndOf="@+id/btn_tracking"
             motion:layout_constraintTop_toTopOf="@+id/btn_favorite"
-            motion:visibilityMode="ignore" />
+            motion:visibilityMode="ignore"
+            android:layout_marginEnd="16dp" />
         <Constraint
             android:id="@+id/manga_summary_section"
             android:layout_width="match_parent"
@@ -130,7 +115,17 @@
             android:layout_marginTop="8dp"
             motion:layout_constraintEnd_toEndOf="parent"
             motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toBottomOf="@+id/btn_favorite"
+            motion:layout_constraintTop_toBottomOf="@id/manga_actions"
             motion:visibilityMode="ignore" />
+        <Constraint
+            android:id="@+id/manga_actions"
+            motion:layout_constraintEnd_toEndOf="parent"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            motion:layout_constraintTop_toBottomOf="@id/manga_detail"
+            motion:layout_constraintStart_toStartOf="parent"
+            android:layout_marginTop="8dp"
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="16dp" />
     </ConstraintSet>
 </MotionScene>

+ 2 - 2
app/src/main/res/xml/manga_info_header_scene_sw600dp.xml

@@ -18,7 +18,7 @@
             android:layout_marginTop="8dp"
             motion:layout_constraintEnd_toEndOf="parent"
             motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toBottomOf="@+id/btn_favorite"
+            motion:layout_constraintTop_toBottomOf="@id/manga_actions"
             motion:visibilityMode="ignore" />
     </ConstraintSet>
 
@@ -31,7 +31,7 @@
             android:layout_marginTop="8dp"
             motion:layout_constraintEnd_toEndOf="parent"
             motion:layout_constraintStart_toStartOf="parent"
-            motion:layout_constraintTop_toBottomOf="@id/btn_favorite"
+            motion:layout_constraintTop_toBottomOf="@id/manga_actions"
             motion:visibilityMode="ignore" />
         <Constraint
             android:id="@+id/manga_detail"