|
@@ -6,13 +6,11 @@ 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.Paint
|
|
|
|
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
|
|
import android.support.v7.widget.RecyclerView
|
|
import android.support.v7.widget.RecyclerView
|
|
import android.util.DisplayMetrics
|
|
import android.util.DisplayMetrics
|
|
-import android.util.Log
|
|
|
|
import android.view.*
|
|
import android.view.*
|
|
import android.widget.PopupWindow
|
|
import android.widget.PopupWindow
|
|
import android.widget.SeekBar
|
|
import android.widget.SeekBar
|
|
@@ -57,6 +55,7 @@ import kotlinx.android.synthetic.main.scene_brush_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
|
|
|
|
+import kotlin.collections.ArrayList
|
|
|
|
|
|
|
|
|
|
class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener, EditActorView.OnActorChangeListener,
|
|
class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener, EditActorView.OnActorChangeListener,
|
|
@@ -65,7 +64,6 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
BrushView.OnSelectBrush {
|
|
BrushView.OnSelectBrush {
|
|
|
|
|
|
private lateinit var project: Project
|
|
private lateinit var project: Project
|
|
- private lateinit var otherThemes: OtherThemes
|
|
|
|
private var currentSceneIndex = 0
|
|
private var currentSceneIndex = 0
|
|
private var currentLayerIndex = 6
|
|
private var currentLayerIndex = 6
|
|
private var startRecordTime = 0L
|
|
private var startRecordTime = 0L
|
|
@@ -106,10 +104,6 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
actionBar?.hide()
|
|
actionBar?.hide()
|
|
supportActionBar?.hide()
|
|
supportActionBar?.hide()
|
|
project = Gson().fromJson<Project>(intent.getStringExtra("project"), Project::class.java)
|
|
project = Gson().fromJson<Project>(intent.getStringExtra("project"), Project::class.java)
|
|
- otherThemes = when(intent.getStringExtra("other_theme")){
|
|
|
|
- null -> OtherThemes()
|
|
|
|
- else -> Gson().fromJson<OtherThemes>(intent.getStringExtra("other_theme"), OtherThemes::class.java)
|
|
|
|
- }
|
|
|
|
resourceThemeBitmap = project.sceneResource as ArrayList<String>
|
|
resourceThemeBitmap = project.sceneResource as ArrayList<String>
|
|
resourceThemeBitmap.add(File(Config.ASSETS_FOLDER, Config.PROJECT_WHITE_FILE_NAME).path)
|
|
resourceThemeBitmap.add(File(Config.ASSETS_FOLDER, Config.PROJECT_WHITE_FILE_NAME).path)
|
|
resourceActorBitmap = when(intent.getStringExtra("resource_actor")) {
|
|
resourceActorBitmap = when(intent.getStringExtra("resource_actor")) {
|
|
@@ -125,7 +119,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else -> {intent.getStringArrayListExtra("resource_object")}
|
|
|
|
|
|
+ else -> { intent.getStringArrayListExtra("resource_object")}
|
|
}
|
|
}
|
|
windowManager.defaultDisplay.getMetrics(monitorSize)
|
|
windowManager.defaultDisplay.getMetrics(monitorSize)
|
|
var layoutPrams = sceneEditView.layoutParams
|
|
var layoutPrams = sceneEditView.layoutParams
|
|
@@ -404,7 +398,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
viewContainer.removeAllViews()
|
|
viewContainer.removeAllViews()
|
|
}
|
|
}
|
|
startRecord.visibility = View.INVISIBLE
|
|
startRecord.visibility = View.INVISIBLE
|
|
- if (currentLayerIndex == 6){
|
|
|
|
|
|
+ if (currentLayerIndex == 6) {
|
|
switchLayer(0)
|
|
switchLayer(0)
|
|
initActorRecyclerView()
|
|
initActorRecyclerView()
|
|
}
|
|
}
|
|
@@ -430,13 +424,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
selectActorView.btn_choose_theme.setOnClickListener {
|
|
selectActorView.btn_choose_theme.setOnClickListener {
|
|
- if (!otherThemes.themes.isEmpty()) {
|
|
|
|
- var intent = Intent(this, ChooseThemeActivity::class.java)
|
|
|
|
- intent.putExtra("project", Gson().toJson(project))
|
|
|
|
- intent.putExtra("other_theme", Gson().toJson(otherThemes))
|
|
|
|
- startActivity(intent)
|
|
|
|
- finish()
|
|
|
|
- }
|
|
|
|
|
|
+ chooseTheme()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
private fun initDialogueView(){
|
|
private fun initDialogueView(){
|
|
@@ -1536,4 +1524,24 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
|
|
paint_view.brush = it
|
|
paint_view.brush = it
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private fun chooseTheme(){
|
|
|
|
+ var otherThemes = OtherThemes()
|
|
|
|
+ SuperAppModule.themeManager.themes.forEach {
|
|
|
|
+ if (SuperAppModule.themeManager.canUse(it) && SuperAppModule.themeManager.isDownloaded(it)) {
|
|
|
|
+ val index = SuperAppModule.themeManager.loadThemeAssetIndex(it).blockingGet()
|
|
|
|
+ val data = it
|
|
|
|
+ var theme = Theme(index,SuperAppModule.themeManager.getAssetFolder(data))
|
|
|
|
+ otherThemes.themes.add(theme)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ val json = Gson().toJson(project)
|
|
|
|
+ val themeJson = Gson().toJson(otherThemes)
|
|
|
|
+ val intent = Intent(this@SceneEditActivity, ChooseThemeActivity::class.java).apply {
|
|
|
|
+ putExtra("project", json)
|
|
|
|
+ putExtra("other_theme", themeJson)
|
|
|
|
+ }
|
|
|
|
+ startActivity(intent)
|
|
|
|
+ finish()
|
|
|
|
+ }
|
|
}
|
|
}
|