For #17803 - Use the main looper for Handler()s

This was already the one inferred.
Targeting Android 11 means we need to pass it explicitly.
upstream-sync
Mugurell 3 years ago
parent 40149bdc42
commit 41f9388380

@ -5,6 +5,7 @@
package org.mozilla.fenix.collections
import android.os.Handler
import android.os.Looper
import android.text.InputFilter
import android.view.KeyEvent
import android.view.LayoutInflater
@ -168,7 +169,7 @@ class CollectionCreationView(
text = context.getString(R.string.create_collection_name_collection)
setOnClickListener {
name_collection_edittext.hideKeyboard()
val handler = Handler()
val handler = Handler(Looper.getMainLooper())
handler.postDelayed({
interactor.onBackPressed(SaveCollectionStep.NameCollection)
}, TRANSITION_DURATION)
@ -214,7 +215,7 @@ class CollectionCreationView(
text = context.getString(R.string.collection_rename)
setOnClickListener {
name_collection_edittext.hideKeyboard()
val handler = Handler()
val handler = Handler(Looper.getMainLooper())
handler.postDelayed({
interactor.onBackPressed(SaveCollectionStep.RenameCollection)
}, TRANSITION_DURATION)

@ -14,6 +14,7 @@ import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.LayoutInflater
import android.widget.Toast
import androidx.annotation.VisibleForTesting
@ -335,7 +336,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
Toast.LENGTH_LONG
).show()
Handler().postDelayed({
Handler(Looper.getMainLooper()).postDelayed({
exitProcess(0)
}, AMO_COLLECTION_OVERRIDE_EXIT_DELAY)
}
@ -406,7 +407,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
getString(R.string.toast_override_fxa_sync_server_done),
Toast.LENGTH_LONG
).show()
Handler().postDelayed({
Handler(Looper.getMainLooper()).postDelayed({
exitProcess(0)
}, FXA_SYNC_OVERRIDE_EXIT_DELAY)
}

Loading…
Cancel
Save