Fix quick click action (#3127)

This commit is contained in:
Benoit Marty 2021-04-07 14:08:43 +02:00
parent 884358b374
commit b8d01c4577
3 changed files with 10 additions and 2 deletions

View File

@ -16,6 +16,7 @@ Improvements 🙌:
- Improve timeline filtering (dissociate membership and profile events, display hidden events when highlighted, fix hidden item/read receipts behavior)
- Add better support for empty room name fallback (#3106)
- Room list improvements (paging)
- Fix quick click action (#3127)
Bugfix 🐛:
- Fix bad theme change for the MainActivity

View File

@ -15,6 +15,8 @@
*/
package im.vector.app.core.utils
import android.os.SystemClock
/**
* Simple ThrottleFirst
* See https://raw.githubusercontent.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleFirst.png
@ -23,7 +25,7 @@ class FirstThrottler(private val minimumInterval: Long = 800) {
private var lastDate = 0L
fun canHandle(): Boolean {
val now = System.currentTimeMillis()
val now = SystemClock.elapsedRealtime()
if (now > lastDate + minimumInterval) {
lastDate = now
return true

View File

@ -20,6 +20,7 @@ import androidx.preference.Preference
import im.vector.app.BuildConfig
import im.vector.app.R
import im.vector.app.core.preference.VectorPreference
import im.vector.app.core.utils.FirstThrottler
import im.vector.app.core.utils.copyToClipboard
import im.vector.app.core.utils.displayInWebView
import im.vector.app.core.utils.openAppSettingsPage
@ -36,6 +37,8 @@ class VectorSettingsHelpAboutFragment @Inject constructor(
override var titleRes = R.string.preference_root_help_about
override val preferenceXmlRes = R.xml.vector_settings_help_about
private val firstThrottler = FirstThrottler(1000)
override fun bindPref() {
// preference to start the App info screen, to facilitate App permissions access
findPreference<VectorPreference>(APP_INFO_LINK_PREFERENCE_KEY)!!
@ -98,7 +101,9 @@ class VectorSettingsHelpAboutFragment @Inject constructor(
// third party notice
findPreference<VectorPreference>(VectorPreferences.SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
activity?.displayInWebView(VectorSettingsUrls.THIRD_PARTY_LICENSES)
if (firstThrottler.canHandle()) {
activity?.displayInWebView(VectorSettingsUrls.THIRD_PARTY_LICENSES)
}
false
}