瀏覽代碼

Merge branch 'Layout-Problem-DiologView-layerManagemet-BugFix'

faterhenry 6 年之前
父節點
當前提交
4c35eebba1

+ 92 - 2
src/main/java/com/bomostory/sceneeditmodule/SceneEditActivity.kt

@@ -35,6 +35,7 @@ import com.example.tfat.myapplication.navigationbar.EditSceneView
 import com.example.tfat.myapplication.navigationbar.RecordFinishView
 import io.reactivex.android.schedulers.AndroidSchedulers
 import io.reactivex.schedulers.Schedulers
+import kotlinx.android.synthetic.main.layer_management_fragment.*
 import java.util.concurrent.CopyOnWriteArrayList
 
 class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener, EditActorView.OnActorChangeListener,
@@ -58,6 +59,8 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         const val LAYER_MANAGEMENT = "layer_management"
         const val ACTOR_HEIGHT = 200
         const val ACTOR_WIDTH = 200
+        const val DIALOGUE_HEIGHT = 320
+        const val DIALOGUE_WIDTH = 400
         const val ACTOR_INIT_POSITION_X = 200
         const val ACTOR_INIT_POSITION_Y = 200
         const val BACKGROUND_MOVE_RATE = 32
@@ -75,6 +78,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         resourceThemeBitmap = project.sceneResource as ArrayList<String>
         resourceActorBitmap = project.actorResource as ArrayList<ArrayList<String>>
         windowManager.defaultDisplay.getMetrics(monitorSize)
+        var layoutPrams = sceneEditView.layoutParams
+        layoutPrams.width = monitorSize.widthPixels
+        layoutPrams.height = monitorSize.widthPixels.div(2)
+        sceneEditView.layoutParams = layoutPrams
         project.story?.let {
             it.scenes?.let{
                 it[0].sceneWidth = monitorSize.widthPixels
@@ -255,6 +262,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         switchLayer(0)
         sceneEditView.findViewById<LayerView>(currentLayerIndex).setOnDragListener(dragListener())
         viewContainer.addView(dialogueView)
+        dialogueView.layoutParams.width = monitorSize.widthPixels
     }
 
     private fun initActorRecyclerView() {
@@ -274,6 +282,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         actorRecyclerView.layoutManager = layoutManager
         actorRecyclerView.adapter = actorAdapter
         viewContainer.addView(selectActorView)
+        selectActorView.layoutParams.width = monitorSize.widthPixels
     }
 
     private fun initControlSceneView() {
@@ -401,6 +410,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
                     sceneEditView.scene = it[position]
                 }
             }
+            record = Record()
             initControlBarView()
             initNavigationBarView()
         }
@@ -556,8 +566,8 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
                 dialog.positionX = positionX
                 dialog.positionY = positionY
                 dialog.positionZ = it[currentSceneIndex].layers[currentLayerIndex].actors.size
-                dialog.sideLength = ACTOR_WIDTH
-                dialog.sideHeight = ACTOR_HEIGHT
+                dialog.sideLength = DIALOGUE_WIDTH
+                dialog.sideHeight = DIALOGUE_HEIGHT
                 dialog.parentLayerIndex = currentLayerIndex
                 dialog.isMoveable = true
                 it[currentSceneIndex].layers[currentLayerIndex].actors.add(dialog)
@@ -775,4 +785,84 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
             }
         }
     }
