[Android] Do not show context menus if activity is paused
Geoffrey Métais
git at videolan.org
Fri Mar 1 15:05:55 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 1 14:51:13 2019 +0100| [8070eecfecd96b5f6a01e85ad4fd9d654213b0c1] | committer: Geoffrey Métais
Do not show context menus if activity is paused
> https://code.videolan.org/videolan/vlc-android/commit/8070eecfecd96b5f6a01e85ad4fd9d654213b0c1
---
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