[Android] Do not show context menus if activity is paused
Geoffrey Métais
git at videolan.org
Fri Mar 1 15:07:40 CET 2019
vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 1 14:51:13 2019 +0100| [f9bdc78c51bd33717382285bf687cad8cb8b0d83] | committer: Geoffrey Métais
Do not show context menus if activity is paused
> https://code.videolan.org/videolan/vlc-android/commit/f9bdc78c51bd33717382285bf687cad8cb8b0d83
---
vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt b/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
index ab9c74f89..adde94ff8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/dialogs/ContextSheet.kt
@@ -28,6 +28,7 @@ import android.widget.FrameLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity
+import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.bottomsheet.BottomSheetBehavior
@@ -148,6 +149,7 @@ interface CtxActionReceiver {
}
fun showContext(activity: FragmentActivity, receiver: CtxActionReceiver, position: Int, title: String, flags: Int) {
+ if (!activity.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) return
val ctxDialog = ContextSheet()
ctxDialog.arguments = Bundle(3).apply {
putString(CTX_TITLE_KEY, title)
More information about the Android
mailing list