|
@@ -7,6 +7,7 @@ import android.content.Context
|
|
import android.content.DialogInterface
|
|
import android.content.DialogInterface
|
|
import android.content.Intent
|
|
import android.content.Intent
|
|
import android.graphics.Bitmap
|
|
import android.graphics.Bitmap
|
|
|
|
+import android.graphics.Canvas
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
import android.support.v7.app.AppCompatActivity
|
|
import android.support.v7.app.AppCompatActivity
|
|
import android.support.v7.widget.LinearLayoutManager
|
|
import android.support.v7.widget.LinearLayoutManager
|
|
@@ -26,15 +27,10 @@ import com.bomostory.sceneeditmodule.screen.view.LayerView
|
|
import com.bomostory.sceneeditmodule.screen.view.OnTouchBoMoSceneListener
|
|
import com.bomostory.sceneeditmodule.screen.view.OnTouchBoMoSceneListener
|
|
import com.bomostory.sceneeditmodule.screen.view.OnTouchSceneListener
|
|
import com.bomostory.sceneeditmodule.screen.view.OnTouchSceneListener
|
|
import com.bomostory.sceneeditmodule.utils.FileUtils
|
|
import com.bomostory.sceneeditmodule.utils.FileUtils
|
|
-import com.example.tfat.myapplication.navigationbar.EditSceneView
|
|
|
|
import com.example.tfat.myapplication.navigationbar.NavigationBarView
|
|
import com.example.tfat.myapplication.navigationbar.NavigationBarView
|
|
import com.example.tfat.myapplication.navigationbar.RecordFinishView
|
|
import com.example.tfat.myapplication.navigationbar.RecordFinishView
|
|
import com.example.tfat.myapplication.navigationbar.actor.ActorAdapter
|
|
import com.example.tfat.myapplication.navigationbar.actor.ActorAdapter
|
|
import com.example.tfat.myapplication.navigationbar.actor.LayerManagementDialog
|
|
import com.example.tfat.myapplication.navigationbar.actor.LayerManagementDialog
|
|
-import com.example.tfat.myapplication.navigationbar.scene.AddSceneAdapter
|
|
|
|
-import com.example.tfat.myapplication.navigationbar.scene.AddSceneView
|
|
|
|
-import com.example.tfat.myapplication.navigationbar.scene.ControlSceneView
|
|
|
|
-import com.example.tfat.myapplication.navigationbar.scene.SceneAdapter
|
|
|
|
import com.google.gson.Gson
|
|
import com.google.gson.Gson
|
|
import kotlinx.android.synthetic.main.activity_scene_edit.*
|
|
import kotlinx.android.synthetic.main.activity_scene_edit.*
|
|
import kotlinx.android.synthetic.main.control_actor_dialog.view.*
|
|
import kotlinx.android.synthetic.main.control_actor_dialog.view.*
|
|
@@ -44,20 +40,23 @@ import kotlinx.android.synthetic.main.popupview_opacity_dialog.view.*
|
|
import kotlinx.android.synthetic.main.view_control_dialogue_dialog.view.*
|
|
import kotlinx.android.synthetic.main.view_control_dialogue_dialog.view.*
|
|
import com.bomostory.sceneeditmodule.DialogueColorData
|
|
import com.bomostory.sceneeditmodule.DialogueColorData
|
|
import com.bomostory.sceneeditmodule.SceneDrawer
|
|
import com.bomostory.sceneeditmodule.SceneDrawer
|
|
|
|
+import com.bomostory.sceneeditmodule.cover.CoverEditorDialog
|
|
import com.bomostory.sceneeditmodule.navigationbar.actor.ObjectView
|
|
import com.bomostory.sceneeditmodule.navigationbar.actor.ObjectView
|
|
import com.bomostory.sceneeditmodule.navigationbar.actor.NonInterceptTouchRecycleView
|
|
import com.bomostory.sceneeditmodule.navigationbar.actor.NonInterceptTouchRecycleView
|
|
import com.bomostory.sceneeditmodule.screen.draw.DrawActivity
|
|
import com.bomostory.sceneeditmodule.screen.draw.DrawActivity
|
|
|
|
+import com.example.tfat.myapplication.navigationbar.scene.*
|
|
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.actor_select_view.view.*
|
|
import kotlinx.android.synthetic.main.actor_select_view.view.*
|
|
import kotlinx.android.synthetic.main.add_scene_view.view.*
|
|
import kotlinx.android.synthetic.main.add_scene_view.view.*
|
|
-import kotlinx.android.synthetic.main.fragment_music_edit_dialog.view.*
|
|
|
|
import kotlinx.android.synthetic.main.layer_management_fragment.*
|
|
import kotlinx.android.synthetic.main.layer_management_fragment.*
|
|
import kotlinx.android.synthetic.main.navigation_bar_view.view.*
|
|
import kotlinx.android.synthetic.main.navigation_bar_view.view.*
|
|
import kotlinx.android.synthetic.main.popupview_adjustment_dialog.view.*
|
|
import kotlinx.android.synthetic.main.popupview_adjustment_dialog.view.*
|
|
import kotlinx.android.synthetic.main.popupview_color_dialog.view.*
|
|
import kotlinx.android.synthetic.main.popupview_color_dialog.view.*
|
|
import kotlinx.android.synthetic.main.popupview_setting.view.*
|
|
import kotlinx.android.synthetic.main.popupview_setting.view.*
|
|
import kotlinx.android.synthetic.main.popupview_start_over.view.*
|
|
import kotlinx.android.synthetic.main.popupview_start_over.view.*
|
|
|
|
+import kotlinx.android.synthetic.main.replace_scene_view.view.*
|
|
|
|
+import kotlinx.android.synthetic.main.scene_control_view.view.*
|
|
import java.io.File
|
|
import java.io.File
|
|
import java.util.*
|
|
import java.util.*
|
|
import java.util.concurrent.CopyOnWriteArrayList
|
|
import java.util.concurrent.CopyOnWriteArrayList
|
|
@@ -67,7 +66,7 @@ import kotlin.collections.ArrayList
|
|
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, EditTextDialog.OnSetDialogFinish,
|
|
OnTouchSceneListener.OnSceneTouchListener,LayerManagementDialog.OnLayerChange, EditTextDialog.OnSetDialogFinish,
|
|
- BrushView.OnSelectBrush {
|
|
|
|
|
|
+ BrushView.OnSelectBrush, FileUtils.OnSaveCover {
|
|
|
|
|
|
private lateinit var project: Project
|
|
private lateinit var project: Project
|
|
private var currentSceneIndex = 0
|
|
private var currentSceneIndex = 0
|
|
@@ -79,6 +78,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
private var resourceThemeBitmap = ArrayList<String>()
|
|
private var resourceThemeBitmap = ArrayList<String>()
|
|
private var resourceActorBitmap = ArrayList<ArrayList<String>>()
|
|
private var resourceActorBitmap = ArrayList<ArrayList<String>>()
|
|
private var resourceObjectPath = ArrayList<String>()
|
|
private var resourceObjectPath = ArrayList<String>()
|
|
|
|
+ private var themeName = ""
|
|
private lateinit var sceneAdapter: SceneAdapter
|
|
private lateinit var sceneAdapter: SceneAdapter
|
|
private var isRecord = false
|
|
private var isRecord = false
|
|
private var isAutoSwipe = false
|
|
private var isAutoSwipe = false
|
|
@@ -122,7 +122,18 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
for (i in 0 until it.size) {
|
|
for (i in 0 until it.size) {
|
|
it[i].sceneWidth = monitorSize.widthPixels
|
|
it[i].sceneWidth = monitorSize.widthPixels
|
|
}
|
|
}
|
|
- sceneEditView.scene = it[0]
|
|
|
|
|
|
+ if (project.coverFile == null) {
|
|
|
|
+ val bitmap = CoverDrawer.drawFrontCover((monitorSize.widthPixels) / 2, monitorSize.heightPixels, project.displayName
|
|
|
|
+ ?: "", project.author ?: "", project.frontCoverColor.getColor(this))
|
|
|
|
+ val bitmap2 = CoverDrawer.drawBackCover(this, (monitorSize.widthPixels) / 2, monitorSize.heightPixels, project.backCoverColor.getColor(this))
|
|
|
|
+ val bitmap3 = Bitmap.createBitmap(monitorSize.widthPixels, monitorSize.heightPixels, bitmap.config)
|
|
|
|
+ val canvas = Canvas(bitmap3)
|
|
|
|
+ canvas.drawBitmap(bitmap, 0f, 0f, null)
|
|
|
|
+ canvas.drawBitmap(bitmap2, ((monitorSize.widthPixels) / 2).toFloat(), 0f, null)
|
|
|
|
+ FileUtils.saveCover(this, project, bitmap3, project.name.toString())
|
|
|
|
+ } else {
|
|
|
|
+ sceneEditView.scene = it[0]
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ic_scene_edit_activity_back.setOnClickListener {
|
|
ic_scene_edit_activity_back.setOnClickListener {
|
|
@@ -135,6 +146,15 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
.doOnSubscribe { pd.show() }
|
|
.doOnSubscribe { pd.show() }
|
|
.doFinally {
|
|
.doFinally {
|
|
pd.dismiss()
|
|
pd.dismiss()
|
|
|
|
+ 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)
|
|
|
|
+ }
|
|
this.onBackPressed()}
|
|
this.onBackPressed()}
|
|
.subscribe {
|
|
.subscribe {
|
|
listeners.forEach {it.run()}
|
|
listeners.forEach {it.run()}
|
|
@@ -215,13 +235,14 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
else -> { intent.getStringArrayListExtra("resource_object")}
|
|
else -> { intent.getStringArrayListExtra("resource_object")}
|
|
}
|
|
}
|
|
|
|
+ themeName = project.themeAssetIndex.name
|
|
}
|
|
}
|
|
private fun initControlBarView() {
|
|
private fun initControlBarView() {
|
|
controlBarView.setBtnSelected(6)
|
|
controlBarView.setBtnSelected(6)
|
|
switchToPreViewLayer()
|
|
switchToPreViewLayer()
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|
|
- if (it[currentSceneIndex].record != null) {
|
|
|
|
|
|
+ if (it[currentSceneIndex].record != null || currentSceneIndex == 0) {
|
|
controlBarView.visibility = View.INVISIBLE
|
|
controlBarView.visibility = View.INVISIBLE
|
|
sceneEditView.setOnTouchListener(null)
|
|
sceneEditView.setOnTouchListener(null)
|
|
} else {
|
|
} else {
|
|
@@ -268,49 +289,80 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
var navigationBarView = NavigationBarView(this)
|
|
var navigationBarView = NavigationBarView(this)
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|
|
- when (it[currentSceneIndex].record) {
|
|
|
|
- null -> {
|
|
|
|
- startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record))
|
|
|
|
- navigationBarView.setBtnEnable()
|
|
|
|
- navigationBar.addView(navigationBarView)
|
|
|
|
- navigationBarView.setonClickSceneBtn(View.OnClickListener {
|
|
|
|
- initControlSceneView()
|
|
|
|
- })
|
|
|
|
- navigationBarView.setonClickActorBtn(View.OnClickListener {
|
|
|
|
- initActorRecyclerView()
|
|
|
|
- })
|
|
|
|
- navigationBarView.setonClickBrushBtn(View.OnClickListener {
|
|
|
|
- initBrushView()
|
|
|
|
- })
|
|
|
|
- navigationBarView.setonClickDialogueBtn(View.OnClickListener {
|
|
|
|
- initDialogueView()
|
|
|
|
- })
|
|
|
|
- navigationBarView.setonClickImageBtn(View.OnClickListener {
|
|
|
|
- pickFromGallery()
|
|
|
|
- })
|
|
|
|
- navigationBarView.setonClickSettingBtn(View.OnClickListener {
|
|
|
|
- var popupWindow = PopupWindow(this)
|
|
|
|
- popupWindow.contentView = createSettingPopupView()
|
|
|
|
- popupWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
- popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
- popupWindow.isOutsideTouchable = true
|
|
|
|
- var valueXInPixels = resources.getDimension(R.dimen.popup_view_setting_height) + resources.getDimension(R.dimen.navigation_bar_height)
|
|
|
|
- popupWindow.showAsDropDown(navigationBarView.settings, 0, -(valueXInPixels).toInt(), Gravity.CENTER_HORIZONTAL)
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
|
|
+ if(currentSceneIndex == 0){
|
|
|
|
+ when (it[currentSceneIndex].record) {
|
|
|
|
+ null -> {
|
|
|
|
+ startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record))
|
|
|
|
+ navigationBarView . setBtnDisable ()
|
|
|
|
+ navigationBar . addView (navigationBarView)
|
|
|
|
+ navigationBarView . setonClickSceneBtn (View.OnClickListener {
|
|
|
|
+ initControlSceneView()
|
|
|
|
+ })
|
|
|
|
+ navigationBarView . setonClickActorBtn (View.OnClickListener {})
|
|
|
|
+ navigationBarView . setonClickBrushBtn (View.OnClickListener {})
|
|
|
|
+ navigationBarView . setonClickDialogueBtn (View.OnClickListener {})
|
|
|
|
+ navigationBarView . setonClickImageBtn (View.OnClickListener {})
|
|
|
|
+ navigationBarView . setonClickSettingBtn (View.OnClickListener {})
|
|
|
|
+ }
|
|
|
|
+ else -> {
|
|
|
|
+ startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_startover))
|
|
|
|
+ navigationBarView . setBtnDisable ()
|
|
|
|
+ navigationBar . addView (navigationBarView)
|
|
|
|
+ navigationBarView . setonClickSceneBtn (View.OnClickListener {
|
|
|
|
+ initControlSceneView()
|
|
|
|
+ })
|
|
|
|
+ navigationBarView . setonClickActorBtn (View.OnClickListener {})
|
|
|
|
+ navigationBarView . setonClickBrushBtn (View.OnClickListener {})
|
|
|
|
+ navigationBarView . setonClickDialogueBtn (View.OnClickListener {})
|
|
|
|
+ navigationBarView . setonClickImageBtn (View.OnClickListener {})
|
|
|
|
+ navigationBarView . setonClickSettingBtn (View.OnClickListener {})
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- else -> {
|
|
|
|
- startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_startover))
|
|
|
|
- navigationBarView.setBtnDisable()
|
|
|
|
- navigationBar.addView(navigationBarView)
|
|
|
|
- navigationBarView.setonClickSceneBtn(View.OnClickListener {
|
|
|
|
- initControlSceneView()
|
|
|
|
- })
|
|
|
|
- navigationBarView.setonClickActorBtn(View.OnClickListener {})
|
|
|
|
- navigationBarView.setonClickBrushBtn(View.OnClickListener {})
|
|
|
|
- navigationBarView.setonClickDialogueBtn(View.OnClickListener {})
|
|
|
|
- navigationBarView.setonClickImageBtn(View.OnClickListener {})
|
|
|
|
- navigationBarView.setonClickSettingBtn(View.OnClickListener {})
|
|
|
|
|
|
+ } else {
|
|
|
|
+ when (it[currentSceneIndex].record) {
|
|
|
|
+ null -> {
|
|
|
|
+ startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record))
|
|
|
|
+ navigationBarView.setBtnEnable()
|
|
|
|
+ navigationBar.addView(navigationBarView)
|
|
|
|
+ navigationBarView.setonClickSceneBtn(View.OnClickListener {
|
|
|
|
+ initControlSceneView()
|
|
|
|
+ })
|
|
|
|
+ navigationBarView.setonClickActorBtn(View.OnClickListener {
|
|
|
|
+ initActorRecyclerView()
|
|
|
|
+ })
|
|
|
|
+ navigationBarView.setonClickBrushBtn(View.OnClickListener {
|
|
|
|
+ initBrushView()
|
|
|
|
+ })
|
|
|
|
+ navigationBarView.setonClickDialogueBtn(View.OnClickListener {
|
|
|
|
+ initDialogueView()
|
|
|
|
+ })
|
|
|
|
+ navigationBarView.setonClickImageBtn(View.OnClickListener {
|
|
|
|
+ pickFromGallery()
|
|
|
|
+ })
|
|
|
|
+ navigationBarView.setonClickSettingBtn(View.OnClickListener {
|
|
|
|
+ var popupWindow = PopupWindow(this)
|
|
|
|
+ popupWindow.contentView = createSettingPopupView()
|
|
|
|
+ popupWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
+ popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
+ popupWindow.isOutsideTouchable = true
|
|
|
|
+ var valueXInPixels = resources.getDimension(R.dimen.popup_view_setting_height) + resources.getDimension(R.dimen.navigation_bar_height)
|
|
|
|
+ popupWindow.showAsDropDown(navigationBarView.settings, 0, -(valueXInPixels).toInt(), Gravity.CENTER_HORIZONTAL)
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ else -> {
|
|
|
|
+ startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_startover))
|
|
|
|
+ navigationBarView.setBtnDisable()
|
|
|
|
+ navigationBar.addView(navigationBarView)
|
|
|
|
+ navigationBarView.setonClickSceneBtn(View.OnClickListener {
|
|
|
|
+ initControlSceneView()
|
|
|
|
+ })
|
|
|
|
+ navigationBarView.setonClickActorBtn(View.OnClickListener {})
|
|
|
|
+ navigationBarView.setonClickBrushBtn(View.OnClickListener {})
|
|
|
|
+ navigationBarView.setonClickDialogueBtn(View.OnClickListener {})
|
|
|
|
+ navigationBarView.setonClickImageBtn(View.OnClickListener {})
|
|
|
|
+ navigationBarView.setonClickSettingBtn(View.OnClickListener {})
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -412,6 +464,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
selectActorView.btn_scene.setOnClickListener {
|
|
selectActorView.btn_scene.setOnClickListener {
|
|
initReplaceSceneView()
|
|
initReplaceSceneView()
|
|
}
|
|
}
|
|
|
|
+ selectActorView.btn_choose_theme.text = themeName
|
|
selectActorView.btn_choose_theme.setOnClickListener {
|
|
selectActorView.btn_choose_theme.setOnClickListener {
|
|
chooseTheme()
|
|
chooseTheme()
|
|
}
|
|
}
|
|
@@ -462,80 +515,90 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
var controlSceneView = ControlSceneView(this)
|
|
var controlSceneView = ControlSceneView(this)
|
|
controlSceneView.setonClickAddBtn(View.OnClickListener {
|
|
controlSceneView.setonClickAddBtn(View.OnClickListener {
|
|
viewContainer.removeAllViews()
|
|
viewContainer.removeAllViews()
|
|
- var addSceneView = AddSceneView(this)
|
|
|
|
- viewContainer.addView(addSceneView)
|
|
|
|
|
|
+ var replaceSceneView = ReplaceSceneView(this)
|
|
|
|
+ viewContainer.addView(replaceSceneView)
|
|
val layoutManager = LinearLayoutManager(this)
|
|
val layoutManager = LinearLayoutManager(this)
|
|
layoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
layoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
var onSceneSelectedArrayList = ArrayList<View.OnClickListener>()
|
|
var onSceneSelectedArrayList = ArrayList<View.OnClickListener>()
|
|
for (i in 0 until resourceThemeBitmap.size) {
|
|
for (i in 0 until resourceThemeBitmap.size) {
|
|
onSceneSelectedArrayList.add(onClickAddSceneListener(i))
|
|
onSceneSelectedArrayList.add(onClickAddSceneListener(i))
|
|
}
|
|
}
|
|
- var addSceneAdapter = AddSceneAdapter(this, resourceThemeBitmap, onSceneSelectedArrayList)
|
|
|
|
- var newSceneRecyclerView = addSceneView.findViewById<RecyclerView>(R.id.new_scene_recycler_view)
|
|
|
|
|
|
+ var replaceSceneAdapter = ReplaceSceneAdapter(this, resourceThemeBitmap, onSceneSelectedArrayList)
|
|
|
|
+ var newSceneRecyclerView = replaceSceneView.findViewById<RecyclerView>(R.id.new_scene_recycler_view)
|
|
newSceneRecyclerView.layoutManager = layoutManager
|
|
newSceneRecyclerView.layoutManager = layoutManager
|
|
- newSceneRecyclerView.adapter = addSceneAdapter
|
|
|
|
- addSceneView.btn_add_scene_view_choose_theme.setOnClickListener {
|
|
|
|
|
|
+ newSceneRecyclerView.adapter = replaceSceneAdapter
|
|
|
|
+ replaceSceneView.btn_add_scene_view_choose_theme.text = themeName
|
|
|
|
+ replaceSceneView.btn_add_scene_view_choose_theme.setOnClickListener {
|
|
chooseTheme()
|
|
chooseTheme()
|
|
}
|
|
}
|
|
- addSceneView.btn_add_scene_view_character.setOnClickListener {
|
|
|
|
- viewContainer.removeAllViews()
|
|
|
|
- initActorRecyclerView()
|
|
|
|
- }
|
|
|
|
})
|
|
})
|
|
- controlSceneView.setonClickDuplicateBtn(View.OnClickListener {
|
|
|
|
- project.story?.let {
|
|
|
|
- it.scenes?.let {
|
|
|
|
- var scene = Scene().apply {
|
|
|
|
- backgroundName = it[currentSceneIndex].backgroundName
|
|
|
|
- backgroundPath = it[currentSceneIndex].backgroundPath
|
|
|
|
- record = it[currentSceneIndex].record
|
|
|
|
- sceneWidth = it[currentSceneIndex].sceneWidth
|
|
|
|
- recordPath = it[currentSceneIndex].recordPath
|
|
|
|
- for (layer in it[currentSceneIndex].layers) {
|
|
|
|
- var newLayer = Layer()
|
|
|
|
- newLayer.id = layer.id
|
|
|
|
- newLayer.name = layer.name
|
|
|
|
- for(actor in layer.actors) {
|
|
|
|
- var newActor = Actor()
|
|
|
|
- newActor.resourcePath = actor.resourcePath
|
|
|
|
- newActor.positionX = actor.positionX
|
|
|
|
- newActor.positionY = actor.positionY
|
|
|
|
- newActor.positionZ = actor.positionZ
|
|
|
|
- newActor.sideLength = actor.sideLength
|
|
|
|
- newActor.sideHeight = actor.sideHeight
|
|
|
|
- newActor.isSelect = actor.isSelect
|
|
|
|
- newActor.parentLayerIndex = actor.parentLayerIndex
|
|
|
|
- newActor.isMovable = actor.isMovable
|
|
|
|
- newActor.text = actor.text
|
|
|
|
- newActor.textColor = actor.textColor
|
|
|
|
- newActor.textAlign = actor.textAlign
|
|
|
|
- newActor.isDialogue = actor.isDialogue
|
|
|
|
- newActor.isMirror = actor.isMirror
|
|
|
|
- newActor.opacity = actor.opacity
|
|
|
|
- newActor.dialogColor = actor.dialogColor
|
|
|
|
- newActor.dialogType = actor.dialogType
|
|
|
|
- newLayer.actors.add(newActor)
|
|
|
|
|
|
+ when (currentSceneIndex) {
|
|
|
|
+ 0 -> {
|
|
|
|
+ controlSceneView.btn_controlSceneView_duplicate.text = resources.getString(R.string.uikit_home_edit_cover)
|
|
|
|
+ controlSceneView.setonClickDuplicateBtn(View.OnClickListener {
|
|
|
|
+ onClickEditCover(project)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ else -> {
|
|
|
|
+ controlSceneView.btn_controlSceneView_duplicate.text = resources.getString(R.string.uikit_edit_duplicate)
|
|
|
|
+ controlSceneView.setonClickDuplicateBtn(View.OnClickListener {
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ var scene = Scene().apply {
|
|
|
|
+ backgroundName = it[currentSceneIndex].backgroundName
|
|
|
|
+ backgroundPath = it[currentSceneIndex].backgroundPath
|
|
|
|
+ record = it[currentSceneIndex].record
|
|
|
|
+ sceneWidth = it[currentSceneIndex].sceneWidth
|
|
|
|
+ recordPath = it[currentSceneIndex].recordPath
|
|
|
|
+ for (layer in it[currentSceneIndex].layers) {
|
|
|
|
+ var newLayer = Layer()
|
|
|
|
+ newLayer.id = layer.id
|
|
|
|
+ newLayer.name = layer.name
|
|
|
|
+ for(actor in layer.actors) {
|
|
|
|
+ var newActor = Actor()
|
|
|
|
+ newActor.resourcePath = actor.resourcePath
|
|
|
|
+ newActor.positionX = actor.positionX
|
|
|
|
+ newActor.positionY = actor.positionY
|
|
|
|
+ newActor.positionZ = actor.positionZ
|
|
|
|
+ newActor.sideLength = actor.sideLength
|
|
|
|
+ newActor.sideHeight = actor.sideHeight
|
|
|
|
+ newActor.isSelect = actor.isSelect
|
|
|
|
+ newActor.parentLayerIndex = actor.parentLayerIndex
|
|
|
|
+ newActor.isMovable = actor.isMovable
|
|
|
|
+ newActor.text = actor.text
|
|
|
|
+ newActor.textColor = actor.textColor
|
|
|
|
+ newActor.textAlign = actor.textAlign
|
|
|
|
+ newActor.isDialogue = actor.isDialogue
|
|
|
|
+ newActor.isMirror = actor.isMirror
|
|
|
|
+ newActor.opacity = actor.opacity
|
|
|
|
+ newActor.dialogColor = actor.dialogColor
|
|
|
|
+ newActor.dialogType = actor.dialogType
|
|
|
|
+ newLayer.actors.add(newActor)
|
|
|
|
+ }
|
|
|
|
+ layers.add(newLayer)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- layers.add(newLayer)
|
|
|
|
|
|
+ it.add(currentSceneIndex + 1, scene)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- it.add(currentSceneIndex + 1, scene)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- var sceneAdapter = controlSceneView.findViewById<RecyclerView>(R.id.scene_recycler_view).adapter as SceneAdapter
|
|
|
|
- var projectBitmaps = ArrayList<Bitmap?>()
|
|
|
|
- var onSceneSelectedArrayList = ArrayList<View.OnClickListener>()
|
|
|
|
- project.story?.let {
|
|
|
|
- it.scenes?.let{
|
|
|
|
- for (i in 0 until it.size) {
|
|
|
|
- onSceneSelectedArrayList.add(switchScene(i))
|
|
|
|
- projectBitmaps.add(SceneDrawer.drawScene(this,it[i],0,200,100))
|
|
|
|
- recordTimeArrayList.add(it[i].record?.period)
|
|
|
|
|
|
+ var sceneAdapter = controlSceneView.findViewById<RecyclerView>(R.id.scene_recycler_view).adapter as SceneAdapter
|
|
|
|
+ var projectBitmaps = ArrayList<Bitmap?>()
|
|
|
|
+ var onSceneSelectedArrayList = ArrayList<View.OnClickListener>()
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let{
|
|
|
|
+ for (i in 0 until it.size) {
|
|
|
|
+ onSceneSelectedArrayList.add(switchScene(i))
|
|
|
|
+ projectBitmaps.add(SceneDrawer.drawScene(this,it[i],0,200,100))
|
|
|
|
+ recordTimeArrayList.add(it[i].record?.period)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ sceneAdapter.update(projectBitmaps, onSceneSelectedArrayList,recordTimeArrayList)
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- sceneAdapter.update(projectBitmaps, onSceneSelectedArrayList,recordTimeArrayList)
|
|
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
controlSceneView.setOnClickDeleteBtn(View.OnClickListener {
|
|
controlSceneView.setOnClickDeleteBtn(View.OnClickListener {
|
|
var builder = AlertDialog.Builder(this@SceneEditActivity).apply {
|
|
var builder = AlertDialog.Builder(this@SceneEditActivity).apply {
|
|
setTitle(resources.getString(R.string.delete_check))
|
|
setTitle(resources.getString(R.string.delete_check))
|
|
@@ -809,6 +872,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
addSceneView.btn_add_scene_view_object.setOnClickListener {
|
|
addSceneView.btn_add_scene_view_object.setOnClickListener {
|
|
initAddObjectView()
|
|
initAddObjectView()
|
|
}
|
|
}
|
|
|
|
+ addSceneView.btn_replace_scene_view_choose_theme.text = themeName
|
|
|
|
+ addSceneView.btn_replace_scene_view_choose_theme.setOnClickListener {
|
|
|
|
+ chooseTheme()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private fun initAddObjectView(){
|
|
private fun initAddObjectView(){
|
|
@@ -825,6 +892,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
objectView.btn_scene.setOnClickListener {
|
|
objectView.btn_scene.setOnClickListener {
|
|
initReplaceSceneView()
|
|
initReplaceSceneView()
|
|
}
|
|
}
|
|
|
|
+ objectView.btn_choose_theme.text = themeName
|
|
|
|
+ objectView.btn_choose_theme.setOnClickListener {
|
|
|
|
+ chooseTheme()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
private fun switchScene(position: Int): View.OnClickListener {
|
|
private fun switchScene(position: Int): View.OnClickListener {
|
|
return View.OnClickListener {
|
|
return View.OnClickListener {
|
|
@@ -955,6 +1026,25 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private fun addCoverScene(coverPath: String){
|
|
|
|
+ if (!project.isAddCoverScene) {
|
|
|
|
+ var scene = Scene()
|
|
|
|
+ for (i in 5 until 0) {
|
|
|
|
+ val layer = Layer()
|
|
|
|
+ layer.id = i
|
|
|
|
+ scene.layers.add(layer)
|
|
|
|
+ }
|
|
|
|
+ scene.backgroundPath = coverPath
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ scene.sceneWidth = monitorSize.widthPixels
|
|
|
|
+ it.add(0, scene)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ project.isAddCoverScene = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private fun replaceScene(position: Int): View.OnClickListener {
|
|
private fun replaceScene(position: Int): View.OnClickListener {
|
|
return View.OnClickListener {
|
|
return View.OnClickListener {
|
|
project.story?.let {
|
|
project.story?.let {
|
|
@@ -1554,6 +1644,15 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
addActor(ACTOR_INIT_POSITION_X, ACTOR_INIT_POSITION_Y, filePath)
|
|
addActor(ACTOR_INIT_POSITION_X, ACTOR_INIT_POSITION_Y, filePath)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ override fun onSaveCoverImage(filePath: String) {
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ addCoverScene(filePath)
|
|
|
|
+ sceneEditView.scene = it[0]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
override fun onLayerChange(layerFrom: Int, layerTo: Int, position: Int){
|
|
override fun onLayerChange(layerFrom: Int, layerTo: Int, position: Int){
|
|
project.story?.let {
|
|
project.story?.let {
|
|
it.scenes?.let {
|
|
it.scenes?.let {
|
|
@@ -1766,4 +1865,83 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private fun onClickEditCover(project: Project) {
|
|
|
|
+ val dialog = CoverEditorDialog()
|
|
|
|
+ dialog.project = project
|
|
|
|
+ dialog.onViewCreated = Runnable {
|
|
|
|
+ dialog.apply {
|
|
|
|
+ val oldName = project.name ?: ""
|
|
|
|
+ onSave = View.OnClickListener { it ->
|
|
|
|
+ if (project.name == "") {
|
|
|
|
+ showEmptyProjectNameMsg()
|
|
|
|
+ } else if (project.name != oldName) {
|
|
|
|
+ showDuplicatedProjectNameMsg()
|
|
|
|
+ } else {
|
|
|
|
+ if (coverFile == null) {
|
|
|
|
+ project.coverFile = null
|
|
|
|
+ } else {
|
|
|
|
+ project.coverFile = coverFile
|
|
|
|
+ }
|
|
|
|
+ //project.name = storyName
|
|
|
|
+ //project.displayName = storyName
|
|
|
|
+ project.author = author
|
|
|
|
+ project.frontCoverColor = frontCoverColor
|
|
|
|
+ project.backCoverColor = backCoverColor
|
|
|
|
+ project.category = category
|
|
|
|
+ FileUtils.saveProject(this@SceneEditActivity, project, 1920,1080)
|
|
|
|
+ project.story?.let {
|
|
|
|
+ it.scenes?.let {
|
|
|
|
+ if (project.coverFile == null) {
|
|
|
|
+ val bitmap = CoverDrawer.drawFrontCover((monitorSize.widthPixels) / 2, monitorSize.heightPixels, project.displayName
|
|
|
|
+ ?: "", project.author
|
|
|
|
+ ?: "", project.frontCoverColor.getColor(this@SceneEditActivity))
|
|
|
|
+ val bitmap2 = CoverDrawer.drawBackCover(this@SceneEditActivity, (monitorSize.widthPixels) / 2, monitorSize.heightPixels, project.backCoverColor.getColor(this@SceneEditActivity))
|
|
|
|
+ val bitmap3 = Bitmap.createBitmap(monitorSize.widthPixels, monitorSize.heightPixels, bitmap.config)
|
|
|
|
+ val canvas = Canvas(bitmap3)
|
|
|
|
+ canvas.drawBitmap(bitmap, 0f, 0f, null)
|
|
|
|
+ canvas.drawBitmap(bitmap2, ((monitorSize.widthPixels) / 2).toFloat(), 0f, null)
|
|
|
|
+ FileUtils.saveCover(this@SceneEditActivity, project, bitmap3, project.name.toString())
|
|
|
|
+ } else {
|
|
|
|
+ sceneEditView.scene = it[0]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ initControlSceneView()
|
|
|
|
+ this.dismiss()
|
|
|
|
+ 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)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ onCancel = View.OnClickListener {
|
|
|
|
+ this.dismiss()
|
|
|
|
+ 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)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ coverFile = project.coverFile
|
|
|
|
+ storyName = project.displayName ?: ""
|
|
|
|
+ author = project.author ?: ""
|
|
|
|
+ category = project.category
|
|
|
|
+ if (project.coverFile == null) {
|
|
|
|
+ frontCoverColor = project.frontCoverColor
|
|
|
|
+ }
|
|
|
|
+ backCoverColor = project.backCoverColor
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ dialog.show(supportFragmentManager)
|
|
|
|
+ }
|
|
}
|
|
}
|