|
@@ -4,13 +4,16 @@ import android.content.ClipData
|
|
import android.content.ClipDescription
|
|
import android.content.ClipDescription
|
|
import android.content.Context
|
|
import android.content.Context
|
|
import android.graphics.drawable.Drawable
|
|
import android.graphics.drawable.Drawable
|
|
|
|
+import android.support.v7.widget.LinearLayoutManager
|
|
import android.support.v7.widget.RecyclerView
|
|
import android.support.v7.widget.RecyclerView
|
|
import android.view.*
|
|
import android.view.*
|
|
import android.widget.ImageView
|
|
import android.widget.ImageView
|
|
import android.widget.LinearLayout
|
|
import android.widget.LinearLayout
|
|
|
|
+import com.bomostory.sceneeditmodule.navigationbar.actor.ActorPoseAdapter
|
|
import com.bomostory.sceneeditmodule.screen.view.LayerView
|
|
import com.bomostory.sceneeditmodule.screen.view.LayerView
|
|
|
|
|
|
import com.example.tfat.myapplication.R
|
|
import com.example.tfat.myapplication.R
|
|
|
|
+import kotlinx.android.synthetic.main.item_actor.view.*
|
|
import kotlin.collections.ArrayList
|
|
import kotlin.collections.ArrayList
|
|
|
|
|
|
class ActorAdapter(var context : Context, var data: ArrayList<ArrayList<String>>, layerView: LayerView, onActorDragListener: OnActorDragListener) : RecyclerView.Adapter<ActorAdapter.ViewHolder>() {
|
|
class ActorAdapter(var context : Context, var data: ArrayList<ArrayList<String>>, layerView: LayerView, onActorDragListener: OnActorDragListener) : RecyclerView.Adapter<ActorAdapter.ViewHolder>() {
|
|
@@ -25,7 +28,7 @@ class ActorAdapter(var context : Context, var data: ArrayList<ArrayList<String>>
|
|
}
|
|
}
|
|
|
|
|
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
|
- holder.bind(bitmapData?.get(position), position, initActorImageView(data)[position])
|
|
|
|
|
|
+ holder.bind(bitmapData?.get(position), position, data[position])
|
|
}
|
|
}
|
|
|
|
|
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
|
@@ -73,21 +76,34 @@ class ActorAdapter(var context : Context, var data: ArrayList<ArrayList<String>>
|
|
}
|
|
}
|
|
|
|
|
|
class ViewHolder (view : View) : RecyclerView.ViewHolder(view) {
|
|
class ViewHolder (view : View) : RecyclerView.ViewHolder(view) {
|
|
- fun bind(path: String?, position: Int, data: ArrayList<ImageView>) {
|
|
|
|
|
|
+ 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).setImageDrawable(Drawable.createFromPath(path))
|
|
itemView.findViewById<ImageView>(R.id.actor_image).setOnTouchListener(boMoOnTouchListener(position,0))
|
|
itemView.findViewById<ImageView>(R.id.actor_image).setOnTouchListener(boMoOnTouchListener(position,0))
|
|
- itemView.findViewById<LinearLayout>(R.id.actor_rotate).removeAllViews()
|
|
|
|
- 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
|
|
|
|
|
|
+ //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))
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ adapter = ActorPoseAdapter(data, onClickListeners)
|
|
|
|
+ layoutManager = LinearLayoutManager(context).apply {
|
|
|
|
+ orientation = LinearLayoutManager.HORIZONTAL
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+// 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 {
|
|
private fun boMoOnTouchListener(position: Int, index: Int) : View.OnTouchListener {
|
|
return View.OnTouchListener {view, motionEvent ->
|
|
return View.OnTouchListener {view, motionEvent ->
|