|
@@ -8,6 +8,7 @@ import android.view.LayoutInflater
|
|
import android.view.View
|
|
import android.view.View
|
|
import android.widget.ImageButton
|
|
import android.widget.ImageButton
|
|
import com.kdanmobile.reader.R
|
|
import com.kdanmobile.reader.R
|
|
|
|
+import com.kdanmobile.reader.screen.view.edit.ShapeTabView
|
|
import com.kdanmobile.reader.screen.view.edit.TextBoxTabView
|
|
import com.kdanmobile.reader.screen.view.edit.TextBoxTabView
|
|
import kotlinx.android.synthetic.main.view_viewer_edit.view.*
|
|
import kotlinx.android.synthetic.main.view_viewer_edit.view.*
|
|
|
|
|
|
@@ -20,8 +21,6 @@ class ViewerEditView : ConstraintLayout {
|
|
private var tabType = ViewerEditTabType.NONE
|
|
private var tabType = ViewerEditTabType.NONE
|
|
private var selected: ImageButton? = null
|
|
private var selected: ImageButton? = null
|
|
|
|
|
|
-// private val selectedColor = ContextCompat.getColor(context, R.color.reader_viewer_edit_tab_color_selected)
|
|
|
|
-
|
|
|
|
constructor(context: Context) : super(context) {
|
|
constructor(context: Context) : super(context) {
|
|
initView()
|
|
initView()
|
|
}
|
|
}
|
|
@@ -49,17 +48,17 @@ class ViewerEditView : ConstraintLayout {
|
|
}
|
|
}
|
|
|
|
|
|
private fun getButtonDrawable(tabType: ViewerEditTabType, isSelected: Boolean): Int {
|
|
private fun getButtonDrawable(tabType: ViewerEditTabType, isSelected: Boolean): Int {
|
|
- when (tabType) {
|
|
|
|
|
|
+ return when (tabType) {
|
|
ViewerEditTabType.NONE, ViewerEditTabType.TEXT_BOX ->
|
|
ViewerEditTabType.NONE, ViewerEditTabType.TEXT_BOX ->
|
|
- return if (isSelected) R.drawable.ic_textbox_selected else R.drawable.ic_textbox
|
|
|
|
|
|
+ if (isSelected) R.drawable.ic_textbox_selected else R.drawable.ic_textbox
|
|
ViewerEditTabType.SIGNATURE ->
|
|
ViewerEditTabType.SIGNATURE ->
|
|
- return if (isSelected) R.drawable.ic_signature_selected else R.drawable.ic_signature
|
|
|
|
|
|
+ if (isSelected) R.drawable.ic_signature_selected else R.drawable.ic_signature
|
|
ViewerEditTabType.STAMP ->
|
|
ViewerEditTabType.STAMP ->
|
|
- return if (isSelected) R.drawable.ic_stamp_selected else R.drawable.ic_stamp
|
|
|
|
|
|
+ if (isSelected) R.drawable.ic_stamp_selected else R.drawable.ic_stamp
|
|
ViewerEditTabType.SHAPE ->
|
|
ViewerEditTabType.SHAPE ->
|
|
- return if (isSelected) R.drawable.ic_shape_selected else R.drawable.ic_shape
|
|
|
|
|
|
+ if (isSelected) R.drawable.ic_shape_selected else R.drawable.ic_shape
|
|
ViewerEditTabType.FORM ->
|
|
ViewerEditTabType.FORM ->
|
|
- return if (isSelected) R.drawable.ic_form_selected else R.drawable.ic_form
|
|
|
|
|
|
+ if (isSelected) R.drawable.ic_form_selected else R.drawable.ic_form
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -68,12 +67,8 @@ class ViewerEditView : ConstraintLayout {
|
|
if (this.tabType != tabType) {
|
|
if (this.tabType != tabType) {
|
|
selected?.setImageDrawable(ContextCompat.getDrawable(context, getButtonDrawable(this.tabType, false)))
|
|
selected?.setImageDrawable(ContextCompat.getDrawable(context, getButtonDrawable(this.tabType, false)))
|
|
this.tabType = tabType
|
|
this.tabType = tabType
|
|
-// selected?.clearColorFilter()
|
|
|
|
selected = button
|
|
selected = button
|
|
button.setImageDrawable(ContextCompat.getDrawable(context, getButtonDrawable(this.tabType, true)))
|
|
button.setImageDrawable(ContextCompat.getDrawable(context, getButtonDrawable(this.tabType, true)))
|
|
-// button.drawable.setColorFilter(selectedColor, PorterDuff.Mode.SRC_IN)
|
|
|
|
-// button.setColorFilter(selectedColor, PorterDuff.Mode.SRC_IN)
|
|
|
|
-// button.setColorFilter(Color.BLACK, PorterDuff.Mode.SCREEN)
|
|
|
|
|
|
|
|
viewEdit_layout_tab_content.removeAllViews()
|
|
viewEdit_layout_tab_content.removeAllViews()
|
|
changed = true
|
|
changed = true
|
|
@@ -111,12 +106,14 @@ class ViewerEditView : ConstraintLayout {
|
|
//TODO implements tab view and add to viewEdit_layout_tab_content
|
|
//TODO implements tab view and add to viewEdit_layout_tab_content
|
|
val changed = setupContent(view as ImageButton, ViewerEditTabType.SHAPE)
|
|
val changed = setupContent(view as ImageButton, ViewerEditTabType.SHAPE)
|
|
if (changed) {
|
|
if (changed) {
|
|
- LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab, viewEdit_layout_tab_content)
|
|
|
|
|
|
+ val shapeTabView = ShapeTabView(context)
|
|
|
|
+ val params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT)
|
|
|
|
+ viewEdit_layout_tab_content.addView(shapeTabView, params)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
private fun setupFormView(view: View) {
|
|
private fun setupFormView(view: View) {
|
|
-//TODO implements tab view and add to viewEdit_layout_tab_content
|
|
|
|
|
|
+ //TODO implements tab view and add to viewEdit_layout_tab_content
|
|
val changed = setupContent(view as ImageButton, ViewerEditTabType.FORM)
|
|
val changed = setupContent(view as ImageButton, ViewerEditTabType.FORM)
|
|
if (changed) {
|
|
if (changed) {
|
|
LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab, viewEdit_layout_tab_content)
|
|
LayoutInflater.from(context).inflate(R.layout.view_viewer_edit_tab, viewEdit_layout_tab_content)
|