Przeglądaj źródła

TextBox landscape UI in MediaBox

cooperku_kdanmobile 5 lat temu
rodzic
commit
9789f07605

+ 9 - 16
reader/src/main/res/layout/view_media_box_tab_text_box.xml

@@ -21,8 +21,7 @@
     <android.support.constraint.ConstraintLayout
         android:id="@+id/layout_textBox"
         android:layout_width="match_parent"
-        android:layout_height="64dp"
-        android:orientation="vertical"
+        android:layout_height="0dp"
         android:background="#14000000"
         android:layout_marginBottom="8dp"
         app:layout_constraintLeft_toLeftOf="parent"
@@ -34,17 +33,15 @@
             android:id="@+id/tv_preview"
             style="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_marginLeft="16dp"
             android:layout_marginStart="16dp"
             android:layout_marginRight="16dp"
             android:layout_marginEnd="16dp"
-            android:gravity="start"
+            android:gravity="center_vertical"
             android:textColor="#f5a623"
             android:textSize="24sp"
-            android:text="@string/mediaBox_textBox_simpleText"
-            app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintBottom_toBottomOf="parent" />
+            android:text="@string/mediaBox_textBox_simpleText" />
     </android.support.constraint.ConstraintLayout>
 
     <com.kdanmobile.reader.screen.reader.mediabox.textbox.TextAttrView
@@ -57,29 +54,25 @@
         app:layout_constraintBottom_toTopOf="@+id/colorChooser_textBox" />
 
     <com.kdanmobile.reader.screen.view.ColorSelectView
+        style="@style/MediaBoxTextBoxColorChooserStyle"
         android:id="@+id/colorChooser_textBox"
         android:layout_width="0dp"
         android:layout_height="48dp"
         android:gravity="center"
-        android:paddingTop="12dp"
         android:layout_marginTop="16dp"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textAttrView_textBox"
-        app:layout_constraintBottom_toTopOf="@+id/seekBar_textBox_textSize" />
+        app:layout_constraintTop_toBottomOf="@+id/textAttrView_textBox" />
 
     <com.kdanmobile.reader.screen.reader.mediabox.common.MediaBoxSeekBar
-        android:layout_width="match_parent"
+        style="@style/MediaBoxTextBoxSeekBarStyle"
+        android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:id="@+id/seekBar_textBox_textSize"
-        android:layout_marginTop="16dp"
         app:title="@string/mediaBox_textBox_titleSeekBarSize"
         app:unit="@string/mediaBox_textBox_unitSeekBarSize"
         app:maxValue="96"
         app:minValue="8"
         app:initValue="24"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/colorChooser_textBox" />
+        app:layout_constraintRight_toRightOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 9 - 15
reader/src/main/res/layout/view_media_box_tab_text_box_style.xml

@@ -21,8 +21,7 @@
     <android.support.constraint.ConstraintLayout
         android:id="@+id/layout_textBox"
         android:layout_width="match_parent"
-        android:layout_height="64dp"
-        android:orientation="vertical"
+        android:layout_height="0dp"
         android:background="#14000000"
         android:layout_marginBottom="8dp"
         app:layout_constraintLeft_toLeftOf="parent"
@@ -34,17 +33,15 @@
             android:id="@+id/tv_preview"
             style="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_marginLeft="16dp"
             android:layout_marginStart="16dp"
             android:layout_marginRight="16dp"
             android:layout_marginEnd="16dp"
-            android:gravity="start"
+            android:gravity="center_vertical"
             android:textColor="#f5a623"
             android:textSize="24sp"
-            android:text="@string/mediaBox_textBox_simpleText"
-            app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintBottom_toBottomOf="parent" />
+            android:text="@string/mediaBox_textBox_simpleText" />
     </android.support.constraint.ConstraintLayout>
 
     <com.kdanmobile.reader.screen.reader.mediabox.textbox.TextAttrView
@@ -57,6 +54,7 @@
         app:layout_constraintBottom_toTopOf="@+id/colorChooser_textBox" />
 
     <com.kdanmobile.reader.screen.view.ColorSelectView
+        style="@style/MediaBoxTextBoxColorChooserStyle"
         android:id="@+id/colorChooser_textBox"
         android:layout_width="0dp"
         android:layout_height="48dp"
@@ -64,22 +62,18 @@
         android:paddingTop="12dp"
         android:layout_marginTop="16dp"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/textAttrView_textBox"
-        app:layout_constraintBottom_toTopOf="@+id/seekBar_textBox_textSize" />
+        app:layout_constraintTop_toBottomOf="@+id/textAttrView_textBox" />
 
     <com.kdanmobile.reader.screen.reader.mediabox.common.MediaBoxSeekBar
-        android:layout_width="match_parent"
+        style="@style/MediaBoxTextBoxSeekBarStyle"
+        android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:id="@+id/seekBar_textBox_textSize"
-        android:layout_marginTop="16dp"
         app:title="@string/mediaBox_textBox_titleSeekBarSize"
         app:unit="@string/mediaBox_textBox_unitSeekBarSize"
         app:maxValue="96"
         app:minValue="8"
         app:initValue="24"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/colorChooser_textBox" />
+        app:layout_constraintRight_toRightOf="parent" />
 
 </android.support.constraint.ConstraintLayout>

+ 12 - 0
reader/src/main/res/values-land/styles_media_box.xml

@@ -4,4 +4,16 @@
         <item name="layout_constraintTop_toTopOf">parent</item>
         <item name="android:background">@color/reader_media_box_bg</item>
     </style>
+
+    <style name="MediaBoxTextBoxColorChooserStyle">
+        <item name="android:layout_marginBottom">16dp</item>
+        <item name="layout_constraintRight_toLeftOf">@+id/seekBar_textBox_textSize</item>
+        <item name="layout_constraintBottom_toBottomOf">parent</item>
+    </style>
+
+    <style name="MediaBoxTextBoxSeekBarStyle">
+        <item name="layout_constraintLeft_toRightOf">@+id/colorChooser_textBox</item>
+        <item name="layout_constraintTop_toTopOf">@+id/colorChooser_textBox</item>
+        <item name="layout_constraintBottom_toBottomOf">@+id/colorChooser_textBox</item>
+    </style>
 </resources>

+ 13 - 0
reader/src/main/res/values/styles_media_box.xml

@@ -3,4 +3,17 @@
     <style name="MediaBoxStyle">
         <item name="android:background">@drawable/shape_rec_w_up_rcorner</item>
     </style>
+
+    <style name="MediaBoxTextBoxColorChooserStyle">
+        <item name="layout_constraintRight_toRightOf">parent</item>
+        <item name="layout_constraintBottom_toTopOf">@+id/seekBar_textBox_textSize</item>
+    </style>
+
+    <style name="MediaBoxTextBoxSeekBarStyle">
+        <item name="android:layout_marginTop">16dp</item>
+        <item name="android:layout_marginBottom">16dp</item>
+        <item name="layout_constraintLeft_toLeftOf">parent</item>
+        <item name="layout_constraintTop_toBottomOf">@+id/colorChooser_textBox</item>
+        <item name="layout_constraintBottom_toBottomOf">parent</item>
+    </style>
 </resources>