Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 11f8eaa3 authored by Fynn Godau's avatar Fynn Godau Committed by Marvin W.
Browse files

Merge branch '910-queue' into 'master'

Post delayed callbacks to main looper instead of mapView event queue

See merge request !76
parent d3a3b90a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -65,8 +65,8 @@ import org.microg.gms.maps.mapbox.utils.toMapbox

private fun <T : Any> LongSparseArray<T>.values() = (0 until size()).mapNotNull { valueAt(it) }

fun runOnMainLooper(method: () -> Unit) {
    if (Looper.myLooper() == Looper.getMainLooper()) {
fun runOnMainLooper(forceQueue: Boolean = false, method: () -> Unit) {
    if (!forceQueue && Looper.myLooper() == Looper.getMainLooper()) {
        method()
    } else {
        Handler(Looper.getMainLooper()).post {
@@ -827,7 +827,7 @@ class GoogleMapImpl(context: Context, var options: GoogleMapOptions) : AbstractG
                 * null), otherwise that results in other problems (e.g. Gas Now app not
                 * initializing).
                 */
                mapView?.post {
                runOnMainLooper(forceQueue = true) {
                    Log.d(TAG, "Invoking callback now: map cannot be initialized because it is not shown (yet)")
                    runCallback()
                }