Explorar o código

Merge branch 'white-background'

faterhenry %!s(int64=6) %!d(string=hai) anos
pai
achega
8d9e8e0094

+ 1 - 0
src/main/java/com/bomostory/sceneeditmodule/Config.kt

@@ -15,4 +15,5 @@ object Config {
     val PDF_FOLDER = File(ROOT, "pdf")
 
     const val VIDEO_FILE_NAME = "video.mp4"
+    const val PROJECT_WHITE_FILE_NAME = "/white.png"
 }

+ 3 - 0
src/main/java/com/bomostory/sceneeditmodule/SceneEditActivity.kt

@@ -105,6 +105,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         supportActionBar?.hide()
         project = Gson().fromJson<Project>(intent.getStringExtra("project"), Project::class.java)
         resourceThemeBitmap = project.sceneResource as ArrayList<String>
+        resourceThemeBitmap.add(File(Config.ASSETS_FOLDER, Config.PROJECT_WHITE_FILE_NAME).path)
         resourceActorBitmap = project.actorResource as ArrayList<ArrayList<String>>
         resourceObjectPath = ArrayList<String>().apply {
             project.themeAssetIndex.contains.obj.values.forEach {
@@ -827,6 +828,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
             }
         }
         viewContainer.removeAllViews()
+        startRecord.visibility = View.VISIBLE
         sceneEditView.setLayerVisible(currentLayerIndex)
     }
 
@@ -853,6 +855,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
             }
         }
         sceneEditView.setLayerVisible(currentLayerIndex)
+        startRecord.visibility = View.VISIBLE
         viewContainer.removeAllViews()
     }
     private fun addDialogue(positionX: Int, positionY: Int, resource: Int) {

+ 5 - 51
src/main/java/com/bomostory/sceneeditmodule/navigationbar/actor/ActorAdapter.kt

@@ -80,65 +80,19 @@ class ActorAdapter(var context : Context, var data: ArrayList<ArrayList<String>>
         fun bind(path: String?, position: Int, data: ArrayList<String>) {
             itemView.findViewById<ImageView>(R.id.actor_image).setImageDrawable(Drawable.createFromPath(path))
             itemView.findViewById<ImageView>(R.id.actor_image).setOnTouchListener(boMoOnTouchListener(position,0))
-            //itemView.findViewById<LinearLayout>(R.id.actor_rotate).removeAllViews()
             itemView.actor_rotate.apply {
-//                var onClickListeners = ArrayList<View.OnClickListener>()
-//                for (i in 0 until data.size) {
-//                    onClickListeners.add(View.OnClickListener {
-//                        itemView.findViewById<ImageView>(R.id.actor_image).setImageDrawable(Drawable.createFromPath(data[i]))
-//                        itemView.findViewById<ImageView>(R.id.actor_image).setOnTouchListener(boMoOnTouchListener(position,i))
-//                    })
-//                }
-                var onTouchListeners =  ArrayList<View.OnTouchListener>()
+                var onClickListeners = ArrayList<View.OnClickListener>()
                 for (i in 0 until data.size) {
-                    var positionX = 0
-                    var positionY = 0
-                    var clickPeriod = 0L
-                    var mx: Int
-                    onTouchListeners.add(View.OnTouchListener { v, event ->
-                        when(event.action){
-                            MotionEvent.ACTION_DOWN -> {
-                                clickPeriod = System.currentTimeMillis()
-                                positionX = event.x.toInt()
-                                Log.d("TEST12345", "xQQ = " + positionX)
-                                positionY = event.y.toInt()
-                            }
-                            MotionEvent.ACTION_MOVE -> {
-//                                if (!(Math.abs(event.x - positionX) < 1 && Math.abs(event.y - positionY) < 1)) {
-                                    mx = event.x.toInt() - positionX
-                                    this.smoothScrollBy(-mx *5,0)
-
-                                Log.d("TEST12345", "xKK = " + event.x.toInt())
-//                                }
-                            }
-                            MotionEvent.ACTION_UP -> {
-                                Log.d("TEST12345", "xJJ = " + event.x)
-                                if ((Math.abs(event.x - positionX) < 1 && Math.abs(event.y - positionY) < 1)) {
-                                    itemView.findViewById<ImageView>(R.id.actor_image).setImageDrawable(Drawable.createFromPath(data[i]))
-                                    itemView.findViewById<ImageView>(R.id.actor_image).setOnTouchListener(boMoOnTouchListener(position,i))
-                                }
-                            }
-                        }
-                        return@OnTouchListener true
+                    onClickListeners.add(View.OnClickListener {
+                        itemView.findViewById<ImageView>(R.id.actor_image).setImageDrawable(Drawable.createFromPath(data[i]))
+                        itemView.findViewById<ImageView>(R.id.actor_image).setOnTouchListener(boMoOnTouchListener(position,i))
                     })
                 }
-                adapter = ActorPoseAdapter(data, onTouchListeners)
+                adapter = ActorPoseAdapter(data, onClickListeners)
                 layoutManager = LinearLayoutManager(context).apply {
                     orientation = LinearLayoutManager.HORIZONTAL
                 }
-                isNestedScrollingEnabled = false
-
             }
-//            for (i in 0 until data.size) {
-//                itemView.findViewById<LinearLayout>(R.id.actor_rotate).addView(data[i])
-//                data[i].setOnClickListener(View.OnClickListener {
-//                    itemView.findViewById<ImageView>(R.id.actor_image).setImageDrawable(data[i].drawable)
-//                    itemView.findViewById<ImageView>(R.id.actor_image).setOnTouchListener(boMoOnTouchListener(position,i))
-//                })
-//                var lParams = data[i].layoutParams
-//                lParams.height = 100
-//                lParams.width = 100
-//                data[i].layoutParams = lParams //           }
         }
         private fun boMoOnTouchListener(position: Int, index: Int) : View.OnTouchListener {
             return View.OnTouchListener {view, motionEvent ->

+ 3 - 3
src/main/java/com/bomostory/sceneeditmodule/navigationbar/actor/ActorPoseAdapter.kt

@@ -9,7 +9,7 @@ import com.example.tfat.myapplication.R
 import kotlinx.android.synthetic.main.actor_pose_item.view.*
 import kotlinx.android.synthetic.main.item_actor.view.*
 
-class ActorPoseAdapter(var data: ArrayList<String>, var onClickListeners: ArrayList<View.OnTouchListener>): RecyclerView.Adapter<ActorPoseAdapter.ViewHolder>() {
+class ActorPoseAdapter(var data: ArrayList<String>, var onClickListeners: ArrayList<View.OnClickListener>): RecyclerView.Adapter<ActorPoseAdapter.ViewHolder>() {
 
 
     override fun getItemCount(): Int {
@@ -26,9 +26,9 @@ class ActorPoseAdapter(var data: ArrayList<String>, var onClickListeners: ArrayL
     }
 
     class ViewHolder (view : View) : RecyclerView.ViewHolder(view) {
-        fun bind(ObjectResource: String, onClickListener: View.OnTouchListener) {
+        fun bind(ObjectResource: String, onClickListener: View.OnClickListener) {
             itemView.iv_actor_pose_image.setImageDrawable(Drawable.createFromPath(ObjectResource))
-            itemView.layout_actor_pose.setOnTouchListener(onClickListener)
+            itemView.layout_actor_pose.setOnClickListener(onClickListener)
         }
     }
 }