feat: refresh reply dialog after new message
This commit is contained in:
parent
2de8ffd367
commit
f205463a51
3 changed files with 36 additions and 22 deletions
|
@ -19,6 +19,7 @@ import ani.dantotsu.snackString
|
|||
import ani.dantotsu.util.MarkdownCreatorActivity
|
||||
import com.xwray.groupie.GroupieAdapter
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
|
@ -58,6 +59,11 @@ class RepliesBottomDialog : BottomSheetDialogFragment() {
|
|||
activityId = requireArguments().getInt("activityId")
|
||||
loading(true)
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
loadData()
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun loadData() {
|
||||
val response = Anilist.query.getReplies(activityId)
|
||||
withContext(Dispatchers.Main) {
|
||||
loading(false)
|
||||
|
@ -81,8 +87,6 @@ class RepliesBottomDialog : BottomSheetDialogFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun onClick(int: Int) {
|
||||
ContextCompat.startActivity(
|
||||
requireContext(),
|
||||
|
@ -101,6 +105,15 @@ class RepliesBottomDialog : BottomSheetDialogFragment() {
|
|||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
loading(true)
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
delay(2000)
|
||||
loadData()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(activityId: Int): RepliesBottomDialog {
|
||||
return RepliesBottomDialog().apply {
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
app:abb_animationInterpolator="@anim/over_shoot"
|
||||
app:abb_indicatorAppearance="round"
|
||||
app:abb_indicatorLocation="top"
|
||||
app:abb_indicatorMargin="28dp"
|
||||
app:abb_selectedTabType="text"
|
||||
app:abb_textAppearance="@style/NavBarText"
|
||||
app:itemActiveIndicatorStyle="@style/BottomNavBar"
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp"
|
||||
|
||||
app:strokeColor="@color/transparent"
|
||||
android:backgroundTint="@color/nav_bg_inv"
|
||||
app:cardCornerRadius="26dp">
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue