Debounce camera switcher button.

This commit is contained in:
Nicholas Tinsley 2024-03-11 17:05:05 -04:00 committed by Clark Chen
parent 39aa583297
commit 6e09d101b5

View file

@ -42,6 +42,7 @@ import org.thoughtcrime.securesms.mediasend.v2.text.send.TextStoryPostSendReposi
import org.thoughtcrime.securesms.recipients.RecipientId import org.thoughtcrime.securesms.recipients.RecipientId
import org.thoughtcrime.securesms.safety.SafetyNumberBottomSheet import org.thoughtcrime.securesms.safety.SafetyNumberBottomSheet
import org.thoughtcrime.securesms.stories.Stories import org.thoughtcrime.securesms.stories.Stories
import org.thoughtcrime.securesms.util.Debouncer
import org.thoughtcrime.securesms.util.FullscreenHelper import org.thoughtcrime.securesms.util.FullscreenHelper
import org.thoughtcrime.securesms.util.WindowUtil import org.thoughtcrime.securesms.util.WindowUtil
import org.thoughtcrime.securesms.util.navigation.safeNavigate import org.thoughtcrime.securesms.util.navigation.safeNavigate
@ -79,6 +80,8 @@ class MediaSelectionActivity :
private val draftText: CharSequence? private val draftText: CharSequence?
get() = intent.getCharSequenceExtra(MESSAGE) get() = intent.getCharSequenceExtra(MESSAGE)
private val debouncer = Debouncer(200)
override fun attachBaseContext(newBase: Context) { override fun attachBaseContext(newBase: Context) {
delegate.localNightMode = AppCompatDelegate.MODE_NIGHT_YES delegate.localNightMode = AppCompatDelegate.MODE_NIGHT_YES
super.attachBaseContext(newBase) super.attachBaseContext(newBase)
@ -122,7 +125,7 @@ class MediaSelectionActivity :
} }
cameraSwitch.setOnClickListener { cameraSwitch.setOnClickListener {
viewModel.sendCommand(HudCommand.GoToCapture) debouncer.publish { viewModel.sendCommand(HudCommand.GoToCapture) }
} }
if (savedInstanceState == null) { if (savedInstanceState == null) {