Jelajahi Sumber

actor-pose-scroll

faterhenry 6 tahun lalu
induk
melakukan
f7527ea2d1

+ 8 - 0
src/main/java/com/bomostory/sceneeditmodule/ChooseThemeActivity.kt

@@ -26,6 +26,7 @@ class ChooseThemeActivity : AppCompatActivity() {
     private var pageList = ArrayList<ThemePageView>()
     private var resourceObjectPath = ArrayList<String>()
     private var resourceActorPath = ThemeActorResource()
+    private var resourceThemePath = ArrayList<String>()
     private var coverPath = ArrayList<String>()
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -56,11 +57,18 @@ class ChooseThemeActivity : AppCompatActivity() {
                             add(path)
                         }
                     }
+                    resourceThemePath = java.util.ArrayList<String>().apply {
+                        otherThemes.themes[i].themeAssetIndex.contains.scene.values.forEach {
+                            val path = "${otherThemes.themes[i].assetFolder.path}/${"asset"}/${it.largeFile}"
+                            add(path)
+                        }
+                    }
                     val intent = Intent(this@ChooseThemeActivity, SceneEditActivity::class.java).apply {
                         putExtra("project", intent.getStringExtra("project"))
                         putExtra("other_theme", Gson().toJson(otherThemes))
                         putExtra("resource_actor", Gson().toJson(resourceActorPath))
                         putStringArrayListExtra("resource_object", resourceObjectPath)
+                        putStringArrayListExtra("resource_scene", resourceThemePath)
                     }
                     startActivity(intent)
                     finish()

+ 20 - 10
src/main/java/com/bomostory/sceneeditmodule/SceneEditActivity.kt

@@ -11,7 +11,6 @@ import android.support.v7.app.AppCompatActivity
 import android.support.v7.widget.LinearLayoutManager
 import android.support.v7.widget.RecyclerView
 import android.util.DisplayMetrics
-import android.util.Log
 import android.view.*
 import android.widget.PopupWindow
 import android.widget.SeekBar
@@ -45,15 +44,16 @@ import kotlinx.android.synthetic.main.view_control_dialogue_dialog.view.*
 import com.bomostory.sceneeditmodule.DialogueColorData
 import com.bomostory.sceneeditmodule.SceneDrawer
 import com.bomostory.sceneeditmodule.navigationbar.actor.ObjectView
+import com.bomostory.sceneeditmodule.navigationbar.actor.NonInterceptTouchRecycleView
 import com.bomostory.sceneeditmodule.screen.draw.DrawActivity
 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.layer_management_fragment.*
 import kotlinx.android.synthetic.main.navigation_bar_view.view.*
 import kotlinx.android.synthetic.main.popupview_color_dialog.view.*
 import kotlinx.android.synthetic.main.popupview_setting.view.*
-import kotlinx.android.synthetic.main.scene_brush_view.view.*
 import java.io.File
 import java.util.*
 import java.util.concurrent.CopyOnWriteArrayList
