Procházet zdrojové kódy

bomo_bug_fix_04_24

faterhenry před 5 roky
rodič
revize
5d6c212137

+ 7 - 1
src/main/java/com/bomostory/sceneeditmodule/ChooseThemeActivity.kt

@@ -28,6 +28,7 @@ class ChooseThemeActivity : AppCompatActivity() {
     private var resourceActorPath = ThemeActorResource()
     private var resourceThemePath = ArrayList<String>()
     private var coverPath = ArrayList<String>()
+    private var newThemeName = ""
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         setContentView(R.layout.activity_choose_theme)
@@ -45,7 +46,7 @@ class ChooseThemeActivity : AppCompatActivity() {
                         otherThemes.themes[i].themeAssetIndex.contains.actor.forEach {
                             add(ArrayList<String>().apply {
                                 it.value.values.forEach {
-                                    val path = "${otherThemes.themes[i].assetFolder.path}/${"asset"}/${it.smallFile}"
+                                    val path = "${otherThemes.themes[i].assetFolder.path}/${"asset"}/${it.largeFile}"
                                     add(path)
                                 }
                             })
@@ -67,6 +68,11 @@ class ChooseThemeActivity : AppCompatActivity() {
                         putExtra("project", intent.getStringExtra("project"))
                         putExtra("other_theme", Gson().toJson(otherThemes))
                         putExtra("resource_actor", Gson().toJson(resourceActorPath))
+                        putExtra("theme_name",otherThemes.themes[i].themeAssetIndex.name)
+                        putExtra("currentScene",intent.getIntExtra("currentScene",0))
+                        putExtra("currentLayer",intent.getIntExtra("currentLayer",6))
+                        putExtra("currentLayer",intent.getIntExtra("currentLayer",6))
+                        putExtra("is_from_choose_theme",true)
                         putStringArrayListExtra("resource_object", resourceObjectPath)
                         putStringArrayListExtra("resource_scene", resourceThemePath)
                     }

+ 34 - 5
src/main/java/com/bomostory/sceneeditmodule/SceneEditActivity.kt

@@ -181,6 +181,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
             }
         }
         initRecord()
+        initCurrentState()
     }
 
     override fun onResume() {
@@ -244,6 +245,28 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         }
         themeName = project.themeAssetIndex.name
     }