+
+    override fun onLayerManagementDialog(layerNum: Int, position: Int) {
+        var actor = Actor()
+        val selectLayer = layerNum - 1
+        project.story?.let {
+            it.scenes?.let {
+                actor = it[currentSceneIndex].layers[selectLayer].actors[position]
+            }
+        }
+        var popupWindow = PopupWindow(this)
+        val popupView = LayoutInflater.from(this).inflate(R.layout.control_actor_dialog, null)
+        popupView.duplicate.setOnClickListener{
+            project.story?.let {
+                it.scenes?.let {
+                    val actorData = Actor().apply {
+                        positionX = actor.positionX + 100
+                        positionY = actor.positionY + 100
+                        positionZ = it[currentSceneIndex].layers[selectLayer].actors.size
+                        sideLength = actor.sideLength
+                        sideHeight = actor.sideHeight
+                        resourcePath = actor.resourcePath
+                        parentLayerIndex = selectLayer
+                        isMoveable = true
+                    }
+                    it[currentSceneIndex].layers[selectLayer].actors.add(actorData)
+                    setActorPositionZ(it[currentSceneIndex].layers[selectLayer].actors)
+                    sceneEditView.scene = it[currentSceneIndex]
+                    popupWindow.dismiss()
+                    layerManagementDialog.setData(it[currentSceneIndex])
+                }
+            }
+        }
+        popupView.bring_to_front.setOnClickListener{
+            project.story?.let {
+                it.scenes?.let {
+                    it[currentSceneIndex].layers[selectLayer].actors.remove(actor)
+                    it[currentSceneIndex].layers[selectLayer].actors.add(actor)
+                    setActorPositionZ(it[selectLayer].layers[selectLayer].actors)
+                    sceneEditView.scene = it[currentSceneIndex]
+                    popupWindow.dismiss()
+                    layerManagementDialog.setData(it[currentSceneIndex])
+                }
+            }
+        }
+        popupView.send_to_back.setOnClickListener{
+            project.story?.let {
+                it.scenes?.let {
+                    it[currentSceneIndex].layers[selectLayer].actors.remove(actor)
+                    it[currentSceneIndex].layers[selectLayer].actors.add(0, actor)
+                    setActorPositionZ(it[currentSceneIndex].layers[selectLayer].actors)
+                    sceneEditView.scene = it[currentSceneIndex]
+                    popupWindow.dismiss()
+                    layerManagementDialog.setData(it[currentSceneIndex])
+                }
+            }
+        }
+        popupView.delete.setOnClickListener{
+            project.story?.let {
+                it.scenes?.let {
+                    it[currentSceneIndex].layers[selectLayer].actors.removeAt(actor.positionZ)
+                    sceneEditView.scene = it[currentSceneIndex]
+                    popupWindow.dismiss()
+                    layerManagementDialog.setData(it[currentSceneIndex])
+                }
+            }
+        }
+        popupWindow.contentView = popupView
+        popupWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
+        popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
+        popupWindow.isOutsideTouchable = true
+        var valueXInPixels = resources.getDimension(R.dimen.actor_width)
+        when(layerNum){
+            1 -> popupWindow.showAsDropDown(layerManagementDialog.rv_layer_management_layer1, valueXInPixels.toInt() * position, 0)
+            2 -> popupWindow.showAsDropDown(layerManagementDialog.rv_layer_management_layer2, valueXInPixels.toInt() * position, 0)
+            3 -> popupWindow.showAsDropDown(layerManagementDialog.rv_layer_management_layer2, valueXInPixels.toInt() * position + valueXInPixels.toInt(),0)
+            4 -> popupWindow.showAsDropDown(layerManagementDialog.rv_layer_management_layer1, valueXInPixels.toInt() * position, 0)
+            5 -> popupWindow.showAsDropDown(layerManagementDialog.rv_layer_management_layer2, valueXInPixels.toInt() * position, 0)
+        }
+
+    }
 }

+ 41 - 22
src/main/java/com/bomostory/sceneeditmodule/layermanagement/LayerManagementDialog.kt

