Skip to content
This repository was archived by the owner on Jun 7, 2020. It is now read-only.

Commit 5b4d126

Browse files
authored
Merge pull request #1555 from RocketChat/fix/fix-crash-on-baseviewholder
[FIX] Check if we are in a RESUMED state before showing the Dialog.
2 parents 87ec472 + 1be1872 commit 5b4d126

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

app/src/main/java/chat/rocket/android/chatroom/adapter/BaseViewHolder.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.view.View
66
import android.view.ViewGroup
77
import androidx.appcompat.app.AppCompatActivity
88
import androidx.core.view.children
9+
import androidx.lifecycle.Lifecycle
910
import androidx.recyclerview.widget.RecyclerView
1011
import chat.rocket.android.R
1112
import chat.rocket.android.chatroom.ui.bottomsheet.MessageActionsBottomSheet
@@ -94,9 +95,11 @@ abstract class BaseViewHolder<T : BaseUiModel<*>>(
9495
view.context?.let {
9596
if (it is ContextThemeWrapper && it.baseContext is AppCompatActivity) {
9697
with(it.baseContext as AppCompatActivity) {
97-
val actionsBottomSheet = MessageActionsBottomSheet()
98-
actionsBottomSheet.addItems(menuItems, this@BaseViewHolder)
99-
actionsBottomSheet.show(supportFragmentManager, null)
98+
if (this.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
99+
val actionsBottomSheet = MessageActionsBottomSheet()
100+
actionsBottomSheet.addItems(menuItems, this@BaseViewHolder)
101+
actionsBottomSheet.show(supportFragmentManager, null)
102+
}
100103
}
101104
}
102105
}

0 commit comments

Comments
 (0)