@@ -165,10 +165,17 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
     }
 
     private fun initResource(){
-        resourceThemeBitmap = ArrayList<String>().apply {
-            project.themeAssetIndex.contains.scene.values.forEach {
-                val path = "${project.assetFolder.path}/${it.largeFile}"
-                add(path)
+        resourceThemeBitmap = when(intent.getStringExtra("resource_actor")) {
+            null -> {
+                ArrayList<String>().apply {
+                    project.themeAssetIndex.contains.scene.values.forEach {
+                        val path = "${project.assetFolder.path}/${it.largeFile}"
+                        add(path)
+                    }
+                }
+            }
+            else -> {
+                intent.getStringArrayListExtra("resource_scene")
             }
         }
         if (!resourceThemeBitmap.contains(File(Config.ASSETS_FOLDER, Config.PROJECT_WHITE_FILE_NAME).path)){
@@ -395,7 +402,7 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         val layoutManager = LinearLayoutManager(this)
         layoutManager.orientation = LinearLayoutManager.HORIZONTAL
         var actorAdapter = ActorAdapter(this, resourceActorBitmap, sceneEditView.findViewById(currentLayerIndex), this)
-        var actorRecyclerView = selectActorView.findViewById<RecyclerView>(R.id.select_actor_recycler_view)
+        var actorRecyclerView = selectActorView.findViewById<NonInterceptTouchRecycleView>(R.id.select_actor_recycler_view)
         actorRecyclerView.layoutManager = layoutManager
         actorRecyclerView.adapter = actorAdapter
         viewContainer.addView(selectActorView)
@@ -474,6 +481,9 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
             var newSceneRecyclerView = addSceneView.findViewById<RecyclerView>(R.id.new_scene_recycler_view)
             newSceneRecyclerView.layoutManager = layoutManager
             newSceneRecyclerView.adapter = addSceneAdapter
+            addSceneView.btn_add_scene_view_choose_theme.setOnClickListener {
+                chooseTheme()
+            }
         })
         controlSceneView.setonClickDuplicateBtn(View.OnClickListener {
             project.story?.let {
@@ -1539,9 +1549,9 @@ class SceneEditActivity : AppCompatActivity(), ActorAdapter.OnActorDragListener,
         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)
-            }
+                         putExtra("project", json)
+                         putExtra("other_theme", themeJson)
+                     }
         startActivity(intent)
         finish()
     }

+ 0 - 13
src/main/java/com/bomostory/sceneeditmodule/navigationbar/actor/ActorAdapter.kt

@@ -6,10 +6,8 @@ import android.content.Context
 import android.graphics.drawable.Drawable
 import android.support.v7.widget.LinearLayoutManager
 import android.support.v7.widget.RecyclerView
-import android.util.Log
 import android.view.*
 import android.widget.ImageView
-import android.widget.LinearLayout
 import com.bomostory.sceneeditmodule.navigationbar.actor.ActorPoseAdapter
 import com.bomostory.sceneeditmodule.screen.view.LayerView
 
@@ -93,17 +91,6 @@ class ActorAdapter(var context : Context, var data: ArrayList<ArrayList<String>>
                 layoutManager = LinearLayoutManager(context).apply {
                     orientation = LinearLayoutManager.HORIZONTAL
                 }
-                addOnScrollListener(object : RecyclerView.OnScrollListener(){
-                    override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
-                        super.onScrollStateChanged(recyclerView, newState)
-                        Log.d("TEST12345","11111")
-                    }
-
-                    override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
-                        super.onScrolled(recyclerView, dx, dy)
-                        Log.d("TEST12345","22222")
-                    }
-                })
             }
         }
         private fun boMoOnTouchListener(position: Int, index: Int) : View.OnTouchListener {

+ 20 - 0
src/main/java/com/bomostory/sceneeditmodule/navigationbar/actor/NonInterceptTouchRecycleView.kt

@@ -0,0 +1,20 @@
+package com.bomostory.sceneeditmodule.navigationbar.actor
+
+import android.content.Context
+import android.support.v7.widget.RecyclerView
+import android.util.AttributeSet
+import android.view.MotionEvent
+
+
+class NonInterceptTouchRecycleView: RecyclerView {
+    constructor(context : Context) : super(context)
+
+    constructor(context: Context, attrs: AttributeSet): super(context, attrs)
+
+    constructor(context: Context, attrs: AttributeSet, defStyle: Int): super(context, attrs, defStyle)
+
+    override fun onInterceptTouchEvent(e: MotionEvent?): Boolean {
+        return false
+    }
+
+}

+ 2 - 2
src/main/res/layout/actor_select_view.xml

@@ -45,11 +45,11 @@
             android:drawableLeft="@drawable/ic_object"
             app:layout_constraintLeft_toRightOf="@id/btn_character"/>
     </android.support.constraint.ConstraintLayout>
-    <android.support.v7.widget.RecyclerView
+    <com.bomostory.sceneeditmodule.navigationbar.actor.NonInterceptTouchRecycleView
         android:id="@+id/select_actor_recycler_view"
         android:paddingLeft="8dp"
         android:layout_width="match_parent"
         android:layout_height="160dp"
         android:background="#f0ebe1">
-    </android.support.v7.widget.RecyclerView>
+    </com.bomostory.sceneeditmodule.navigationbar.actor.NonInterceptTouchRecycleView>
 </LinearLayout>

+ 4 - 1
src/main/res/layout/add_scene_view.xml

@@ -9,11 +9,14 @@
             android:layout_width="match_parent"
             android:layout_height="40dp"
             android:paddingLeft="16dp">
-            <TextView
+            <Button
+                android:id="@+id/btn_add_scene_view_choose_theme"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_alignParentLeft="true"
                 android:layout_centerVertical="true"
+                android:background="#212121"
+                android:drawableStart="@drawable/ic_style"
                 android:textSize="14sp"
                 android:textColor="#ffecb3"
                 android:text="@string/uikit_edit_choose_theme"/>

+ 1 - 0
src/main/res/layout/item_add_scene.xml

@@ -4,5 +4,6 @@
     android:layout_marginTop="12dp"
     android:layout_width="144dp"
     android:layout_height="72dp"
+    android:layout_marginRight="8dp"
     xmlns:android="http://schemas.android.com/apk/res/android" />
 

+ 2 - 0
src/main/res/layout/item_scene.xml

@@ -41,6 +41,8 @@
             android:layout_height="match_parent"
             android:layout_marginLeft="8dp"
             android:layout_marginRight="8dp"
+            android:layout_marginTop="4dp"
+            android:layout_marginBottom="4dp"
             android:scaleType="center"
             android:layout_centerVertical="true"
             android:layout_centerHorizontal="true"

+ 1 - 0
src/main/res/layout/scene_control_view.xml

@@ -10,6 +10,7 @@
         android:layout_width="800dp"
         android:layout_height="120dp"
         android:layout_marginStart="40dp"
+        android:layout_marginEnd="20dp"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toLeftOf="@+id/duplicate"
         app:layout_constraintBottom_toBottomOf="parent" />