|
@@ -51,10 +51,13 @@ import io.reactivex.android.schedulers.AndroidSchedulers
|
|
|
import io.reactivex.schedulers.Schedulers
|
|
|
import kotlinx.android.synthetic.main.actor_select_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.navigation_bar_view.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_setting.view.*
|
|
|
+import kotlinx.android.synthetic.main.popupview_start_over.view.*
|
|
|
import java.io.File
|
|
|
import java.util.*
|
|
|
import java.util.concurrent.CopyOnWriteArrayList
|
|
@@ -79,6 +82,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
private lateinit var sceneAdapter: SceneAdapter
|
|
|
private var isRecord = false
|
|
|
private var isAutoSwipe = false
|
|
|
+ private var isClearObjects = false
|
|
|
private var layerManagementDialog = LayerManagementDialog()
|
|
|
private var editTextDialog = EditTextDialog()
|
|
|
private val monitorSize = DisplayMetrics()
|
|
@@ -257,123 +261,60 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
}
|
|
|
|
|
|
private fun initNavigationBarView(position: Int) {
|
|
|
- project.story?.let {
|
|
|
- it.scenes?.let {
|
|
|
- var isSceneRecorded = when(it[currentSceneIndex].record){
|
|
|
- null -> false
|
|
|
- else -> true
|
|
|
- }
|
|
|
- if (position != currentSceneIndex && !isSceneRecorded) {
|
|
|
- initNavigationFunction()
|
|
|
- } else {
|
|
|
- navigationBar.removeAllViews()
|
|
|
- var editSceneView = EditSceneView(this)
|
|
|
- navigationBar.addView(editSceneView)
|
|
|
- setControlSceneView()
|
|
|
- editSceneView.setOnClickDoneListener(View.OnClickListener {
|
|
|
- if (!isSceneRecorded) initNavigationFunction()
|
|
|
- else setControlSceneView()
|
|
|
- })
|
|
|
- editSceneView.setOnClickStartOverListener(View.OnClickListener {
|
|
|
- project.story?.let {
|
|
|
- it.scenes?.let{
|
|
|
- it[currentSceneIndex].record = null
|
|
|
- sceneEditView.scene = it[currentSceneIndex]
|
|
|
- initNavigationBarView(currentSceneIndex)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- 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 {
|
|
|
- var builder = AlertDialog.Builder(this@SceneEditActivity).apply {
|
|
|
- setTitle(resources.getString(R.string.delete_check))
|
|
|
- setPositiveButton(R.string.uikit_others_yes) { dialog, whichButton ->
|
|
|
- project.story?.let {
|
|
|
- it.scenes?.let{
|
|
|
- if (it.size <= 1) { return@let }
|
|
|
- it.removeAt(currentSceneIndex)
|
|
|
- when(currentSceneIndex >= it.size){
|
|
|
- true -> {
|
|
|
- currentSceneIndex = 0
|
|
|
- sceneEditView.scene = it[0]
|
|
|
- }
|
|
|
- false -> sceneEditView.scene = it[currentSceneIndex]
|
|
|
- }
|
|
|
- initNavigationBarView(currentSceneIndex)
|
|
|
- setControlSceneView()
|
|
|
- }
|
|
|
- }
|
|
|
- window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
|
|
- WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
|
|
- actionBar?.hide()
|
|
|
- supportActionBar?.hide()
|
|
|
- hideStatusBar()
|
|
|
- }
|
|
|
- setNegativeButton(R.string.uikit_others_not) { dialog, whichButton ->
|
|
|
- window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
|
|
- WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
|
|
- actionBar?.hide()
|
|
|
- supportActionBar?.hide()
|
|
|
- hideStatusBar()
|
|
|
- }
|
|
|
- setOnDismissListener {
|
|
|
- window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
|
|
- WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
|
|
- actionBar?.hide()
|
|
|
- supportActionBar?.hide()
|
|
|
- hideStatusBar()
|
|
|
- }
|
|
|
- }
|
|
|
- val dialog: AlertDialog = builder.create()
|
|
|
- dialog.show()
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ initNavigationFunction()
|
|
|
}
|
|
|
|
|
|
private fun initNavigationFunction(){
|
|
|
var navigationBarView = NavigationBarView(this)
|
|
|
- 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)
|
|
|
+ project.story?.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)
|
|
|
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ 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 {})
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private fun createSettingPopupView(): View{
|
|
@@ -403,6 +344,34 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
})
|
|
|
return popupView
|
|
|
}
|
|
|
+
|
|
|
+ private fun createStartOverPopupView(): View{
|
|
|
+ val popupView = LayoutInflater.from(this).inflate(R.layout.popupview_start_over, null)
|
|
|
+ when (isClearObjects) {
|
|
|
+ true -> {
|
|
|
+ popupView.rb_keep.isChecked = false
|
|
|
+ popupView.rb_clear_all.isChecked = true
|
|
|
+ }
|
|
|
+ false -> {
|
|
|
+ popupView.rb_keep.isChecked = true
|
|
|
+ popupView.rb_clear_all.isChecked = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ popupView.rg_start_over_settings.setOnCheckedChangeListener(object : RadioGroup.OnCheckedChangeListener{
|
|
|
+ override fun onCheckedChanged(group: RadioGroup?, checkedId: Int) {
|
|
|
+ when (checkedId) {
|
|
|
+ popupView.rb_keep.id -> {
|
|
|
+ isClearObjects = false
|
|
|
+ }
|
|
|
+ popupView.rb_clear_all.id ->{
|
|
|
+ isClearObjects = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return popupView
|
|
|
+ }
|
|
|
+
|
|
|
private fun initBrushView(){
|
|
|
if (currentLayerIndex == 6){
|
|
|
switchLayer(0)
|
|
@@ -416,7 +385,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
}
|
|
|
|
|
|
private fun initActorRecyclerView() {
|
|
|
- if (viewContainer.getChildAt(0) is SelectActorView || viewContainer.getChildAt(0) is ObjectView) {
|
|
|
+ if (viewContainer.getChildAt(0) is SelectActorView || viewContainer.getChildAt(0) is ObjectView || viewContainer.getChildAt(0) is AddSceneView) {
|
|
|
viewContainer.removeAllViews()
|
|
|
startRecord.visibility = View.VISIBLE
|
|
|
return
|
|
@@ -438,16 +407,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
viewContainer.addView(selectActorView)
|
|
|
selectActorView.layoutParams.width = monitorSize.widthPixels
|
|
|
selectActorView.btn_object.setOnClickListener {
|
|
|
- viewContainer.removeAllViews()
|
|
|
- var objectView = ObjectView(this)
|
|
|
- objectView.setData(resourceObjectPath)
|
|
|
- sceneEditView.findViewById<LayerView>(currentLayerIndex).setOnDragListener(objectDragListener())
|
|
|
- viewContainer.addView(objectView)
|
|
|
- objectView.layoutParams.width = monitorSize.widthPixels
|
|
|
- objectView.btn_character.setOnClickListener {
|
|
|
- viewContainer.removeAllViews()
|
|
|
- initActorRecyclerView()
|
|
|
- }
|
|
|
+ initAddObjectView()
|
|
|
+ }
|
|
|
+ selectActorView.btn_scene.setOnClickListener {
|
|
|
+ initReplaceSceneView()
|
|
|
}
|
|
|
selectActorView.btn_choose_theme.setOnClickListener {
|
|
|
chooseTheme()
|
|
@@ -514,6 +477,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
addSceneView.btn_add_scene_view_choose_theme.setOnClickListener {
|
|
|
chooseTheme()
|
|
|
}
|
|
|
+ addSceneView.btn_add_scene_view_character.setOnClickListener {
|
|
|
+ viewContainer.removeAllViews()
|
|
|
+ initActorRecyclerView()
|
|
|
+ }
|
|
|
})
|
|
|
controlSceneView.setonClickDuplicateBtn(View.OnClickListener {
|
|
|
project.story?.let {
|
|
@@ -569,6 +536,49 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
}
|
|
|
sceneAdapter.update(projectBitmaps, onSceneSelectedArrayList,recordTimeArrayList)
|
|
|
})
|
|
|
+ controlSceneView.setOnClickDeleteBtn(View.OnClickListener {
|
|
|
+ var builder = AlertDialog.Builder(this@SceneEditActivity).apply {
|
|
|
+ setTitle(resources.getString(R.string.delete_check))
|
|
|
+ setPositiveButton(R.string.uikit_others_yes) { dialog, whichButton ->
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let{
|
|
|
+ if (it.size <= 1) { return@let }
|
|
|
+ it.removeAt(currentSceneIndex)
|
|
|
+ when(currentSceneIndex >= it.size){
|
|
|
+ true -> {
|
|
|
+ currentSceneIndex = 0
|
|
|
+ sceneEditView.scene = it[0]
|
|
|
+ }
|
|
|
+ false -> sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ }
|
|
|
+ initNavigationBarView(currentSceneIndex)
|
|
|
+ setControlSceneView()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
|
|
+ WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
|
|
+ actionBar?.hide()
|
|
|
+ supportActionBar?.hide()
|
|
|
+ hideStatusBar()
|
|
|
+ }
|
|
|
+ setNegativeButton(R.string.uikit_others_not) { dialog, whichButton ->
|
|
|
+ window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
|
|
+ WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
|
|
+ actionBar?.hide()
|
|
|
+ supportActionBar?.hide()
|
|
|
+ hideStatusBar()
|
|
|
+ }
|
|
|
+ setOnDismissListener {
|
|
|
+ window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
|
|
+ WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
|
|
+ actionBar?.hide()
|
|
|
+ supportActionBar?.hide()
|
|
|
+ hideStatusBar()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ val dialog: AlertDialog = builder.create()
|
|
|
+ dialog.show()
|
|
|
+ })
|
|
|
val layoutManager = LinearLayoutManager(this)
|
|
|
layoutManager.orientation = LinearLayoutManager.HORIZONTAL
|
|
|
var sceneRecyclerView = controlSceneView.findViewById<RecyclerView>(R.id.scene_recycler_view)
|
|
@@ -595,7 +605,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
recordingTime = 0L
|
|
|
tv_scene_activity_record_time.text = resources.getString(R.string.uikit_edit_recording) + " 00:00"
|
|
|
isRecord = false
|
|
|
- startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record))
|
|
|
+ startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_startover))
|
|
|
navigationBar.visibility = View.VISIBLE
|
|
|
initControlBarView()
|
|
|
initControlSceneView()
|
|
@@ -609,82 +619,130 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
private fun initRecord(){
|
|
|
var recordPath: String? = null
|
|
|
startRecord.setOnClickListener {
|
|
|
- if (!isRecord) {
|
|
|
- // delete record
|
|
|
- project.story?.let {
|
|
|
- it.scenes?.let{
|
|
|
- if (it[currentSceneIndex].recordPath != null)
|
|
|
- File(it[currentSceneIndex].recordPath).delete()
|
|
|
- it[currentSceneIndex].record = null
|
|
|
- }
|
|
|
- }
|
|
|
- recordPath = getRecordFilePath()
|
|
|
- audioRecorder.prepare(File(recordPath))
|
|
|
- audioRecorder.startRecording()
|
|
|
- startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record_stop))
|
|
|
- startRecordTime = System.currentTimeMillis()
|
|
|
- isRecord = true
|
|
|
- switchToPreViewLayer()
|
|
|
- navigationBar.visibility = View.INVISIBLE
|
|
|
- tv_scene_activity_record_time.visibility = View.VISIBLE
|
|
|
- timer.schedule(object:TimerTask(){
|
|
|
- override fun run() {
|
|
|
- runOnUiThread {
|
|
|
- recordingTime ++
|
|
|
- tv_scene_activity_record_time.text = "Recording " + "0" + recordingTime.div(60).toString() + ":" +
|
|
|
- recordingTime.rem(60).div(10).toString() + recordingTime.rem(60).rem(10).toString()
|
|
|
- }
|
|
|
- }
|
|
|
- }, 1000, 1000)
|
|
|
- } else if (recordingTime >= 1){
|
|
|
- audioRecorder.stopRecording()
|
|
|
- tv_scene_activity_record_time.visibility = View.INVISIBLE
|
|
|
- timer.cancel()
|
|
|
- timer = Timer()
|
|
|
- recordingTime = 0L
|
|
|
- tv_scene_activity_record_time.text = resources.getString(R.string.uikit_edit_recording) + " 00:00"
|
|
|
- isRecord = false
|
|
|
- record.period = System.currentTimeMillis() - startRecordTime
|
|
|
- if (!isAutoSwipe){
|
|
|
- project.story?.let {
|
|
|
- it.scenes?.let{
|
|
|
- it[currentSceneIndex].record = record
|
|
|
- it[currentSceneIndex].recordPath = recordPath
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let {
|
|
|
+ if (it[currentSceneIndex].record != null) {
|
|
|
+ var popupWindow = PopupWindow(this)
|
|
|
+ var popupView = createStartOverPopupView().apply {
|
|
|
+ tv_popup_start_over_cancel.setOnClickListener {
|
|
|
+ popupWindow.dismiss()
|
|
|
+ }
|
|
|
+ tv_popup_start_over_start_over.setOnClickListener {
|
|
|
+ popupWindow.dismiss()
|
|
|
+ if (!isClearObjects) {
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let {
|
|
|
+ it[currentSceneIndex].record = null
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ initNavigationBarView(currentSceneIndex)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let {
|
|
|
+ var scene = Scene()
|
|
|
+ for (i in 5 until 0){
|
|
|
+ val layer = Layer()
|
|
|
+ layer.id = i
|
|
|
+ scene.layers.add(layer)
|
|
|
+ }
|
|
|
+ scene.backgroundPath = resourceThemeBitmap[resourceThemeBitmap.size - 1]
|
|
|
+ scene.sceneWidth = monitorSize.widthPixels
|
|
|
+ it[currentSceneIndex] = scene
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ initNavigationBarView(currentSceneIndex)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- } else {
|
|
|
- var autoSwipeRecord = Record()
|
|
|
- autoSwipeRecord.period = record.period
|
|
|
- for (i in 0 until record.period step TIME_STEP_FOR_FPS)
|
|
|
- autoSwipeRecord.tracks.apply {
|
|
|
- var track = Track().apply {
|
|
|
- when (i <= record.period.div(2)){
|
|
|
- true -> {
|
|
|
- positionX = (-monitorSize.widthPixels.div(2)) + i.div(TIME_STEP_FOR_FPS).toInt() * monitorSize.widthPixels.div(record.period.div(2 * TIME_STEP_FOR_FPS).toInt())
|
|
|
- time = i
|
|
|
+
|
|
|
+ popupWindow.contentView = popupView
|
|
|
+ popupWindow.width = resources.getDimension(R.dimen.popup_view_start_over_width).toInt()
|
|
|
+ popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
+ popupWindow.isOutsideTouchable = false
|
|
|
+ var valueYInPixels = resources.getDimension(R.dimen.popup_view_start_over_height) + resources.getDimension(R.dimen.popup_view_start_over_padding_bottom)
|
|
|
+ popupWindow.showAsDropDown(startRecord, -(popupWindow.width / 2), -(valueYInPixels).toInt(), Gravity.CENTER_HORIZONTAL)
|
|
|
+ } else {
|
|
|
+ if (!isRecord) {
|
|
|
+ // delete record
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let{
|
|
|
+ if (it[currentSceneIndex].recordPath != null)
|
|
|
+ File(it[currentSceneIndex].recordPath).delete()
|
|
|
+ it[currentSceneIndex].record = null
|
|
|
}
|
|
|
- false -> {
|
|
|
- var j = i - record.period.div(2)
|
|
|
- positionX = (monitorSize.widthPixels.div(2)) - j.div(TIME_STEP_FOR_FPS).toInt() * monitorSize.widthPixels.div(record.period.div(2 * TIME_STEP_FOR_FPS).toInt())
|
|
|
- time = i
|
|
|
+ }
|
|
|
+ recordPath = getRecordFilePath()
|
|
|
+ audioRecorder.prepare(File(recordPath))
|
|
|
+ audioRecorder.startRecording()
|
|
|
+ startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record_stop))
|
|
|
+ startRecordTime = System.currentTimeMillis()
|
|
|
+ isRecord = true
|
|
|
+ switchToPreViewLayer()
|
|
|
+ navigationBar.visibility = View.INVISIBLE
|
|
|
+ tv_scene_activity_record_time.visibility = View.VISIBLE
|
|
|
+ timer.schedule(object:TimerTask(){
|
|
|
+ override fun run() {
|
|
|
+ runOnUiThread {
|
|
|
+ recordingTime ++
|
|
|
+ tv_scene_activity_record_time.text = "Recording " + "0" + recordingTime.div(60).toString() + ":" +
|
|
|
+ recordingTime.rem(60).div(10).toString() + recordingTime.rem(60).rem(10).toString()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 1000, 1000)
|
|
|
+ } else if (recordingTime >= 1){
|
|
|
+ audioRecorder.stopRecording()
|
|
|
+ tv_scene_activity_record_time.visibility = View.INVISIBLE
|
|
|
+ timer.cancel()
|
|
|
+ timer = Timer()
|
|
|
+ recordingTime = 0L
|
|
|
+ tv_scene_activity_record_time.text = resources.getString(R.string.uikit_edit_recording) + " 00:00"
|
|
|
+ isRecord = false
|
|
|
+ record.period = System.currentTimeMillis() - startRecordTime
|
|
|
+ if (!isAutoSwipe){
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let{
|
|
|
+ it[currentSceneIndex].record = record
|
|
|
+ it[currentSceneIndex].recordPath = recordPath
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ var autoSwipeRecord = Record()
|
|
|
+ autoSwipeRecord.period = record.period
|
|
|
+ for (i in 0 until record.period step TIME_STEP_FOR_FPS)
|
|
|
+ autoSwipeRecord.tracks.apply {
|
|
|
+ var track = Track().apply {
|
|
|
+ when (i <= record.period.div(2)){
|
|
|
+ true -> {
|
|
|
+ positionX = (-monitorSize.widthPixels.div(2)) + i.div(TIME_STEP_FOR_FPS).toInt() * monitorSize.widthPixels.div(record.period.div(2 * TIME_STEP_FOR_FPS).toInt())
|
|
|
+ time = i
|
|
|
+ }
|
|
|
+ false -> {
|
|
|
+ var j = i - record.period.div(2)
|
|
|
+ positionX = (monitorSize.widthPixels.div(2)) - j.div(TIME_STEP_FOR_FPS).toInt() * monitorSize.widthPixels.div(record.period.div(2 * TIME_STEP_FOR_FPS).toInt())
|
|
|
+ time = i
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ add(track)
|
|
|
+ }
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let{
|
|
|
+ it[currentSceneIndex].record = autoSwipeRecord
|
|
|
+ it[currentSceneIndex].recordPath = recordPath
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- add(track)
|
|
|
- }
|
|
|
- project.story?.let {
|
|
|
- it.scenes?.let{
|
|
|
- it[currentSceneIndex].record = autoSwipeRecord
|
|
|
- it[currentSceneIndex].recordPath = recordPath
|
|
|
+
|
|
|
+ startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_startover))
|
|
|
+ navigationBar.visibility = View.VISIBLE
|
|
|
+ initControlBarView()
|
|
|
+ initControlSceneView()
|
|
|
+ initRecordFinishView()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- startRecord.setImageDrawable(resources.getDrawable(R.drawable.ic_btn_record))
|
|
|
- navigationBar.visibility = View.VISIBLE
|
|
|
- initControlBarView()
|
|
|
- initControlSceneView()
|
|
|
- initRecordFinishView()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -729,6 +787,45 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
})
|
|
|
navigationBar.addView(recordFinishView)
|
|
|
}
|
|
|
+
|
|
|
+ private fun initReplaceSceneView(){
|
|
|
+ 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
|
|
|
+ addSceneView.btn_add_scene_view_character.setOnClickListener {
|
|
|
+ viewContainer.removeAllViews()
|
|
|
+ initActorRecyclerView()
|
|
|
+ }
|
|
|
+ addSceneView.btn_add_scene_view_object.setOnClickListener {
|
|
|
+ initAddObjectView()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun initAddObjectView(){
|
|
|
+ viewContainer.removeAllViews()
|
|
|
+ var objectView = ObjectView(this)
|
|
|
+ objectView.setData(resourceObjectPath)
|
|
|
+ sceneEditView.findViewById<LayerView>(currentLayerIndex).setOnDragListener(objectDragListener())
|
|
|
+ viewContainer.addView(objectView)
|
|
|
+ objectView.layoutParams.width = monitorSize.widthPixels
|
|
|
+ objectView.btn_character.setOnClickListener {
|
|
|
+ viewContainer.removeAllViews()
|
|
|
+ initActorRecyclerView()
|
|
|
+ }
|
|
|
+ objectView.btn_scene.setOnClickListener {
|
|
|
+ initReplaceSceneView()
|
|
|
+ }
|
|
|
+ }
|
|
|
private fun switchScene(position: Int): View.OnClickListener {
|
|
|
return View.OnClickListener {
|
|
|
var oldSceneIndex = currentSceneIndex
|
|
@@ -866,8 +963,6 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
|
}
|
|
|
}
|
|
|
- initControlSceneView()
|
|
|
- initNavigationBarView(currentSceneIndex)
|
|
|
}
|
|
|
}
|
|
|
private fun setActorPositionZ(actors: ArrayList<Actor>){
|
|
@@ -1065,7 +1160,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
popupView.tv_opacity_dialog_opacity.text = "Opacity : " + p1.toString() + "%"
|
|
|
project.story?.let {
|
|
|
it.scenes?.let {
|
|
|
- it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].opacity = p1.toFloat().div(100)
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].opacity = p1.toFloat()
|
|
|
sceneEditView.scene = it[currentSceneIndex]
|
|
|
sceneEditView.setLayerVisible(currentLayerIndex)
|
|
|
}
|
|
@@ -1082,6 +1177,75 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
}
|
|
|
sceneEditView.setLayerVisible(currentLayerIndex)
|
|
|
}
|
|
|
+ popupView.adjustment.setOnClickListener {
|
|
|
+ popupWindow.dismiss()
|
|
|
+ var popupWindow = PopupWindow(this)
|
|
|
+ var popupView = LayoutInflater.from(this).inflate(R.layout.popupview_adjustment_dialog, null)
|
|
|
+ popupWindow.contentView = popupView
|
|
|
+ popupWindow.width = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
+ popupWindow.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
+ popupWindow.isOutsideTouchable = false
|
|
|
+ popupWindow.showAtLocation(sceneEditView, Gravity.START,actor.positionX,0)
|
|
|
+ popupView.sb_adjustment_dialog_hue.progress = actor.hue.toInt() + 180
|
|
|
+ popupView.tv_adjustment_dialog_hue.text = "Hue" + " : " + (actor.hue.toInt() + 180).toString()
|
|
|
+ popupView.sb_adjustment_dialog_hue.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
|
|
+ override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
|
|
|
+ popupView.tv_adjustment_dialog_hue.text = "Hue : " + p1.toString()
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let {
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].hue = p1.toFloat() - 180
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ sceneEditView.setLayerVisible(currentLayerIndex)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ override fun onStartTrackingTouch(p0: SeekBar?) {
|
|
|
+ }
|
|
|
+ override fun onStopTrackingTouch(p0: SeekBar?) {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ popupView.tv_adjustment_dialog_done.setOnClickListener {
|
|
|
+ popupWindow.dismiss()
|
|
|
+ sceneEditView.setLayerVisible(currentLayerIndex)
|
|
|
+ }
|
|
|
+ popupView.sb_adjustment_dialog_brightness.progress = actor.brightness.toInt()
|
|
|
+ popupView.tv_adjustment_dialog_brightness.text = "Brightness" + " : " + actor.brightness.toInt().toString()
|
|
|
+ popupView.sb_adjustment_dialog_brightness.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
|
|
+ override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
|
|
|
+ popupView.tv_adjustment_dialog_brightness.text = "Brightness : " + p1.toString()
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let {
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].brightness = p1.toFloat()
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ sceneEditView.setLayerVisible(currentLayerIndex)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ override fun onStartTrackingTouch(p0: SeekBar?) {
|
|
|
+ }
|
|
|
+ override fun onStopTrackingTouch(p0: SeekBar?) {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ popupView.sb_adjustment_dialog_saturation.progress = actor.saturation.toInt()
|
|
|
+ popupView.tv_adjustment_dialog_saturation.text = "Saturation" + " : " + actor.saturation.toInt().toString()
|
|
|
+ popupView.sb_adjustment_dialog_saturation.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
|
|
|
+ override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
|
|
|
+ popupView.tv_adjustment_dialog_saturation.text = "Saturation : " + p1.toString()
|
|
|
+ project.story?.let {
|
|
|
+ it.scenes?.let {
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[actor.positionZ].saturation = p1.toFloat()
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ sceneEditView.setLayerVisible(currentLayerIndex)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ override fun onStartTrackingTouch(p0: SeekBar?) {
|
|
|
+ }
|
|
|
+ override fun onStopTrackingTouch(p0: SeekBar?) {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ sceneEditView.setLayerVisible(currentLayerIndex)
|
|
|
+ }
|
|
|
popupView.Mirror.setOnClickListener {
|
|
|
project.story?.let {
|
|
|
it.scenes?.let {
|
|
@@ -1534,10 +1698,16 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
|
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]
|
|
|
+ if(content == "") {
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors.remove(dialogue)
|
|
|
+ setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ } else {
|
|
|
+ dialogue.text = content
|
|
|
+ it[currentSceneIndex].layers[currentLayerIndex].actors[dialogue.positionZ] = dialogue
|
|
|
+ setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
|
|
|
+ sceneEditView.scene = it[currentSceneIndex]
|
|
|
+ }
|
|
|
editTextDialog.dismiss()
|
|
|
}
|
|
|
}
|