|
@@ -9,16 +9,21 @@ import android.util.AttributeSet
|
|
import android.view.LayoutInflater
|
|
import android.view.LayoutInflater
|
|
import android.view.View
|
|
import android.view.View
|
|
import android.view.ViewGroup
|
|
import android.view.ViewGroup
|
|
-import com.kdanmobile.kmpdfkit.annotation.bean.KMPDFArrowAnnotationBean
|
|
|
|
-import com.kdanmobile.kmpdfkit.annotation.bean.KMPDFCircleAnnotationBean
|
|
|
|
-import com.kdanmobile.kmpdfkit.annotation.bean.KMPDFLineAnnotationBean
|
|
|
|
-import com.kdanmobile.kmpdfkit.annotation.bean.KMPDFSquareAnnotationBean
|
|
|
|
import com.kdanmobile.kmpdfkit.globaldata.AnnotConfig
|
|
import com.kdanmobile.kmpdfkit.globaldata.AnnotConfig
|
|
import com.kdanmobile.reader.R
|
|
import com.kdanmobile.reader.R
|
|
|
|
+import com.kdanmobile.reader.screen.data.ShapeAttribute
|
|
|
|
+import kotlinx.android.synthetic.main.view_viewer_edit_item_shape_border.view.*
|
|
|
|
+import kotlinx.android.synthetic.main.view_viewer_edit_item_shape_fill.view.*
|
|
import kotlinx.android.synthetic.main.view_viewer_edit_tab_shape.view.*
|
|
import kotlinx.android.synthetic.main.view_viewer_edit_tab_shape.view.*
|
|
|
|
|
|
class ShapeTabView : ConstraintLayout {
|
|
class ShapeTabView : ConstraintLayout {
|
|
|
|
|
|
|
|
+ var onTitleButtonClickListener: TitleButton.OnTitleButtonClickListener? = null
|
|
|
|
+ set(value) {
|
|
|
|
+ field = value
|
|
|
|
+ titleButton_shape?.onTitleButtonClickListener = field
|
|
|
|
+ }
|
|
|
|
+
|
|
var shapeType = AnnotConfig.ShapeAnnotationType.CIRCLE
|
|
var shapeType = AnnotConfig.ShapeAnnotationType.CIRCLE
|
|
set(value) {
|
|
set(value) {
|
|
field = value
|
|
field = value
|
|
@@ -41,9 +46,12 @@ class ShapeTabView : ConstraintLayout {
|
|
btn_arrow?.setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN)
|
|
btn_arrow?.setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- println(value.toString())
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private var seekBarShapeBorderOpacity: TextSeekBar? = null
|
|
|
|
+ private var seekBarShapeBorderThickness: TextSeekBar? = null
|
|
|
|
+ private var seekBarShapeFillOpacity: TextSeekBar? = null
|
|
|
|
+
|
|
constructor(context: Context) : super(context) {
|
|
constructor(context: Context) : super(context) {
|
|
initView()
|
|
initView()
|
|
}
|
|
}
|
|
@@ -59,25 +67,6 @@ class ShapeTabView : ConstraintLayout {
|
|
private fun initView() {
|
|
private fun initView() {
|
|
LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab_shape, this)
|
|
LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab_shape, this)
|
|
|
|
|
|
- titleButton_shape.onButtonClickListener = OnClickListener { _ ->
|
|
|
|
- println("onButtonClick")
|
|
|
|
-
|
|
|
|
- when (shapeType) {
|
|
|
|
- AnnotConfig.ShapeAnnotationType.CIRCLE -> {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- AnnotConfig.ShapeAnnotationType.SQUARE -> {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- AnnotConfig.ShapeAnnotationType.LINE -> {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- AnnotConfig.ShapeAnnotationType.ARROW -> {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
btn_circle.setOnClickListener { _ ->
|
|
btn_circle.setOnClickListener { _ ->
|
|
shapeType = AnnotConfig.ShapeAnnotationType.CIRCLE
|
|
shapeType = AnnotConfig.ShapeAnnotationType.CIRCLE
|
|
}
|
|
}
|
|
@@ -99,15 +88,33 @@ class ShapeTabView : ConstraintLayout {
|
|
tabLayout.setupWithViewPager(viewPager)
|
|
tabLayout.setupWithViewPager(viewPager)
|
|
}
|
|
}
|
|
|
|
|
|
- private class ViewPagerAdapter(context: Context, private val tabs: ArrayList<String>) : PagerAdapter() {
|
|
|
|
|
|
+ private inner class ViewPagerAdapter(context: Context, private val tabs: ArrayList<String>) : PagerAdapter() {
|
|
private val layoutInflater = LayoutInflater.from(context)
|
|
private val layoutInflater = LayoutInflater.from(context)
|
|
|
|
|
|
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
override fun instantiateItem(container: ViewGroup, position: Int): Any {
|
|
- val resourceId = when (position) {
|
|
|
|
- 0 -> R.layout.view_viewer_edit_item_shape_border
|
|
|
|
- else -> R.layout.view_viewer_edit_item_shape_fill
|
|
|
|
|
|
+ val resourceId = when (position == 0) {
|
|
|
|
+ true -> R.layout.view_viewer_edit_item_shape_border
|
|
|
|
+ false -> R.layout.view_viewer_edit_item_shape_fill
|
|
}
|
|
}
|
|
val view = layoutInflater.inflate(resourceId, container, false)
|
|
val view = layoutInflater.inflate(resourceId, container, false)
|
|
|
|
+ if (position == 0) {
|
|
|
|
+ seekBarShapeBorderOpacity = view.seekBar_shapeBorder_opacity
|
|
|
|
+ seekBarShapeBorderThickness = view.seekBar_shapeBorder_thickness
|
|
|
|
+
|
|
|
|
+ seekBarShapeBorderOpacity?.formatter = object : TextSeekBar.SeekBarFormatter {
|
|
|
|
+ override fun format(value: Int): String {
|
|
|
|
+ return Math.round(value / 2.55).toInt().toString()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ seekBarShapeFillOpacity = view.seekBar_shapeFill_opacity
|
|
|
|
+
|
|
|
|
+ seekBarShapeFillOpacity?.formatter = object : TextSeekBar.SeekBarFormatter {
|
|
|
|
+ override fun format(value: Int): String {
|
|
|
|
+ return Math.round(value / 2.55).toInt().toString()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
container.addView(view)
|
|
container.addView(view)
|
|
return view
|
|
return view
|
|
}
|
|
}
|