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

Unverified Commit c730ca6d authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Maps: Add more details of client library and other small fixes

parent 11f8eaa3
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
/*
 * SPDX-FileCopyrightText: 2023 microG Project Team
 * SPDX-License-Identifier: Apache-2.0
 */

package com.google.android.gms.dynamite.descriptors.com.google.android.gms.maps_dynamite;

import androidx.annotation.Keep;

@Keep
public class ModuleDescriptor {
    public static final String MODULE_ID = "com.google.android.gms.maps_dynamite";
    public static final int MODULE_VERSION = 1;
}
+0 −1
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ import com.google.android.gms.dynamic.ObjectWrapper
import com.google.android.gms.maps.internal.*
import com.mapbox.mapboxsdk.location.engine.LocationEngineCallback
import com.mapbox.mapboxsdk.location.engine.LocationEngineResult
import org.microg.gms.maps.MapsConstants
import org.microg.gms.maps.mapbox.model.AbstractMarker
import org.microg.gms.maps.mapbox.model.DefaultInfoWindowAdapter
import org.microg.gms.maps.mapbox.model.InfoWindow
+15 −7
Original line number Diff line number Diff line
@@ -52,12 +52,12 @@ import com.mapbox.mapboxsdk.plugins.annotation.*
import com.mapbox.mapboxsdk.plugins.annotation.Annotation
import com.mapbox.mapboxsdk.style.layers.Property.LINE_CAP_ROUND
import com.google.android.gms.dynamic.unwrap
import com.google.android.gms.maps.GoogleMap
import com.mapbox.mapboxsdk.WellKnownTileServer
import org.microg.gms.maps.mapbox.model.InfoWindow
import org.microg.gms.maps.mapbox.model.getInfoWindowViewFor
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback
import org.microg.gms.maps.MapsConstants.*
import org.microg.gms.maps.mapbox.model.*
import org.microg.gms.maps.mapbox.utils.MultiArchLoader
import org.microg.gms.maps.mapbox.utils.toGms
@@ -481,8 +481,12 @@ class GoogleMapImpl(context: Context, var options: GoogleMapOptions) : AbstractG

    override fun setPadding(left: Int, top: Int, right: Int, bottom: Int) = afterInitialize { map ->
        Log.d(TAG, "setPadding: $left $top $right $bottom")
        val padding = map.cameraPosition.padding
        if (padding == null || padding[0] != left.toDouble() || padding[1] != top.toDouble() || padding[2] != right.toDouble() || padding[3] != bottom.toDouble()) {
            // Don't send camera update if we already got these paddings
            CameraUpdateFactory.paddingTo(left.toDouble(), top.toDouble(), right.toDouble(), bottom.toDouble())
                .let { map.moveCamera(it) }
        }

        val fourDp = mapView?.context?.resources?.getDimension(R.dimen.maplibre_four_dp)?.toInt()
                ?: 0
@@ -558,8 +562,6 @@ class GoogleMapImpl(context: Context, var options: GoogleMapOptions) : AbstractG
            } catch (e: Exception) {
                Log.w(TAG, e)
            }
        }
        map.addOnCameraIdleListener {
            try {
                cameraIdleListener?.onCameraIdle()
            } catch (e: Exception) {
@@ -569,14 +571,20 @@ class GoogleMapImpl(context: Context, var options: GoogleMapOptions) : AbstractG
        map.addOnCameraMoveListener {
            try {
                cameraMoveListener?.onCameraMove()
                currentInfoWindow?.update()
            } catch (e: Exception) {
                Log.w(TAG, e)
            }
            currentInfoWindow?.update()
        }
        map.addOnCameraMoveStartedListener {
            try {
                cameraMoveStartedListener?.onCameraMoveStarted(it)
                val reason = when (it) {
                    MapboxMap.OnCameraMoveStartedListener.REASON_API_GESTURE -> GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE
                    MapboxMap.OnCameraMoveStartedListener.REASON_API_ANIMATION -> GoogleMap.OnCameraMoveStartedListener.REASON_API_ANIMATION
                    MapboxMap.OnCameraMoveStartedListener.REASON_DEVELOPER_ANIMATION -> GoogleMap.OnCameraMoveStartedListener.REASON_DEVELOPER_ANIMATION
                    else -> 0
                }
                cameraMoveStartedListener?.onCameraMoveStarted(reason)
            } catch (e: Exception) {
                Log.w(TAG, e)
            }
+6 −6
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import android.util.Log
import androidx.annotation.ColorInt
import androidx.annotation.FloatRange
import androidx.core.graphics.ColorUtils
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.model.MapStyleOptions
import com.google.gson.Gson
import com.google.gson.JsonSyntaxException
@@ -12,7 +13,6 @@ import com.google.gson.annotations.SerializedName
import com.mapbox.mapboxsdk.maps.Style
import org.json.JSONArray
import org.json.JSONObject
import org.microg.gms.maps.MapsConstants
import org.microg.gms.maps.mapbox.utils.MapContext
import java.io.File
import java.io.IOException
@@ -39,8 +39,8 @@ fun getStyle(
    val styleJson = JSONObject(
        context.assets.open(
            when (mapType) {
                MapsConstants.MAP_TYPE_SATELLITE, MapsConstants.MAP_TYPE_HYBRID -> "style-microg-satellite.json"
                MapsConstants.MAP_TYPE_TERRAIN -> "style-mapbox-outdoors-v12.json"
                GoogleMap.MAP_TYPE_SATELLITE, GoogleMap.MAP_TYPE_HYBRID -> "style-microg-satellite.json"
                GoogleMap.MAP_TYPE_TERRAIN -> "style-mapbox-outdoors-v12.json"
                //MAP_TYPE_NONE, MAP_TYPE_NORMAL,
                else -> "style-microg-normal.json"
            }
@@ -73,9 +73,9 @@ fun getStyle(


fun getFallbackStyleOnlineUri(mapType: Int) = when (mapType) {
    MapsConstants.MAP_TYPE_SATELLITE -> "mapbox://styles/microg/cjxgloted25ap1ct4uex7m6hi"
    MapsConstants.MAP_TYPE_TERRAIN -> "mapbox://styles/mapbox/outdoors-v12"
    MapsConstants.MAP_TYPE_HYBRID -> "mapbox://styles/microg/cjxgloted25ap1ct4uex7m6hi"
    GoogleMap.MAP_TYPE_SATELLITE -> "mapbox://styles/microg/cjxgloted25ap1ct4uex7m6hi"
    GoogleMap.MAP_TYPE_TERRAIN -> "mapbox://styles/mapbox/outdoors-v12"
    GoogleMap.MAP_TYPE_HYBRID -> "mapbox://styles/microg/cjxgloted25ap1ct4uex7m6hi"
    //MAP_TYPE_NONE, MAP_TYPE_NORMAL,
    else -> "mapbox://styles/microg/cjui4020201oo1fmca7yuwbor"
}
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ abstract class AbstractPolygon(private val id: String, options: PolygonOptions)
    }

    override fun setVisible(visible: Boolean) {
        isVisible = visible
        this.visible = visible
        update()
    }

Loading