+
+    private fun initCurrentState(){
+        val currentScene =  intent.getIntExtra("currentScene",0)
+        val currentLayer = intent.getIntExtra("currentLayer",6)
+        var oldSceneIndex = currentSceneIndex
+        currentSceneIndex = currentScene
+        switchToPreViewLayer()
+        project.story?.let {
+            it.scenes?.let{
+                sceneEditView.scene = it[currentScene]
+            }
+        }
+        record = Record()
+        initControlBarView()
+        initNavigationBarView(oldSceneIndex)
+        initPreviousNextButton()
+        switchLayer(currentLayer)
+        if(intent.getBooleanExtra("is_from_choose_theme",false)) {
+            themeName = intent.getStringExtra("theme_name")
+            initActorRecyclerView()
+        }
+    }
     private fun initControlBarView() {
         controlBarView.setBtnSelected(6)
         switchToPreViewLayer()
@@ -1476,8 +1499,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         popupView.bring_to_front.setOnClickListener{
             project.story?.let {
                 it.scenes?.let {
-                    it[currentSceneIndex].layers[currentLayerIndex].actors.removeAt(actor.positionZ)
-                    it[currentSceneIndex].layers[currentLayerIndex].actors.add(actor)
+                    if(actor.positionZ + 1 < it[currentSceneIndex].layers[currentLayerIndex].actors.size) {
+                        it[currentSceneIndex].layers[currentLayerIndex].actors.removeAt(actor.positionZ)
+                        it[currentSceneIndex].layers[currentLayerIndex].actors.add(actor.positionZ + 1, actor)
+                    }
                     setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
                     sceneEditView.scene = it[currentSceneIndex]
                     popupWindow.dismiss()
@@ -1488,8 +1513,10 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         popupView.send_to_back.setOnClickListener{
             project.story?.let {
                 it.scenes?.let {
-                    it[currentSceneIndex].layers[currentLayerIndex].actors.remove(actor)
-                    it[currentSceneIndex].layers[currentLayerIndex].actors.add(0, actor)
+                    if(actor.positionZ - 1 >= 0) {
+                        it[currentSceneIndex].layers[currentLayerIndex].actors.removeAt(actor.positionZ)
+                        it[currentSceneIndex].layers[currentLayerIndex].actors.add(actor.positionZ - 1, actor)
+                    }
                     setActorPositionZ(it[currentSceneIndex].layers[currentLayerIndex].actors)
                     sceneEditView.scene = it[currentSceneIndex]
                     popupWindow.dismiss()
@@ -1802,7 +1829,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
     }
 
     override fun onSceneMove(dX: Int) {
-        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)))) {
+        if ( (BACKGROUND_MOVE_RATE * monitorSize.widthPixels.div(BACKGROUND_MOVE_RATE * 4)) >= (swipeX + dX) && (swipeX + dX) > (-(BACKGROUND_MOVE_RATE * monitorSize.widthPixels.div(BACKGROUND_MOVE_RATE * 4)))) {
             sceneEditView.x = swipeX + dX
             if (isRecord) {
                 record?.tracks.let {
@@ -2132,6 +2159,8 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         val intent = Intent(this@SceneEditActivity, ChooseThemeActivity::class.java).apply {
                          putExtra("project", json)
                          putExtra("other_theme", themeJson)
+                         putExtra("currentScene",currentSceneIndex)
+                         putExtra("currentLayer",currentLayerIndex)
                      }
         startActivity(intent)
         finish()

+ 0 - 2
src/main/java/com/bomostory/sceneeditmodule/sceneview/OnTouchSceneListener.kt

@@ -37,5 +37,3 @@ class OnTouchSceneListener : View.OnTouchListener{
     }
 
 }
-
-

+ 13 - 1
src/main/java/com/bomostory/sceneeditmodule/screen/movie/MovieEditActivity.kt

@@ -1,10 +1,12 @@
 package com.bomostory.sceneeditmodule.screen.movie
 
+import android.app.AlertDialog
 import android.app.ProgressDialog
 import android.arch.lifecycle.Observer
 import android.arch.lifecycle.ViewModelProviders
 import android.content.DialogInterface
 import android.content.Intent
+import android.net.Uri
 import android.os.Bundle
 import android.os.Handler
 import android.support.v4.app.DialogFragment
@@ -359,7 +361,17 @@ class MovieEditActivity : AppCompatActivity(),
                             when (it.errorCode) {
                                 4013 -> Toast.makeText(context, R.string.uikit_others_shared_failed, Toast.LENGTH_SHORT).show()
                                 else -> {
-                                    Toast.makeText(context, R.string.uikit_others_upload_successfully, Toast.LENGTH_SHORT).show()
+                                    AlertDialog.Builder(this@MovieEditActivity).apply {
+                                        setMessage(R.string.uikit_others_upload_successfully)
+                                        setPositiveButton(R.string.uikit_edit_go_to_bomo_channel) { _, _ ->
+                                            val url = "https://www.youtube.com/channel/UCN43cigoNSO8rWKfxsQIFRw"
+                                            val intent = Intent(Intent.ACTION_VIEW).apply {
+                                                data = Uri.parse(url)
+                                            }
+                                            startActivity(intent)
+                                        }
+                                        show()
+                                    }
                                 }
                             }
                         }, {

+ 15 - 11
src/main/java/com/bomostory/sceneeditmodule/share/ExportPdfDialog.kt

@@ -25,7 +25,6 @@ class ExportPdfDialog : DialogFragment() {
     lateinit var project: Project
     var image1Path = ""
     var image2Path = ""
-    var image3Path = ""
     var onClickPrint = Runnable { }
     var type = Type.Standard
 
@@ -53,22 +52,27 @@ class ExportPdfDialog : DialogFragment() {
                 Picasso.get().load(image1Path).into(iv_exportPdfDialog_standard_1)
                 */
             }
-            if (image2Path != "") {
-                val bitmap = decodeImage(context, image2Path)
+            val width = context.resources.getDimension(R.dimen.share_dialog_screenshot_width).toInt()
+            val height = context.resources.getDimension(R.dimen.share_dialog_screenshot_height).toInt()
+            if(project?.coverFile == null){
+                val bitmap = CoverDrawer.drawFrontCover(width,height,project.name?:"", project.author?:"",project.frontCoverColor.getColor(context))
+                iv_exportPdfDialog_standard_1.setImageBitmap(bitmap)
+            } else {
+                project.coverFile?.let {
+                    val bitmap = CoverDrawer.drawFrontCover(width,height,project.name?:"", project.author?:"",it)
+                    iv_exportPdfDialog_standard_1.setImageBitmap(bitmap)
+                }
+            }
+            val bitmap = CoverDrawer.drawBackCover(context,width,height,project.backCoverColor.getColor(context))
+            iv_exportPdfDialog_standard_3.setImageBitmap(bitmap)
+            if (image1Path != "") {
+                val bitmap = decodeImage(context, image1Path)
                 iv_exportPdfDialog_standard_2.setImageBitmap(bitmap)
                 // Picasso not work, don't know why
                 /*
                 Picasso.get().load(image2Path).into(iv_exportPdfDialog_standard_2)
                 */
             }
-            if (image3Path != "") {
-                val bitmap = decodeImage(context, image3Path)
-                iv_exportPdfDialog_standard_3.setImageBitmap(bitmap)
-                // Picasso not work, don't know why
-                /*
-                Picasso.get().load(image3Path).into(iv_exportPdfDialog_standard_3)
-                */
-            }
             iv_exportPdfDialog_foldableBookletCoverFront.setImageBitmap(createFrontCover(context))
             iv_exportPdfDialog_foldableBookletCoverBack.setImageBitmap(createBackCover(context))
         }