mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-27 15:41:03 +00:00
Update ActivityItem.kt
This commit is contained in:
committed by
GitHub
parent
6f685a4388
commit
c06c7da0de
@@ -192,6 +192,27 @@ class ActivityItem(
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.activityDelete.setOnClickListener {
|
||||
val builder = androidx.appcompat.app.AlertDialog.Builder(
|
||||
fragActivity,
|
||||
R.style.MyPopup
|
||||
)
|
||||
builder.setTitle(R.string.activity_delete)
|
||||
builder.setPositiveButton(R.string.yes) { _, _ ->
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
Anilist.mutation.deleteActivity(activity.id)
|
||||
withContext(Dispatchers.Main) {
|
||||
fragActivity.recreate()
|
||||
}
|
||||
}
|
||||
}
|
||||
builder.setNegativeButton(R.string.no) { _, _ ->
|
||||
// Do nothing
|
||||
}
|
||||
val dialog = builder.show()
|
||||
dialog.window?.setDimAmount(0.8f)
|
||||
}
|
||||
binding.activityDelete.isVisible = activity.userId == Anilist.userid
|
||||
}
|
||||
|
||||
override fun getLayout(): Int {
|
||||
@@ -201,4 +222,4 @@ class ActivityItem(
|
||||
override fun initializeViewBinding(view: View): ItemActivityBinding {
|
||||
return ItemActivityBinding.bind(view)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user