|
@@ -11,7 +11,6 @@ import android.graphics.drawable.Drawable
|
|
|
import android.support.v7.widget.RecyclerView
|
|
|
import android.view.*
|
|
|
import android.widget.PopupWindow
|
|
|
-import com.bomostory.sceneeditmodule.MovieEditActivity
|
|
|
import com.example.tfat.myapplication.navigationbar.NavigationBarView
|
|
|
import com.example.tfat.myapplication.navigationbar.actor.ActorAdapter
|
|
|
import com.example.tfat.myapplication.navigationbar.scene.AddSceneAdapter
|
|
@@ -25,12 +24,14 @@ import com.bomostory.sceneeditmodule.basicdata.*
|
|
|
import com.bomostory.sceneeditmodule.navigationbar.dialogue.DialogueView
|
|
|
import com.bomostory.sceneeditmodule.view.EditActorView
|
|
|
import com.bomostory.sceneeditmodule.view.OnTouchBoMoSceneListener
|
|
|
-import com.example.tfat.myapplication.navigationbar.RecordFinishView
|
|
|
import com.example.tfat.myapplication.navigationbar.actor.LayerManagementDialog
|
|
|
import kotlinx.android.synthetic.main.control_actor_dialog.view.*
|
|
|
import com.bomostory.sceneeditmodule.utils.FileUtils
|
|
|
import com.bomostory.sceneeditmodule.view.LayerView
|
|
|
import android.util.DisplayMetrics
|
|
|
+import com.bomostory.sceneeditmodule.MovieEditActivity
|
|
|
+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 java.util.concurrent.CopyOnWriteArrayList
|
|
@@ -146,6 +147,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ //TFAT
|
|
|
private fun initNavigationBarView() {
|
|
|
project.story?.let {
|
|
|
it.scenes?.let {
|
|
@@ -169,43 +171,66 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
})
|
|
|
} else {
|
|
|
navigationBar.removeAllViews()
|
|
|
- var recordFinishView = RecordFinishView(this)
|
|
|
- recordFinishView.setOnNextSceneClickListener(View.OnClickListener {
|
|
|
- currentSceneIndex++
|
|
|
+ var editSceneView = EditSceneView(this)
|
|
|
+ navigationBar.addView(editSceneView)
|
|
|
+ setControlSceneView()
|
|
|
+ editSceneView.setOnClickDoneListener(View.OnClickListener {
|
|
|
+ val pd = ProgressDialog(this).apply {
|
|
|
+ setCancelable(false)
|
|
|
+ }
|
|
|
+ FileUtils.saveProject(project, 1920,1080)
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
+ .doOnSubscribe { pd.show() }
|
|
|
+ .doFinally { pd.dismiss() }
|
|
|
+ .subscribe {
|
|
|
+ listeners.forEach {it.run()}
|
|
|
+ }
|
|
|
+ val intent = Intent(this, MovieEditActivity::class.java)
|
|
|
+ intent.putExtra(MovieEditActivity.PROJECT_KEY, Gson().toJson(project))
|
|
|
+ startActivity(intent)
|
|
|
+ })
|
|
|
+ editSceneView.setOnClickStartOverListener(View.OnClickListener {
|
|
|
project.story?.let {
|
|
|
it.scenes?.let{
|
|
|
- when(currentSceneIndex < it.size){
|
|
|
+ it[currentSceneIndex].record = null
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ initNavigationBarView()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ editSceneView.setOnClickReplaceListener(View.OnClickListener {
|
|
|
+ viewContainer.removeAllViews()
|
|
|
+ var addSceneView = AddSceneView(this)
|
|
|
+ viewContainer.addView(addSceneView)
|
|
|
+ val layoutManager = LinearLayoutManager(this)
|
|
|
+ layoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
|
+ var onSceneSelectedArrayList = ArrayList<View.OnClickListener>()
|
|
|
+ for (i in 0 until resourceThemeBitmap.size) {
|
|
|
+ onSceneSelectedArrayList.add(replaceScene(i))
|
|
|
+ }
|
|
|
+ var addSceneAdapter = AddSceneAdapter(this, resourceThemeBitmap, onSceneSelectedArrayList)
|
|
|
+ var newSceneRecyclerView = addSceneView.findViewById<RecyclerView>(R.id.new_scene_recycler_view)
|
|
|
+ newSceneRecyclerView.layoutManager = layoutManager
|
|
|
+ newSceneRecyclerView.adapter = addSceneAdapter
|
|
|
+ })
|
|
|
+ editSceneView.setOnClickDeleteListener(View.OnClickListener {
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let{
|
|
|
+ if (it.size <= 1) { return@let }
|
|
|
+ it.removeAt(currentSceneIndex)
|
|
|
+ when(currentSceneIndex >= it.size){
|
|
|
true -> {
|
|
|
- switchToPreViewLayer()
|
|
|
- sceneEditView.scene = it[currentSceneIndex]
|
|
|
- }
|
|
|
- false -> {
|
|
|
currentSceneIndex = 0
|
|
|
- sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ sceneEditView.scene = it[0]
|
|
|
}
|
|
|
+ false -> sceneEditView.scene = it[currentSceneIndex]
|
|
|
}
|
|
|
+ initNavigationBarView()
|
|
|
+ initControlSceneView()
|
|
|
}
|
|
|
}
|
|
|
- initControlBarView()
|
|
|
- initNavigationBarView()
|
|
|
- })
|
|
|
- recordFinishView.setOnFinishClickListener(View.OnClickListener {
|
|
|
- val pd = ProgressDialog(this).apply {
|
|
|
- setCancelable(false)
|
|
|
- }
|
|
|
- FileUtils.saveProject(project, 1920,1080)
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
- .doOnSubscribe { pd.show() }
|
|
|
- .doFinally { pd.dismiss() }
|
|
|
- .subscribe {
|
|
|
- listeners.forEach {it.run()}
|
|
|
- }
|
|
|
- val intent = Intent(this, MovieEditActivity::class.java)
|
|
|
- intent.putExtra(MovieEditActivity.PROJECT_KEY, Gson().toJson(project))
|
|
|
- startActivity(intent)
|
|
|
})
|
|
|
- navigationBar.addView(recordFinishView)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -246,6 +271,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
viewContainer.removeAllViews()
|
|
|
return
|
|
|
}
|
|
|
+ setControlSceneView()
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun setControlSceneView(){
|
|
|
var projectBitmaps = ArrayList<Drawable>()
|
|
|
var onSceneSelectedArrayList = ArrayList<View.OnClickListener>()
|
|
|
project.story?.let {
|
|
@@ -300,7 +329,6 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
viewContainer.removeAllViews()
|
|
|
viewContainer.addView(controlSceneView)
|
|
|
}
|
|
|
-
|
|
|
private fun initRecord(){
|
|
|
startRecord.setOnClickListener(View.OnClickListener {
|
|
|
if (!isRecord) {
|
|
@@ -320,16 +348,43 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record))
|
|
|
navigationBar.visibility = View.VISIBLE
|
|
|
initControlSceneView()
|
|
|
- initNavigationBarView()
|
|
|
+ initRecordFinishView()
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
+ private fun initRecordFinishView(){
|
|
|
+ navigationBar.removeAllViews()
|
|
|
+ var recordFinishView = RecordFinishView(this)
|
|
|
+ recordFinishView.setOnNextSceneClickListener(View.OnClickListener {
|
|
|
+ currentSceneIndex++
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let{
|
|
|
+ when(currentSceneIndex < it.size){
|
|
|
+ true -> {
|
|
|
+ switchToPreViewLayer()
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ }
|
|
|
+ false -> {
|
|
|
+ currentSceneIndex = 0
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ initControlBarView()
|
|
|
+ initNavigationBarView()
|
|
|
+ })
|
|
|
+ recordFinishView.setOnFinishClickListener(View.OnClickListener {
|
|
|
+ initNavigationBarView()
|
|
|
+ })
|
|
|
+ navigationBar.addView(recordFinishView)
|
|
|
+ }
|
|
|
private fun switchScene(position: Int): View.OnClickListener {
|
|
|
return View.OnClickListener {
|
|
|
currentSceneIndex = position
|
|
|
- switchLayer(6)
|
|
|
+ switchToPreViewLayer()
|
|
|
project.story?.let {
|
|
|
it.scenes?.let{
|
|
|
sceneEditView.scene = it[position]
|
|
@@ -425,6 +480,18 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private fun replaceScene(position: Int): View.OnClickListener {
|
|
|
+ return View.OnClickListener {
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let{
|
|
|
+ it[currentSceneIndex].backgroundPath = resourceThemeBitmap[position]
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ initControlSceneView()
|
|
|
+ initNavigationBarView()
|
|
|
+ }
|
|
|
+ }
|
|
|
private fun setActorPositionZ(actors: ArrayList<Actor>){
|
|
|
for (actor in actors) {
|
|
|
actor.positionZ = actors.indexOf(actor)
|