Browse Source

Merge branch '142-fixToolbarInFrontOfMediaBox' into 'master'

Resolve "[手機橫版] 新增簽名後,頂部toolbar會遮蔽media box"

See merge request kdanandroid/pdf/pdfreaderreadermodule!73
Wayne Huang 4 năm trước cách đây
mục cha
commit
945851d896

+ 2 - 2
src/main/java/com/kdanmobile/reader/ReaderActivity.kt

@@ -1226,7 +1226,7 @@ abstract class ReaderActivity :
     private fun setLeftToolbarContentView(leftToolbarType: ReaderViewModel.LeftToolbarType) {
         if (oldLeftToolbarType != leftToolbarType) {
             linearLayout_readerActivity_leftToolbarContainer.removeAllViews()
-            val view = when (leftToolbarType) {
+            val view: View = when (leftToolbarType) {
                 ReaderViewModel.LeftToolbarType.NONE,
                 ReaderViewModel.LeftToolbarType.THUMBNAIL -> {
                     val thumbnailView = ThumbnailView(this)
@@ -1249,7 +1249,7 @@ abstract class ReaderActivity :
                     searchView
                 }
             }
-            linearLayout_readerActivity_leftToolbarContainer.addView(view as View)
+            linearLayout_readerActivity_leftToolbarContainer.addView(view)
             oldLeftToolbarType = leftToolbarType
         }
     }

+ 6 - 6
src/main/java/com/kdanmobile/reader/screen/reader/mediabox/MediaBoxView.kt

@@ -57,7 +57,7 @@ class MediaBoxView @JvmOverloads constructor(
         view_mediaBox_dialog.setOnClickListener {}
 
         /** Move media box view to bottom of parent(hide it) **/
-        val size = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)
+        val size = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)
         val v = view_mediaBox_dialog
         v.measure(size, size)
         v.y = v.top + v.measuredHeight.toFloat()
@@ -69,7 +69,7 @@ class MediaBoxView @JvmOverloads constructor(
             viewGroup_mediaBox_pageContainer.removeAllViews()
         }
         val textBoxStyleView = TextBoxStyleView(context)
-        val params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT)
+        val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
         viewGroup_mediaBox_pageContainer.addView(textBoxStyleView, params)
         textBoxStyleView.onMediaBoxHeaderClickListener = object: MediaBoxHeader.OnTitleButtonClickListener {
             override fun onTitleButtonClick() {
@@ -232,7 +232,7 @@ class MediaBoxView @JvmOverloads constructor(
         val changed = setupContent(view as ImageButton, MediaBoxTabType.TEXT_BOX)
         if (changed) {
             val textBoxTabView = TextBoxTabView(context)
-            val params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT)
+            val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
             viewGroup_mediaBox_pageContainer.addView(textBoxTabView, params)
             textBoxTabView.onMediaBoxHeaderClickListener = object: MediaBoxHeader.OnTitleButtonClickListener {
                 override fun onTitleButtonClick() {
@@ -246,7 +246,7 @@ class MediaBoxView @JvmOverloads constructor(
         val changed = setupContent(view as ImageButton, MediaBoxTabType.SIGNATURE)
         if (changed) {
             val signatureTabView = SignatureTabView(context)
-            val params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT)
+            val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
             viewGroup_mediaBox_pageContainer.addView(signatureTabView, params)
             signatureTabView.onMediaBoxHeaderClickListener = object: MediaBoxHeader.OnTitleButtonClickListener {
                 override fun onTitleButtonClick() {
@@ -260,7 +260,7 @@ class MediaBoxView @JvmOverloads constructor(
         val changed = setupContent(view as ImageButton, MediaBoxTabType.STAMP)
         if (changed) {
             val stampTabView = StampTabView(context)
-            val params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT)
+            val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
             viewGroup_mediaBox_pageContainer.addView(stampTabView, params)
             stampTabView.onMediaBoxHeaderClickListener = object: MediaBoxHeader.OnTitleButtonClickListener {
                 override fun onTitleButtonClick() {
@@ -274,7 +274,7 @@ class MediaBoxView @JvmOverloads constructor(
         val changed = setupContent(view as ImageButton, MediaBoxTabType.SHAPE)
         if (changed) {
             val shapeTabView = ShapeTabView(context)
-            val params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT)
+            val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
             viewGroup_mediaBox_pageContainer.addView(shapeTabView, params)
             shapeTabView.onMediaBoxHeaderClickListener = object: MediaBoxHeader.OnTitleButtonClickListener {
                 override fun onTitleButtonClick() {

+ 3 - 1
src/main/res/layout/activity_reader.xml

@@ -232,7 +232,9 @@
     <com.kdanmobile.reader.screen.reader.mediabox.MediaBoxView
         android:id="@+id/mediaBoxView"
         android:layout_width="match_parent"
-        android:layout_height="match_parent" />
+        android:layout_height="match_parent"
+        android:translationZ="100dp"
+        tools:ignore="UnusedAttribute" />
 
     <include
         android:id="@+id/view_ink_menu"