|
@@ -29,6 +29,7 @@ import kotlinx.android.synthetic.main.control_actor_dialog.view.*
|
|
import com.bomostory.sceneeditmodule.utils.FileUtils
|
|
import com.bomostory.sceneeditmodule.utils.FileUtils
|
|
import com.bomostory.sceneeditmodule.screen.view.LayerView
|
|
import com.bomostory.sceneeditmodule.screen.view.LayerView
|
|
import android.util.DisplayMetrics
|
|
import android.util.DisplayMetrics
|
|
|
|
+import com.bomostory.sceneeditmodule.EditTextDialog
|
|
import com.bomostory.sceneeditmodule.screen.movie.MovieEditActivity
|
|
import com.bomostory.sceneeditmodule.screen.movie.MovieEditActivity
|
|
import com.bomostory.sceneeditmodule.screen.view.OnTouchSceneListener
|
|
import com.bomostory.sceneeditmodule.screen.view.OnTouchSceneListener
|
|
import com.example.tfat.myapplication.navigationbar.EditSceneView
|
|
import com.example.tfat.myapplication.navigationbar.EditSceneView
|
|
@@ -36,11 +37,12 @@ import com.example.tfat.myapplication.navigationbar.RecordFinishView
|
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
|
import io.reactivex.schedulers.Schedulers
|
|
import io.reactivex.schedulers.Schedulers
|
|
import kotlinx.android.synthetic.main.layer_management_fragment.*
|
|
import kotlinx.android.synthetic.main.layer_management_fragment.*
|
|
|
|
+import kotlinx.android.synthetic.main.view_control_dialogue_dialog.view.*
|
|
import java.util.concurrent.CopyOnWriteArrayList
|
|
import java.util.concurrent.CopyOnWriteArrayList
|
|
|
|
|
|
class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener, EditActorView.OnActorChangeListener,
|
|
class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener, EditActorView.OnActorChangeListener,
|
|
OnTouchBoMoSceneListener.OnSceneMoveListener, DialogInterface.OnDismissListener, FileUtils.OnSaveActorImage,
|
|
OnTouchBoMoSceneListener.OnSceneMoveListener, DialogInterface.OnDismissListener, FileUtils.OnSaveActorImage,
|
|
- OnTouchSceneListener.OnSceneTouchListener,LayerManagementDialog.OnLayerChange {
|
|
|
|
|
|
+ OnTouchSceneListener.OnSceneTouchListener,LayerManagementDialog.OnLayerChange, EditTextDialog.OnSetDialogFinish {
|
|
|
|
|
|
private lateinit var project: Project
|
|
private lateinit var project: Project
|
|
private var currentSceneIndex = 0
|
|
private var currentSceneIndex = 0
|
|
@@ -53,6 +55,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
private lateinit var sceneAdapter: SceneAdapter
|
|
private lateinit var sceneAdapter: SceneAdapter
|
|
private var isRecord = false
|
|
private var isRecord = false
|
|
private var layerManagementDialog = LayerManagementDialog()
|
|
private var layerManagementDialog = LayerManagementDialog()
|
|
|
|
+ private var editTextDialog = EditTextDialog()
|
|
private val monitorSize = DisplayMetrics()
|
|
private val monitorSize = DisplayMetrics()
|
|
companion object {
|
|
companion object {
|
|
const val PHOTO_FROM_GALLERY = 1
|
|
const val PHOTO_FROM_GALLERY = 1
|
|
@@ -92,7 +95,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
val pd = ProgressDialog(this).apply {
|
|
val pd = ProgressDialog(this).apply {
|
|
setCancelable(false)
|
|
setCancelable(false)
|
|
}
|
|
}
|
|
- FileUtils.saveProject(project, 1920,1080)
|
|
|
|
|
|
+ FileUtils.saveProject(this, project, 1920,1080)
|
|
.subscribeOn(Schedulers.io())
|
|
.subscribeOn(Schedulers.io())
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
.doOnSubscribe { pd.show() }
|
|
.doOnSubscribe { pd.show() }
|
|
@@ -195,7 +198,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
val pd = ProgressDialog(this).apply {
|
|
val pd = ProgressDialog(this).apply {
|
|
setCancelable(false)
|
|
setCancelable(false)
|
|
}
|
|
}
|
|
- FileUtils.saveProject(project, 1920,1080)
|
|
|
|
|
|
+ FileUtils.saveProject(this, project, 1920,1080)
|
|
.subscribeOn(Schedulers.io())
|
|
.subscribeOn(Schedulers.io())
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
.doOnSubscribe { pd.show() }
|
|
.doOnSubscribe { pd.show() }
|
|
@@ -435,11 +438,11 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
when(it[currentSceneIndex].layers.indexOf(layer)) {
|
|
when(it[currentSceneIndex].layers.indexOf(layer)) {
|
|
currentLayerIndex ->
|
|
currentLayerIndex ->
|
|
for (actor in it[currentSceneIndex].layers[currentLayerIndex].actors) {
|
|
for (actor in it[currentSceneIndex].layers[currentLayerIndex].actors) {
|
|
- actor.isMoveable = true
|
|
|
|
|
|
+ actor.isMovable = true
|
|
}
|
|
}
|
|
else ->
|
|
else ->
|
|
for (actor in it[currentSceneIndex].layers[it[currentSceneIndex].layers.indexOf(layer)].actors) {
|
|
for (actor in it[currentSceneIndex].layers[it[currentSceneIndex].layers.indexOf(layer)].actors) {
|
|
- actor.isMoveable = false
|
|
|
|
|
|
+ actor.isMovable = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -463,7 +466,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|
|
for (layer in it[currentSceneIndex].layers) {
|
|
for (layer in it[currentSceneIndex].layers) {
|
|
for (actor in layer.actors) {
|
|
for (actor in layer.actors) {
|
|
- actor.isMoveable = false
|
|
|
|
|
|
+ actor.isMovable = false
|
|
actor.isSelect = false
|
|
actor.isSelect = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -549,7 +552,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
actorData.sideHeight = ACTOR_HEIGHT
|
|
actorData.sideHeight = ACTOR_HEIGHT
|
|
actorData.resourcePath = resourcePath
|
|
actorData.resourcePath = resourcePath
|
|
actorData.parentLayerIndex = currentLayerIndex
|
|
actorData.parentLayerIndex = currentLayerIndex
|
|
- actorData.isMoveable = true
|
|
|
|
|
|
+ actorData.isMovable = true
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors.add(actorData)
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors.add(actorData)
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
}
|
|
}
|
|
@@ -561,15 +564,16 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
private fun addDialogue(positionX: Int, positionY: Int, resource: Int) {
|
|
private fun addDialogue(positionX: Int, positionY: Int, resource: Int) {
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let{
|
|
it.scenes?.let{
|
|
- val dialog = Dialogue()
|
|
|
|
- dialog.resource = resource
|
|
|
|
|
|
+ val dialog = Actor()
|
|
|
|
+ dialog.resourcePath = resource.toString()
|
|
dialog.positionX = positionX
|
|
dialog.positionX = positionX
|
|
dialog.positionY = positionY
|
|
dialog.positionY = positionY
|
|
dialog.positionZ = it[currentSceneIndex].layers[currentLayerIndex].actors.size
|
|
dialog.positionZ = it[currentSceneIndex].layers[currentLayerIndex].actors.size
|
|
dialog.sideLength = DIALOGUE_WIDTH
|
|
dialog.sideLength = DIALOGUE_WIDTH
|
|
dialog.sideHeight = DIALOGUE_HEIGHT
|
|
dialog.sideHeight = DIALOGUE_HEIGHT
|
|
dialog.parentLayerIndex = currentLayerIndex
|
|
dialog.parentLayerIndex = currentLayerIndex
|
|
- dialog.isMoveable = true
|
|
|
|
|
|
+ dialog.isMovable = true
|
|
|
|
+ dialog.isDialogue = true
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors.add(dialog)
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors.add(dialog)
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
}
|
|
}
|
|
@@ -584,7 +588,6 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ] = actor
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ] = actor
|
|
- sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
sceneEditView.setLayerVisible(currentLayerIndex)
|
|
sceneEditView.setLayerVisible(currentLayerIndex)
|
|
@@ -623,6 +626,15 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
sceneEditView.setLayerVisible(currentLayerIndex)
|
|
sceneEditView.setLayerVisible(currentLayerIndex)
|
|
var popupWindow = PopupWindow(this)
|
|
var popupWindow = PopupWindow(this)
|
|
|
|
+ popupWindow.contentView = when(actor.isDialogue) { true -> createDialogPopupView(actor, popupWindow)
|
|
|
|
+ false -> createActorPopupView(actor, popupWindow)}
|
|
|
|
+ popupWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
+ popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
+ popupWindow.isOutsideTouchable = true
|
|
|
|
+ popupWindow.showAtLocation(sceneEditView, Gravity.START,actor.positionX,actor.positionY)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private fun createActorPopupView(actor: Actor, popupWindow: PopupWindow): View{
|
|
val popupView = LayoutInflater.from(this).inflate(R.layout.control_actor_dialog, null)
|
|
val popupView = LayoutInflater.from(this).inflate(R.layout.control_actor_dialog, null)
|
|
popupView.duplicate.setOnClickListener{
|
|
popupView.duplicate.setOnClickListener{
|
|
project.story?.let {
|
|
project.story?.let {
|
|
@@ -635,10 +647,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
sideHeight = actor.sideHeight
|
|
sideHeight = actor.sideHeight
|
|
resourcePath = actor.resourcePath
|
|
resourcePath = actor.resourcePath
|
|
parentLayerIndex = currentLayerIndex
|
|
parentLayerIndex = currentLayerIndex
|
|
- isMoveable = true
|
|
|
|
|
|
+ isMovable = true
|
|
}
|
|
}
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors.add(actorData)
|
|
it[currentSceneIndex].layers[currentLayerIndex].actors.add(actorData)
|
|
- setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
|
|
|
|
+ setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
popupWindow.dismiss()
|
|
popupWindow.dismiss()
|
|
}
|
|
}
|
|
@@ -675,16 +687,81 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- popupWindow.contentView = popupView
|
|
|
|
- popupWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
- popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
- popupWindow.isOutsideTouchable = true
|
|
|
|
- popupWindow.showAtLocation(sceneEditView, Gravity.START,actor.positionX,actor.positionY)
|
|
|
|
|
|
+ return popupView
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ private fun createDialogPopupView(actor: Actor, popupWindow: PopupWindow): View{
|
|
|
|
+ val popupView = LayoutInflater.from(this).inflate(R.layout.view_control_dialogue_dialog, null)
|
|
|
|
+ popupView.edit_content_dialogue.setOnClickListener{
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ editTextDialog = EditTextDialog()
|
|
|
|
+ editTextDialog.setCallBack(this)
|
|
|
|
+ editTextDialog.setDialogue(actor)
|
|
|
|
+ editTextDialog.show(supportFragmentManager,LAYER_MANAGEMENT)
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.duplicate_dialogue.setOnClickListener{
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ val actorData = Actor().apply {
|
|
|
|
+ positionX = actor.positionX + 100
|
|
|
|
+ positionY = actor.positionY + 100
|
|
|
|
+ positionZ = it[currentSceneIndex].layers[currentLayerIndex].actors.size
|
|
|
|
+ sideLength = actor.sideLength
|
|
|
|
+ sideHeight = actor.sideHeight
|
|
|
|
+ resourcePath = actor.resourcePath
|
|
|
|
+ parentLayerIndex = currentLayerIndex
|
|
|
|
+ isMovable = true
|
|
|
|
+ text = actor.text
|
|
|
|
+ textColor = actor.textColor
|
|
|
|
+ textAlign = actor.textAlign
|
|
|
|
+ isDialogue = actor.isDialogue
|
|
|
|
+ }
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.add(actorData)
|
|
|
|
+ setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.bring_to_front_dialogue.setOnClickListener{
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.remove(actor)
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.add(actor)
|
|
|
|
+ setActorPositionZ(it[currentLayerIndex].layers[currentLayerIndex].actors)
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.send_to_back_dialogue.setOnClickListener{
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.remove(actor)
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.add(0, actor)
|
|
|
|
+ setActorPositionZ(it[currentLayerIndex].layers[currentLayerIndex].actors)
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ popupView.delete_dialogue.setOnClickListener{
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.removeAt(actor.positionZ)
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ popupWindow.dismiss()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return popupView
|
|
|
|
+ }
|
|
override fun onSceneMove(dX: Int) {
|
|
override fun onSceneMove(dX: Int) {
|
|
- if ( (BACKGROUND_MOVE_RATE * 35) >= (swipeX + dX) && (swipeX + dX) > (-(BACKGROUND_MOVE_RATE * 35))) {
|
|
|
|
|
|
+ if ( (BACKGROUND_MOVE_RATE * monitorSize.widthPixels.div(BACKGROUND_MOVE_RATE * 2)) >= (swipeX + dX) && (swipeX + dX) > (-(BACKGROUND_MOVE_RATE * monitorSize.widthPixels.div(BACKGROUND_MOVE_RATE * 2)))) {
|
|
sceneEditView.x = swipeX + dX
|
|
sceneEditView.x = swipeX + dX
|
|
if (isRecord) {
|
|
if (isRecord) {
|
|
record?.tracks.let {
|
|
record?.tracks.let {
|
|
@@ -787,13 +864,12 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
|
|
|
|
override fun onLayerManagementDialog(layerNum: Int, position: Int) {
|
|
override fun onLayerManagementDialog(layerNum: Int, position: Int) {
|
|
- var actor = Actor()
|
|
|
|
|
|
+ //var actor = Actor()
|
|
val selectLayer = layerNum - 1
|
|
val selectLayer = layerNum - 1
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|
|
- actor = it[currentSceneIndex].layers[selectLayer].actors[position]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ var actor = it[currentSceneIndex].layers[selectLayer].actors[position]
|
|
|
|
+
|
|
var popupWindow = PopupWindow(this)
|
|
var popupWindow = PopupWindow(this)
|
|
val popupView = LayoutInflater.from(this).inflate(R.layout.control_actor_dialog, null)
|
|
val popupView = LayoutInflater.from(this).inflate(R.layout.control_actor_dialog, null)
|
|
popupView.duplicate.setOnClickListener{
|
|
popupView.duplicate.setOnClickListener{
|
|
@@ -807,7 +883,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
sideHeight = actor.sideHeight
|
|
sideHeight = actor.sideHeight
|
|
resourcePath = actor.resourcePath
|
|
resourcePath = actor.resourcePath
|
|
parentLayerIndex = selectLayer
|
|
parentLayerIndex = selectLayer
|
|
- isMoveable = true
|
|
|
|
|
|
+ isMovable = true
|
|
}
|
|
}
|
|
it[currentSceneIndex].layers[selectLayer].actors.add(actorData)
|
|
it[currentSceneIndex].layers[selectLayer].actors.add(actorData)
|
|
setActorPositionZ(it[currentSceneIndex].layers[selectLayer].actors)
|
|
setActorPositionZ(it[currentSceneIndex].layers[selectLayer].actors)
|
|
@@ -863,6 +939,31 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
4 -> popupWindow.showAsDropDown(layerManagementDialog.rv_layer_management_layer1, valueXInPixels.toInt() * position, 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)
|
|
5 -> popupWindow.showAsDropDown(layerManagementDialog.rv_layer_management_layer2, valueXInPixels.toInt() * position, 0)
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ override fun onSetDialogText(dialogue: Actor, content: String) {
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ dialogue.text = content
|
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[dialogue.positionZ] = dialogue
|
|
|
|
+ setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
|
+ editTextDialog.dismiss()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ override fun onEditTextDialogDismiss() {
|
|
|
|
+ window.decorView.apply {
|
|
|
|
+ systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
|
|
|
+ or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
|
|
|
+ or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
|
|
+ or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
|
|
+ or View.SYSTEM_UI_FLAG_FULLSCREEN
|
|
|
|
+ or View.SYSTEM_UI_FLAG_LOW_PROFILE
|
|
|
|
+ or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|