|
@@ -80,65 +80,19 @@ class ActorAdapter(var context : Context, var data: ArrayList<ArrayList<String>>
|
|
fun bind(path: String?, position: Int, data: 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).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()
|
|
|
|
itemView.actor_rotate.apply {
|
|
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) {
|
|
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 {
|
|
layoutManager = LinearLayoutManager(context).apply {
|
|
orientation = LinearLayoutManager.HORIZONTAL
|
|
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 {
|
|
private fun boMoOnTouchListener(position: Int, index: Int) : View.OnTouchListener {
|
|
return View.OnTouchListener {view, motionEvent ->
|
|
return View.OnTouchListener {view, motionEvent ->
|