Ver Fonte

Rename MediaBoxSeekBar

Wayne há 5 anos atrás
pai
commit
0fa8342bb2

+ 15 - 15
reader/src/main/java/com/kdanmobile/reader/screen/reader/mediabox/common/TextSeekBar.kt

@@ -6,9 +6,9 @@ import android.util.AttributeSet
 import android.view.LayoutInflater
 import android.widget.SeekBar
 import com.kdanmobile.reader.R
-import kotlinx.android.synthetic.main.view_viewer_edit_item_seekbar.view.*
+import kotlinx.android.synthetic.main.view_media_box_seekbar.view.*
 
-class TextSeekBar : ConstraintLayout {
+class MediaBoxSeekBar : ConstraintLayout {
 
     private var title = ""
     private var unit = ""
@@ -25,7 +25,7 @@ class TextSeekBar : ConstraintLayout {
     var formatter = defaultFormatter
         set(value) {
             field = value
-            tv_seekBarValue?.text = "${formatter.format(currentValue)}$unit"
+            tv_mediaBoxSeekBar_value?.text = "${formatter.format(currentValue)}$unit"
         }
 
     interface SeekBarFormatter {
@@ -35,8 +35,8 @@ class TextSeekBar : ConstraintLayout {
     var currentValue = 0
         set(value) {
             field = Math.max(Math.min(value, maxValue), minValue)
-            tv_seekBarValue?.text = "${formatter.format(currentValue)}$unit"
-            seekBar?.progress = field - minValue
+            tv_mediaBoxSeekBar_value?.text = "${formatter.format(currentValue)}$unit"
+            seekBar_mediaBoxSeekBar?.progress = field - minValue
         }
     var onSeekBarChangeListener: SeekBar.OnSeekBarChangeListener? = null
 
@@ -55,23 +55,23 @@ class TextSeekBar : ConstraintLayout {
     }
 
     private fun initAttr(attributeSet: AttributeSet) {
-        val typedArray = context.theme.obtainStyledAttributes(attributeSet, R.styleable.TextSeekBar, 0, 0)
-        title = typedArray.getString(R.styleable.TextSeekBar_title) ?: ""
-        unit = typedArray.getString(R.styleable.TextSeekBar_unit) ?: ""
-        maxValue = typedArray.getInteger(R.styleable.TextSeekBar_maxValue, 100)
-        minValue = typedArray.getInteger(R.styleable.TextSeekBar_minValue, 0)
+        val typedArray = context.theme.obtainStyledAttributes(attributeSet, R.styleable.MediaBoxSeekBar, 0, 0)
+        title = typedArray.getString(R.styleable.MediaBoxSeekBar_title) ?: ""
+        unit = typedArray.getString(R.styleable.MediaBoxSeekBar_unit) ?: ""
+        maxValue = typedArray.getInteger(R.styleable.MediaBoxSeekBar_maxValue, 100)
+        minValue = typedArray.getInteger(R.styleable.MediaBoxSeekBar_minValue, 0)
         if (maxValue < minValue)
             maxValue = minValue
-        initValue = typedArray.getInteger(R.styleable.TextSeekBar_initValue, 0)
+        initValue = typedArray.getInteger(R.styleable.MediaBoxSeekBar_initValue, 0)
         initValue = Math.max(Math.min(initValue, maxValue), minValue)
     }
 
     private fun initView() {
-        LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_item_seekbar, this)
+        LayoutInflater.from(context).inflate(R.layout.view_media_box_seekbar, this)
 
-        tv_seekBarTitle.text = title
-        seekBar.max = maxValue - minValue
-        seekBar.setOnSeekBarChangeListener(object: SeekBar.OnSeekBarChangeListener {
+        tv_mediaBoxSeekBar_title.text = title
+        seekBar_mediaBoxSeekBar.max = maxValue - minValue
+        seekBar_mediaBoxSeekBar.setOnSeekBarChangeListener(object: SeekBar.OnSeekBarChangeListener {
             override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
                 currentValue = progress + minValue
                 onSeekBarChangeListener?.onProgressChanged(seekBar, currentValue, fromUser)

+ 3 - 3
reader/src/main/java/com/kdanmobile/reader/screen/reader/mediabox/shape/ShapeTabView.kt

@@ -12,7 +12,7 @@ import android.view.ViewGroup
 import com.kdanmobile.kmpdfkit.globaldata.AnnotConfig
 import com.kdanmobile.reader.R
 import com.kdanmobile.reader.screen.data.ShapeAttribute
-import com.kdanmobile.reader.screen.reader.mediabox.common.TextSeekBar
+import com.kdanmobile.reader.screen.reader.mediabox.common.MediaBoxSeekBar
 import com.kdanmobile.reader.screen.reader.mediabox.common.TitleButton
 import kotlinx.android.synthetic.main.view_viewer_edit_item_shape_border.view.*
 import kotlinx.android.synthetic.main.view_viewer_edit_item_shape_fill.view.*
@@ -105,13 +105,13 @@ class ShapeTabView : ConstraintLayout {
             }
             val view = layoutInflater.inflate(resourceId, container, false)
             if (position == 0) {
-                view.seekBar_shapeBorder_opacity.formatter = object : TextSeekBar.SeekBarFormatter {
+                view.seekBar_shapeBorder_opacity.formatter = object : MediaBoxSeekBar.SeekBarFormatter {
                     override fun format(value: Int): String {
                         return Math.round(value / 2.55).toInt().toString()
                     }
                 }
             } else {
-                view.seekBar_shapeFill_opacity.formatter = object : TextSeekBar.SeekBarFormatter {
+                view.seekBar_shapeFill_opacity.formatter = object : MediaBoxSeekBar.SeekBarFormatter {
                     override fun format(value: Int): String {
                         return Math.round(value / 2.55).toInt().toString()
                     }

+ 1 - 1
reader/src/main/res/layout/activity_view_signature_create.xml

@@ -89,7 +89,7 @@
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toLeftOf="@+id/guideline" />
 
-    <com.kdanmobile.reader.screen.reader.mediabox.common.TextSeekBar
+    <com.kdanmobile.reader.screen.reader.mediabox.common.MediaBoxSeekBar
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:id="@+id/seekBar_signature"

+ 9 - 9
reader/src/main/res/layout/view_viewer_edit_item_seekbar.xml

@@ -8,7 +8,7 @@
     tools:parentTag="android.support.constraint.ConstraintLayout">
 
     <TextView
-        android:id="@+id/tv_seekBarTitle"
+        android:id="@+id/tv_mediaBoxSeekBar_title"
         style="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
@@ -18,12 +18,12 @@
         android:textColor="#de000000"
         android:text="Size"
         android:textSize="12sp"
-        app:layout_constraintBottom_toTopOf="@+id/seekBar"
+        app:layout_constraintBottom_toTopOf="@+id/seekBar_mediaBoxSeekBar"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 
     <SeekBar
-        android:id="@+id/seekBar"
+        android:id="@+id/seekBar_mediaBoxSeekBar"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginLeft="16dp"
@@ -34,11 +34,11 @@
         android:thumbTint="#0077fd"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toLeftOf="@+id/tv_seekBarValue"
-        app:layout_constraintTop_toBottomOf="@+id/tv_seekBarTitle" />
+        app:layout_constraintRight_toLeftOf="@+id/tv_mediaBoxSeekBar_value"
+        app:layout_constraintTop_toBottomOf="@+id/tv_mediaBoxSeekBar_title" />
 
     <TextView
-        android:id="@+id/tv_seekBarValue"
+        android:id="@+id/tv_mediaBoxSeekBar_value"
         android:layout_width="36dp"
         android:layout_height="wrap_content"
         android:gravity="end"
@@ -47,9 +47,9 @@
         android:textColor="#61000000"
         android:text="24pt"
         android:textSize="12sp"
-        app:layout_constraintBottom_toBottomOf="@+id/seekBar"
-        app:layout_constraintLeft_toRightOf="@+id/seekBar"
+        app:layout_constraintBottom_toBottomOf="@+id/seekBar_mediaBoxSeekBar"
+        app:layout_constraintLeft_toRightOf="@+id/seekBar_mediaBoxSeekBar"
         app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toTopOf="@+id/seekBar" />
+        app:layout_constraintTop_toTopOf="@+id/seekBar_mediaBoxSeekBar" />
 
 </merge>

+ 2 - 2
reader/src/main/res/layout/view_viewer_edit_item_shape_border.xml

@@ -15,7 +15,7 @@
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toTopOf="@+id/seekBar_shapeBorder_opacity" />
 
-    <com.kdanmobile.reader.screen.reader.mediabox.common.TextSeekBar
+    <com.kdanmobile.reader.screen.reader.mediabox.common.MediaBoxSeekBar
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:id="@+id/seekBar_shapeBorder_opacity"
@@ -30,7 +30,7 @@
         app:layout_constraintTop_toBottomOf="@+id/colorChooser_shapeBorder"
         app:layout_constraintBottom_toTopOf="@+id/seekBar_shapeBorder_thickness" />
 
-    <com.kdanmobile.reader.screen.reader.mediabox.common.TextSeekBar
+    <com.kdanmobile.reader.screen.reader.mediabox.common.MediaBoxSeekBar
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:id="@+id/seekBar_shapeBorder_thickness"

+ 1 - 1
reader/src/main/res/layout/view_viewer_edit_item_shape_fill.xml

@@ -15,7 +15,7 @@
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintBottom_toTopOf="@+id/seekBar_shapeFill_opacity" />
 
-    <com.kdanmobile.reader.screen.reader.mediabox.common.TextSeekBar
+    <com.kdanmobile.reader.screen.reader.mediabox.common.MediaBoxSeekBar
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:id="@+id/seekBar_shapeFill_opacity"

+ 1 - 1
reader/src/main/res/layout/view_viewer_edit_tab_text_box.xml

@@ -68,7 +68,7 @@
         app:layout_constraintTop_toBottomOf="@+id/textAttrView_textBox"
         app:layout_constraintBottom_toTopOf="@+id/seekBar_textBox_textSize" />
 
-    <com.kdanmobile.reader.screen.reader.mediabox.common.TextSeekBar
+    <com.kdanmobile.reader.screen.reader.mediabox.common.MediaBoxSeekBar
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:id="@+id/seekBar_textBox_textSize"

+ 1 - 1
reader/src/main/res/values/attrs.xml

@@ -8,7 +8,7 @@
 
     <attr name="title" format="string" />
 
-    <declare-styleable name="TextSeekBar">
+    <declare-styleable name="MediaBoxSeekBar">
         <attr name="title" />
         <attr name="unit" format="string" />
         <attr name="maxValue" format="integer" />