@@ -204,41 +204,60 @@ class LayerManagementDialog : DialogFragment() {
     }
 
     private fun onActorTouchListener(layer: Int,position: Int) : View.OnTouchListener {
+        var positionX = 0
+        var positionY = 0
         return View.OnTouchListener {view, motionEvent ->
             when (motionEvent.action) {
                 MotionEvent.ACTION_DOWN -> {
-                    when (layer == selectLayer) {
-                        true -> {
-                            val item = ClipData.Item(position.toString())
-                            val mimeTypes = arrayOf(ClipDescription.MIMETYPE_TEXT_PLAIN)
-                            val dragData = ClipData(null, mimeTypes, item)
-                            val shadow = View.DragShadowBuilder(view)
-                            view.startDrag(dragData, shadow, null, View.DRAG_FLAG_GLOBAL)
-                        }
-                        false -> {
-                            selectLayer = layer
-                            layout_layer_management_layer1.setBackgroundColor(Color.parseColor("#ffffff"))
-                            layout_layer_management_layer2.setBackgroundColor(Color.parseColor("#ffffff"))
-                            layout_layer_management_layer3.setBackgroundColor(Color.parseColor("#ffffff"))
-                            layout_layer_management_layer4.setBackgroundColor(Color.parseColor("#ffffff"))
-                            layout_layer_management_layer5.setBackgroundColor(Color.parseColor("#ffffff"))
-                            when(selectLayer){
-                                1 -> layout_layer_management_layer1.setBackgroundColor(Color.parseColor("#efeae1"))
-                                2 -> layout_layer_management_layer2.setBackgroundColor(Color.parseColor("#efeae1"))
-                                3 -> layout_layer_management_layer3.setBackgroundColor(Color.parseColor("#efeae1"))
-                                4 -> layout_layer_management_layer4.setBackgroundColor(Color.parseColor("#efeae1"))
-                                5 -> layout_layer_management_layer5.setBackgroundColor(Color.parseColor("#efeae1"))
+                    positionX = (motionEvent.x).toInt()
+                    positionY = (motionEvent.y).toInt()
+                }
+                MotionEvent.ACTION_MOVE -> {
+                    if (!(Math.abs(motionEvent.x - positionX) < 10 && Math.abs(motionEvent.y - positionY) < 10)) {
+                        when (layer == selectLayer) {
+                            true -> {
+                                val item = ClipData.Item(position.toString())
+                                val mimeTypes = arrayOf(ClipDescription.MIMETYPE_TEXT_PLAIN)
+                                val dragData = ClipData(null, mimeTypes, item)
+                                val shadow = View.DragShadowBuilder(view)
+                                view.startDrag(dragData, shadow, null, View.DRAG_FLAG_GLOBAL)
+                            }
+                            false -> {
+                                setLayerSelected(layer)
                             }
                         }
                     }
-
+                }
+                MotionEvent.ACTION_UP -> {
+                    if (Math.abs(motionEvent.x - positionX) < 10 && Math.abs(motionEvent.y - positionY) < 10 && layer == selectLayer) {
+                        layerChangeListener?.onLayerManagementDialog(layer, position)
+                    } else {
+                        setLayerSelected(layer)
+                    }
                 }
             }
             return@OnTouchListener true
         }
     }
 
+    private fun setLayerSelected(layer: Int){
+        selectLayer = layer
+        layout_layer_management_layer1.setBackgroundColor(Color.parseColor("#ffffff"))
+        layout_layer_management_layer2.setBackgroundColor(Color.parseColor("#ffffff"))
+        layout_layer_management_layer3.setBackgroundColor(Color.parseColor("#ffffff"))
+        layout_layer_management_layer4.setBackgroundColor(Color.parseColor("#ffffff"))
+        layout_layer_management_layer5.setBackgroundColor(Color.parseColor("#ffffff"))
+        when (selectLayer) {
+            1 -> layout_layer_management_layer1.setBackgroundColor(Color.parseColor("#efeae1"))
+            2 -> layout_layer_management_layer2.setBackgroundColor(Color.parseColor("#efeae1"))
+            3 -> layout_layer_management_layer3.setBackgroundColor(Color.parseColor("#efeae1"))
+            4 -> layout_layer_management_layer4.setBackgroundColor(Color.parseColor("#efeae1"))
+            5 -> layout_layer_management_layer5.setBackgroundColor(Color.parseColor("#efeae1"))
+        }
+    }
+
     interface OnLayerChange{
         fun onLayerChange(layerFrom: Int, layerTo: Int, position: Int)
+        fun onLayerManagementDialog(layer: Int, position: Int)
     }
 }

+ 295 - 1
src/main/java/com/bomostory/sceneeditmodule/screen/view/DialogueView.kt

@@ -1,9 +1,22 @@
 package com.bomostory.sceneeditmodule.screen.view
 
 import android.content.Context
+import android.graphics.*
+import android.support.v4.content.ContextCompat
 import android.util.AttributeSet
+import android.view.View
+import com.example.tfat.myapplication.R
+import android.graphics.drawable.VectorDrawable
+import android.graphics.BitmapFactory
+import android.graphics.drawable.BitmapDrawable
+import android.graphics.Bitmap
+import android.view.MotionEvent
+import android.widget.RelativeLayout
+import com.bomostory.sceneeditmodule.basicdata.Actor
+import com.bomostory.sceneeditmodule.basicdata.Dialogue
+import kotlinx.android.synthetic.main.actor_view.view.*
 
-class DialogueView : EditActorView {
+class DialogueView : EditActorView{
 
     constructor(context: Context) : super(context)
 
@@ -11,4 +24,285 @@ class DialogueView : EditActorView {
 
     constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle)
 
+    var dialogue = Dialogue()
+        set(value) {
+            value?.let {
+                field = value
+                val layoutParams = RelativeLayout.LayoutParams(it.sideLength, it.sideHeight)
+                layoutParams.leftMargin = it.positionX
+                layoutParams.topMargin = it.positionY
+                actor_layout.layoutParams = layoutParams
+                val actorLayoutParams = RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
+                actor_view_layout.layoutParams = actorLayoutParams
+                when(it.isMoveable) {
+                    true -> actor_view_layout.setOnTouchListener(actorOnTouchListener())
+                }
+                when(it.isSelect){
+                    true -> change_size_view.visibility = View.VISIBLE
+                    false -> change_size_view.visibility = View.GONE
+                }
+            }
+        }
+
+    override var actor = Actor()
+
+    override fun onDraw(canvas: Canvas?) {
+        super.onDraw(canvas)
+        val mPaint = Paint()
+        mPaint.style = Paint.Style.STROKE
+        mPaint.strokeWidth = 1f
+        mPaint.isAntiAlias = true
+        mPaint.color = Color.parseColor("#000000")
+        mPaint.textSize = 40f
+        mPaint.textAlign = Paint.Align.CENTER
+        var mResId = dialogue.resource
+        val drawable = ContextCompat.getDrawable(context, mResId)
+        var valuePaddingInPixels = resources.getDimension(R.dimen.edit_actor_padding)
+        if (drawable is BitmapDrawable) {
+            var bitmap = BitmapFactory.decodeResource(context.resources, mResId)
+            canvas?.drawBitmap(bitmap,0f,0f, null)
+        } else if (drawable is VectorDrawable) {
+            canvas?.drawBitmap(getBitmap(drawable),null, RectF(dialogue.positionX.toFloat() + valuePaddingInPixels, dialogue.positionY.toFloat() + valuePaddingInPixels,
+                              dialogue.positionX.toFloat() + dialogue.sideLength.toFloat() - valuePaddingInPixels,
+                            dialogue.positionY.toFloat() + dialogue.sideHeight.toFloat() - valuePaddingInPixels), null)
+        } else {
+            throw IllegalArgumentException("unsupported drawable type")
+        }
+        canvas?.drawText("Sample Text",dialogue.positionX.toFloat() + dialogue.sideLength.div(2),dialogue.positionY.toFloat() + dialogue.sideHeight.div(2), mPaint)
+    }
+
+    private fun getBitmap(vectorDrawable: VectorDrawable): Bitmap {
+        val bitmap = Bitmap.createBitmap(vectorDrawable.intrinsicWidth,
+                vectorDrawable.intrinsicHeight, Bitmap.Config.ARGB_8888)
+        val canvas = Canvas(bitmap)
+        vectorDrawable.setBounds(0, 0, canvas.width, canvas.height)
+        vectorDrawable.draw(canvas)
+        return bitmap
+    }
+
+    private fun actorOnTouchListener() : View.OnTouchListener {
+        var clickPeriod = 0L
+        var positionStart = 0
+        var positionEnd = 0
+        var mx: Int
+        var my: Int
+        return View.OnTouchListener { view, motionEvent ->
+            when (motionEvent.action) {
+                MotionEvent.ACTION_DOWN -> {
+                    clickPeriod = System.currentTimeMillis()
+                    positionStart = (motionEvent.x).toInt()
+                    positionEnd = (motionEvent.y).toInt()
+                }
+                MotionEvent.ACTION_MOVE -> {
+                    if (!(Math.abs(motionEvent.x - positionStart) < 10 && Math.abs(motionEvent.y - positionEnd) < 10) && actor.isSelect) {
+                        mx = motionEvent.rawX.toInt() - positionStart
+                        my = motionEvent.rawY.toInt() - positionEnd
+                        var laParams = actor_layout.layoutParams as RelativeLayout.LayoutParams
+                        laParams.setMargins(mx, my - 200, 0, 0)
+                        actor_layout.layoutParams = laParams
+                        val actorLayoutParams = RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
+                        view.layoutParams = actorLayoutParams
+                        actor.positionX = mx
+                        actor.positionY = my - 200
+                    }
+                }
+                MotionEvent.ACTION_UP -> {
+                    if (Math.abs(motionEvent.x - positionStart) < 10 && Math.abs(motionEvent.y - positionEnd) < 10 && (System.currentTimeMillis() - clickPeriod) > 1000) {
+                        actorCallback?.onActorLongClick(actor)
+                    } else if (Math.abs(motionEvent.x - positionStart) < 10 && Math.abs(motionEvent.y - positionEnd) < 10) {
+                        actorCallback?.onActorSelected(actor)
+                    } else {
+                        if (actor.isSelect){
+                            actorCallback?.onActorChange(actor)
+                        }
+                    }
+                }
+            }
+            return@OnTouchListener true
+        }
+    }
+
+    override fun rightBottomSizeChangeListener() : View.OnTouchListener {
+        var positionX = 0
+        var positionY = 0
+        var sizeX = 0
+        var sizeY = 0
+        var x = 0
+        var y = 0
+        return View.OnTouchListener { view, motionEvent ->
+            when (motionEvent.action) {
+                MotionEvent.ACTION_DOWN -> {
+                    val layoutParams = actor_layout.layoutParams as RelativeLayout.LayoutParams
+                    sizeX = layoutParams.width
+                    sizeY = layoutParams.height
+                    x = layoutParams.leftMargin
+                    y = layoutParams.topMargin
+                    positionX = (motionEvent.rawX).toInt()
+                    positionY = (motionEvent.rawY).toInt()
+                }
+                MotionEvent.ACTION_MOVE -> {
+                    var mx =  motionEvent.rawX.toInt() - positionX
+                    var my =  motionEvent.rawY.toInt() - positionY
+                    var dP = when (Math.abs(mx) > Math.abs(my)){
+                        true ->  my
+                        false -> mx
+                    }
+                    var dialogueData = Dialogue().apply {
+                        resource = dialogue.resource
+                        this.positionX = x
+                        this.positionY = y
+                        positionZ = actor.positionZ
+                        sideLength = sizeX + dP
+                        sideHeight = sizeY + dP
+                        isSelect = actor.isSelect
+                        parentLayerIndex = actor.parentLayerIndex
+                        isMoveable = actor.isMoveable
+                    }
+                    dialogue = dialogueData
+                }
+                MotionEvent.ACTION_UP -> {
+                    actor.isSelect = true
+                    actorCallback?.onActorChange(dialogue)
+                }
+            }
+            return@OnTouchListener true
+        }
+    }
+
+    override fun leftTopSizeChangeListener() : View.OnTouchListener {
+        var positionX = 0
+        var positionY = 0
+        var sizeX = 0
+        var sizeY = 0
+        var x = 0
+        var y = 0
+        return View.OnTouchListener { view, motionEvent ->
+            when (motionEvent.action) {
+                MotionEvent.ACTION_DOWN -> {
+                    val layoutParams = actor_layout.layoutParams as RelativeLayout.LayoutParams
+                    sizeX = layoutParams.width
+                    sizeY = layoutParams.height
+                    x = layoutParams.leftMargin
+                    y = layoutParams.topMargin
+                    positionX = (motionEvent.rawX).toInt()
+                    positionY = (motionEvent.rawY).toInt()
+                }
+                MotionEvent.ACTION_MOVE -> {
+                    val mx =  motionEvent.rawX.toInt() - positionX
+                    val my =  motionEvent.rawY.toInt() - positionY
+                    var dP = when (Math.abs(mx) > Math.abs(my)){
+                        true ->  my
+                        false -> mx
+                    }
+                    var dialogueData = Dialogue().apply {
+                        resource = dialogue.resource
+                        this.positionX = x + dP
+                        this.positionY = y + dP
+                        positionZ = actor.positionZ
+                        sideLength = sizeX - dP
+                        sideHeight = sizeY - dP
+                        isSelect = actor.isSelect
+                        parentLayerIndex = actor.parentLayerIndex
+                        isMoveable = actor.isMoveable
+                    }
+                    dialogue = dialogueData
+                }
+                MotionEvent.ACTION_UP -> {
+                    actor.isSelect = true
+                    actorCallback?.onActorChange(dialogue)
+                }
+            }
+            return@OnTouchListener true
+        }
+    }
+
+    override fun rightTopSizeChangeListener() : View.OnTouchListener {
+        var positionX = 0
+        var positionY = 0
+        var sizeX = 0
+        var sizeY = 0
+        var x = 0
+        var y = 0
+        return View.OnTouchListener { view, motionEvent ->
+            when (motionEvent.action) {
+                MotionEvent.ACTION_DOWN -> {
+                    val layoutParams = actor_layout.layoutParams as RelativeLayout.LayoutParams
+                    sizeX = layoutParams.width
+                    sizeY = layoutParams.height
+                    x = layoutParams.leftMargin
+                    y = layoutParams.topMargin
+                    positionX = (motionEvent.rawX).toInt()
+                    positionY = (motionEvent.rawY).toInt()
+                }
+                MotionEvent.ACTION_MOVE -> {
+                    var mx =  motionEvent.rawX.toInt() - positionX
+                    var my =  motionEvent.rawY.toInt() - positionY
+                    var dP = when (Math.abs(mx) > Math.abs(my)){
+                        true ->  my
+                        false -> mx
+                    }
+                    var dialogueData = Dialogue().apply {
+                        resource = dialogue.resource
+                        this.positionX = x
+                        this.positionY = y + my
+                        positionZ = actor.positionZ
+                        sideLength = sizeX + mx
+                        sideHeight = sizeY - my
+                        isSelect = actor.isSelect
+                        parentLayerIndex = actor.parentLayerIndex
+                        isMoveable = actor.isMoveable
+                    }
+                    dialogue = dialogueData
+                }
+                MotionEvent.ACTION_UP -> {
+                    actor.isSelect = true
+                    actorCallback?.onActorChange(dialogue)
+                }
+            }
+            return@OnTouchListener true
+        }
+    }
+
+    override fun leftBottomSizeChangeListener() : View.OnTouchListener {
+        var positionX = 0
+        var positionY = 0
+        var sizeX = 0
+        var sizeY = 0
+        var x = 0
+        var y = 0
+        return View.OnTouchListener { view, motionEvent ->
+            when (motionEvent.action) {
+                MotionEvent.ACTION_DOWN -> {
+                    val layoutParams = actor_layout.layoutParams as RelativeLayout.LayoutParams
+                    sizeX = layoutParams.width
+                    sizeY = layoutParams.height
+                    x = layoutParams.leftMargin
+                    y = layoutParams.topMargin
+                    positionX = (motionEvent.rawX).toInt()
+                    positionY = (motionEvent.rawY).toInt()
+                }
+                MotionEvent.ACTION_MOVE -> {
+                    var mx =  motionEvent.rawX.toInt() - positionX
+                    var my =  motionEvent.rawY.toInt() - positionY
+                    var dialogueData = Dialogue().apply {
+                        resource = dialogue.resource
+                        this.positionX = x + mx
+                        this.positionY = y
+                        positionZ = actor.positionZ
+                        sideLength = sizeX - mx
+                        sideHeight = sizeY + my
+                        isSelect = actor.isSelect
+                        parentLayerIndex = actor.parentLayerIndex
+                        isMoveable = actor.isMoveable
+                    }
+                    dialogue = dialogueData
+                }
+                MotionEvent.ACTION_UP -> {
+                    actor.isSelect = true
+                    actorCallback?.onActorChange(dialogue)
+                }
+            }
+            return@OnTouchListener true
+        }
+    }
 }

+ 5 - 6
src/main/java/com/bomostory/sceneeditmodule/screen/view/EditActorView.kt

@@ -22,7 +22,7 @@ open class EditActorView @JvmOverloads constructor(
     init {
         initView()
     }
-    var actor = Actor()
+    open var actor = Actor()
         set(value) {
             value?.let {
                 field = value
@@ -98,7 +98,7 @@ open class EditActorView @JvmOverloads constructor(
         }
     }
 
-    private fun rightBottomSizeChangeListener() : View.OnTouchListener {
+    open fun rightBottomSizeChangeListener() : View.OnTouchListener {
         var positionX = 0
         var positionY = 0
         var sizeX = 0
@@ -139,7 +139,7 @@ open class EditActorView @JvmOverloads constructor(
         }
     }
 
-    private fun leftTopSizeChangeListener() : View.OnTouchListener {
+    open fun leftTopSizeChangeListener() : View.OnTouchListener {
         var positionX = 0
         var positionY = 0
         var sizeX = 0
@@ -180,7 +180,7 @@ open class EditActorView @JvmOverloads constructor(
         }
     }
 
-    private fun rightTopSizeChangeListener() : View.OnTouchListener {
+    open fun rightTopSizeChangeListener() : View.OnTouchListener {
         var positionX = 0
         var positionY = 0
         var sizeX = 0
@@ -221,7 +221,7 @@ open class EditActorView @JvmOverloads constructor(
         }
     }
 
-    private fun leftBottomSizeChangeListener() : View.OnTouchListener {
+    open fun leftBottomSizeChangeListener() : View.OnTouchListener {
         var positionX = 0
         var positionY = 0
         var sizeX = 0
@@ -247,7 +247,6 @@ open class EditActorView @JvmOverloads constructor(
                     actorData.sideHeight = sizeY + my
                     actorData.positionX = x + mx
                     actorData.positionY = y
-                    actor = actorData
                 }
                 MotionEvent.ACTION_UP -> {
                     actor.isSelect = true

+ 1 - 0
src/main/java/com/bomostory/sceneeditmodule/screen/view/LayerView.kt

@@ -37,6 +37,7 @@ class LayerView : RelativeLayout {
                     val layoutParams = RelativeLayout.LayoutParams(actor.sideLength, actor.sideLength)
                     layoutParams.leftMargin = actor.positionX
                     layoutParams.topMargin = actor.positionY
+                    dialogueView.dialogue = actor
                     dialogueView.actor = actor
                 } else if (actor is Actor) {
                     var actorView = EditActorView(context)

+ 2 - 2
src/main/res/layout/activity_scene_edit.xml

@@ -24,8 +24,8 @@
 
      <com.bomostory.sceneeditmodule.screen.view.SceneView1
         android:id="@+id/sceneEditView"
-        android:layout_width="1024dp"
-        android:layout_height="512dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         android:background="@android:color/holo_blue_dark"
         app:layout_constraintTop_toBottomOf="@+id/bar"/>
 

+ 0 - 2
src/main/res/layout/actor_item.xml

@@ -4,11 +4,9 @@
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:orientation="vertical">
-
         <ImageView
             android:id="@+id/actor_image"
             android:scaleType="centerCrop"
             android:layout_width="96dp"
             android:layout_height="96dp"/>
-
 </LinearLayout>

+ 1 - 1
src/main/res/layout/actor_select_view.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="1024dp"
+    android:layout_width="match_parent"
     android:layout_height="200dp"
     android:orientation="vertical"
     android:layout_above="@+id/navigation_bar"

+ 1 - 1
src/main/res/layout/dialogue_select_view.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="1024dp"
+    android:layout_width="match_parent"
     android:layout_height="160dp"
     android:orientation="vertical"
     android:layout_above="@+id/navigation_bar"

+ 3 - 0
src/main/res/values/dimens.xml

@@ -3,4 +3,7 @@
     <dimen name="horizontal_item_spacing">8dp</dimen>
     <dimen name="movie_width">720dp</dimen>
     <dimen name="movie_height">360dp</dimen>
+    <dimen name="actor_height">120dp</dimen>
+    <dimen name="actor_width">120dp</dimen>
+    <dimen name="edit_actor_padding">24dp</dimen>
 </resources>