Loading play-services-location/core/src/main/kotlin/org/microg/gms/location/extensions.kt +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ internal fun Long.formatDuration(): CharSequence { val intervalName = listOf("ms", "s", "m", "h", "d") var ret = "" var rem = this for (i in 0..interval.size) { for (i in 0 until interval.size) { val mod = rem % interval[i] if (mod != 0L) { ret = "$mod${intervalName[i]}$ret" Loading play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt +2 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.widget.FrameLayout import android.widget.ImageView import androidx.annotation.UiThread import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.ObjectWrapper import com.google.android.gms.dynamic.unwrap Loading Loading @@ -297,7 +298,7 @@ class LiteGoogleMapImpl(context: Context, var options: GoogleMapOptions) : Abstr // Add location overlay if (myLocationEnabled) myLocation?.let { val indicator = mapContext.getDrawable(R.drawable.location_dot)!! val indicator = ContextCompat.getDrawable(mapContext, R.drawable.location_dot)!! styleBuilder.withImage("locationIndicator", indicator) val layer = SymbolLayer("location", "locationSource").withProperties( PropertyFactory.iconAllowOverlap(true), Loading play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Pattern.kt +9 −16 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package org.microg.gms.maps.mapbox import android.graphics.Bitmap import android.graphics.Canvas import android.graphics.Paint import android.graphics.RectF import com.google.android.gms.maps.model.Dash import com.google.android.gms.maps.model.Dot import com.google.android.gms.maps.model.Gap Loading Loading @@ -68,24 +69,16 @@ fun List<PatternItem>.makeBitmap(paint: Paint, strokeWidth: Float, skew: Float): var drawCursor = 0f for (item in this) { when (item) { is Dash -> canvas.drawRect( val rect = RectF( drawCursor, 0f, drawCursor + item.getWidth(strokeWidth, skew), strokeWidth * skew, paint strokeWidth * skew ) when (item) { is Dash -> canvas.drawRect(rect, paint) // is Gap -> do nothing, only move cursor is Dot -> canvas.drawOval( drawCursor, 0f, drawCursor + item.getWidth(strokeWidth, skew), strokeWidth * skew, paint ) is Dot -> canvas.drawOval(rect, paint) } drawCursor += item.getWidth(strokeWidth, skew) Loading play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Styles.kt +14 −1 Original line number Diff line number Diff line package org.microg.gms.maps.mapbox import android.graphics.Color import android.os.Build.VERSION.SDK_INT import android.util.Log import androidx.annotation.ColorInt import androidx.annotation.FloatRange Loading Loading @@ -100,7 +101,7 @@ fun MapStyleOptions.apply(style: JSONObject) { if (layer.layerShouldBeRemoved(operation)) { Log.v(TAG, "removing $layer") layerArray.remove(i) layerArray.removeCompat(i) } else { layer.applyOperation(operation) } Loading Loading @@ -393,3 +394,15 @@ fun Styler.applyTextOutline(paint: JSONObject) { is String -> paint.put("text-halo-color", applyColorChanges(textOutline.parseColor()).colorToString()) } } fun JSONArray.removeCompat(index: Int) = if (SDK_INT >= 19) { remove(index) this } else { val field = JSONArray::class.java.getDeclaredField("values") field.isAccessible = true val list = field.get(this) as MutableList<*> list.removeAt(index) this } No newline at end of file play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/InfoWindow.kt +4 −2 Original line number Diff line number Diff line Loading @@ -9,6 +9,8 @@ import android.view.ViewGroup import android.view.ViewManager import android.widget.FrameLayout import android.widget.TextView import androidx.core.content.ContextCompat import androidx.core.view.ViewCompat import com.google.android.gms.dynamic.ObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.android.gms.maps.internal.IInfoWindowAdapter Loading Loading @@ -44,9 +46,9 @@ fun IInfoWindowAdapter.getInfoWindowViewFor(marker: IMarkerDelegate, mapContext: view.parent?.let { (it as ViewManager).removeView(view) } return FrameLayout(view.context).apply { background = mapContext.getDrawable(R.drawable.maps_default_bubble) ViewCompat.setBackground(this, ContextCompat.getDrawable(mapContext, R.drawable.maps_default_bubble)) val fourDp = Utils.dpToPx(4f) elevation = fourDp ViewCompat.setElevation(this, fourDp) setPadding(fourDp.toInt(), fourDp.toInt(), fourDp.toInt(), fourDp.toInt() * 3) addView(view) } Loading Loading
play-services-location/core/src/main/kotlin/org/microg/gms/location/extensions.kt +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ internal fun Long.formatDuration(): CharSequence { val intervalName = listOf("ms", "s", "m", "h", "d") var ret = "" var rem = this for (i in 0..interval.size) { for (i in 0 until interval.size) { val mod = rem % interval[i] if (mod != 0L) { ret = "$mod${intervalName[i]}$ret" Loading
play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/LiteGoogleMap.kt +2 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import android.widget.FrameLayout import android.widget.ImageView import androidx.annotation.UiThread import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.ObjectWrapper import com.google.android.gms.dynamic.unwrap Loading Loading @@ -297,7 +298,7 @@ class LiteGoogleMapImpl(context: Context, var options: GoogleMapOptions) : Abstr // Add location overlay if (myLocationEnabled) myLocation?.let { val indicator = mapContext.getDrawable(R.drawable.location_dot)!! val indicator = ContextCompat.getDrawable(mapContext, R.drawable.location_dot)!! styleBuilder.withImage("locationIndicator", indicator) val layer = SymbolLayer("location", "locationSource").withProperties( PropertyFactory.iconAllowOverlap(true), Loading
play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Pattern.kt +9 −16 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ package org.microg.gms.maps.mapbox import android.graphics.Bitmap import android.graphics.Canvas import android.graphics.Paint import android.graphics.RectF import com.google.android.gms.maps.model.Dash import com.google.android.gms.maps.model.Dot import com.google.android.gms.maps.model.Gap Loading Loading @@ -68,24 +69,16 @@ fun List<PatternItem>.makeBitmap(paint: Paint, strokeWidth: Float, skew: Float): var drawCursor = 0f for (item in this) { when (item) { is Dash -> canvas.drawRect( val rect = RectF( drawCursor, 0f, drawCursor + item.getWidth(strokeWidth, skew), strokeWidth * skew, paint strokeWidth * skew ) when (item) { is Dash -> canvas.drawRect(rect, paint) // is Gap -> do nothing, only move cursor is Dot -> canvas.drawOval( drawCursor, 0f, drawCursor + item.getWidth(strokeWidth, skew), strokeWidth * skew, paint ) is Dot -> canvas.drawOval(rect, paint) } drawCursor += item.getWidth(strokeWidth, skew) Loading
play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Styles.kt +14 −1 Original line number Diff line number Diff line package org.microg.gms.maps.mapbox import android.graphics.Color import android.os.Build.VERSION.SDK_INT import android.util.Log import androidx.annotation.ColorInt import androidx.annotation.FloatRange Loading Loading @@ -100,7 +101,7 @@ fun MapStyleOptions.apply(style: JSONObject) { if (layer.layerShouldBeRemoved(operation)) { Log.v(TAG, "removing $layer") layerArray.remove(i) layerArray.removeCompat(i) } else { layer.applyOperation(operation) } Loading Loading @@ -393,3 +394,15 @@ fun Styler.applyTextOutline(paint: JSONObject) { is String -> paint.put("text-halo-color", applyColorChanges(textOutline.parseColor()).colorToString()) } } fun JSONArray.removeCompat(index: Int) = if (SDK_INT >= 19) { remove(index) this } else { val field = JSONArray::class.java.getDeclaredField("values") field.isAccessible = true val list = field.get(this) as MutableList<*> list.removeAt(index) this } No newline at end of file
play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/InfoWindow.kt +4 −2 Original line number Diff line number Diff line Loading @@ -9,6 +9,8 @@ import android.view.ViewGroup import android.view.ViewManager import android.widget.FrameLayout import android.widget.TextView import androidx.core.content.ContextCompat import androidx.core.view.ViewCompat import com.google.android.gms.dynamic.ObjectWrapper import com.google.android.gms.dynamic.unwrap import com.google.android.gms.maps.internal.IInfoWindowAdapter Loading Loading @@ -44,9 +46,9 @@ fun IInfoWindowAdapter.getInfoWindowViewFor(marker: IMarkerDelegate, mapContext: view.parent?.let { (it as ViewManager).removeView(view) } return FrameLayout(view.context).apply { background = mapContext.getDrawable(R.drawable.maps_default_bubble) ViewCompat.setBackground(this, ContextCompat.getDrawable(mapContext, R.drawable.maps_default_bubble)) val fourDp = Utils.dpToPx(4f) elevation = fourDp ViewCompat.setElevation(this, fourDp) setPadding(fourDp.toInt(), fourDp.toInt(), fourDp.toInt(), fourDp.toInt() * 3) addView(view) } Loading