Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private fun configRv() {
- rvChoice = find(R.id.rvChoice)
- rvChoice.setHasFixedSize(false)
- rvChoice.layoutManager = LinearLayoutManager(this)
- val adapter = ItemsRVAdapter(this)
- adapter.setData(getAllFromDb().filter { !it.used })
- rvChoice.adapter = adapter
- rvChoice.addOnItemTouchListener(
- RecyclerTouchListener(this, rvChoice,
- object : ItemsRVAdapter.CommonClickListener {
- override fun onItemClick(view: View, position: Int) {
- AlertDialog.Builder(this@AddActivity).apply {
- setTitle("${view.find<TextView>(R.id.tvDescription).text}.")
- setView(
- LayoutInflater.from(this@AddActivity)
- .inflate(R.layout.add, null, false)
- )
- setCancelable(false)
- setPositiveButton(android.R.string.yes) { dialog, _ ->
- dialog.cancel()
- // действия, влияющие на список в rv
- configRv()
- }
- setNegativeButton(android.R.string.no) { dialog, _ ->
- dialog.cancel()
- }
- create()
- }.show()
- }
- override fun onItemLongClick(view: View, position: Int) {
- }
- }
- )
- )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement