| | |
| | | import android.view.View |
| | | import android.widget.ImageView |
| | | import androidx.constraintlayout.motion.widget.MotionLayout |
| | | import androidx.constraintlayout.widget.ConstraintLayout |
| | | import cn.sinata.xldutils.adapter.HFRecyclerAdapter |
| | | import cn.sinata.xldutils.adapter.util.ViewHolder |
| | | import com.dollearn.student.R |
| | |
| | | import com.facebook.drawee.view.SimpleDraweeView |
| | | import kotlinx.android.synthetic.main.fragment_listen.* |
| | | import org.greenrobot.eventbus.EventBus |
| | | import org.jetbrains.anko.dip |
| | | import java.util.ArrayList |
| | | |
| | | class GameAdapter(list: ArrayList<Subject>):HFRecyclerAdapter<Subject>(list, R.layout.item_game_1) { |
| | | var height:Int = 200 //行高 |
| | | override fun onBind(holder: ViewHolder, position: Int, data: Subject) { |
| | | val act = context as SuperListenActivity |
| | | holder.bind<SimpleDraweeView>(R.id.iv_img).setImageURI(data.img) |
| | | val view = holder.bind<View>(R.id.cl_voice_end_1) |
| | | val motion = holder.bind<MotionLayout>(R.id.motion) |
| | |
| | | view.clickDelay { |
| | | // (context as SuperListenActivity) |
| | | } |
| | | val act = context as SuperListenActivity |
| | | val layoutParams = motion.layoutParams as ConstraintLayout.LayoutParams |
| | | layoutParams.height = height - act.dip(16) |
| | | motion.layoutParams = layoutParams |
| | | holder.itemView.setOnClickListener { |
| | | if (act.playing||act.index>act.voiceList.size-1) |
| | | return@setOnClickListener |