From 58c19385a384585911f7089dcc15ec26a6cebc3b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 30 Mar 2023 15:15:39 +0200 Subject: ui: do not allow double clicking fab to show menu twice Exception java.lang.IllegalStateException: at androidx.fragment.app.FragmentStore.addFragment (FragmentStore.java:92) at androidx.fragment.app.FragmentManager.addFragment (FragmentManager.java:1481) at androidx.fragment.app.BackStackRecord.executeOps (BackStackRecord.java:387) at androidx.fragment.app.FragmentManager.executeOps (FragmentManager.java:1965) at androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:1873) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:1823) at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:1760) at androidx.fragment.app.FragmentManager$5.run (FragmentManager.java:547) at android.os.Handler.handleCallback (Handler.java:938) at android.os.Handler.dispatchMessage (Handler.java:99) at android.os.Looper.loop (Looper.java:268) at android.app.ActivityThread.main (ActivityThread.java:8101) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:627) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:997) Signed-off-by: Jason A. Donenfeld --- ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ui') diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt index e6270d0e..1c531dbf 100644 --- a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt +++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt @@ -97,6 +97,8 @@ class TunnelListFragment : BaseFragment() { val bottomSheet = AddTunnelsSheet() binding?.apply { createFab.setOnClickListener { + if (childFragmentManager.findFragmentByTag("BOTTOM_SHEET") != null) + return@setOnClickListener childFragmentManager.setFragmentResultListener(AddTunnelsSheet.REQUEST_KEY_NEW_TUNNEL, viewLifecycleOwner) { _, bundle -> when (bundle.getString(AddTunnelsSheet.REQUEST_METHOD)) { AddTunnelsSheet.REQUEST_CREATE -> { -- cgit v1.2.3