Skip to content

Commit

Permalink
Huawei Maps: Don't use tag of backing map view (can't set to null)
Browse files Browse the repository at this point in the history
Fixes #2222
  • Loading branch information
mar-v-in committed Sep 27, 2024
1 parent d9df3fa commit f2d3b8b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.microg.gms.maps.hms.utils.toGms
import org.microg.gms.maps.hms.utils.toHms

class CircleImpl(private val circle: Circle) : ICircleDelegate.Stub() {
private var tag: Any? = null

override fun remove() {
circle.remove()
Expand Down Expand Up @@ -50,11 +51,11 @@ class CircleImpl(private val circle: Circle) : ICircleDelegate.Stub() {
override fun getStrokeColor(): Int = circle.strokeColor

override fun setTag(tag: IObjectWrapper) {
circle.setTag<Any>(tag.unwrap())
this.tag = tag.unwrap()
}

override fun getTag(): IObjectWrapper? {
return ObjectWrapper.wrap(circle.tag)
return ObjectWrapper.wrap(this.tag)
}

override fun setStrokePattern(pattern: List<PatternItem>?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.microg.gms.maps.hms.utils.toGms
import org.microg.gms.maps.hms.utils.toHms

class GroundOverlayImpl(private val groundOverlay: GroundOverlay) : IGroundOverlayDelegate.Stub() {
private var tag: Any? = null

override fun getId(): String {
return groundOverlay.id
Expand Down Expand Up @@ -88,7 +89,7 @@ class GroundOverlayImpl(private val groundOverlay: GroundOverlay) : IGroundOverl
}

override fun getTag(): IObjectWrapper? {
return ObjectWrapper.wrap(groundOverlay.tag)
return ObjectWrapper.wrap(this.tag)
}

override fun isClickable(): Boolean = groundOverlay.isClickable
Expand All @@ -102,7 +103,7 @@ class GroundOverlayImpl(private val groundOverlay: GroundOverlay) : IGroundOverl
}

override fun setTag(tag: IObjectWrapper) {
groundOverlay.tag = tag.unwrap()
this.tag = tag.unwrap()
}

override fun equalsRemote(other: IGroundOverlayDelegate?): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import org.microg.gms.maps.hms.utils.toGms
import org.microg.gms.maps.hms.utils.toHms

class MarkerImpl(private val mapImpl: GoogleMapImpl, private val id: String, private val options: MarkerOptions) : IMarkerDelegate.Stub() {

private var marker: Marker? = null
private var tag: Any? = null

@Synchronized
fun update() {
Expand Down Expand Up @@ -136,10 +136,10 @@ class MarkerImpl(private val mapImpl: GoogleMapImpl, private val id: String, pri
override fun getZIndex(): Float = marker?.zIndex ?: 0f

override fun setTag(obj: IObjectWrapper?) {
marker?.tag = obj.unwrap()
this.tag = obj.unwrap()
}

override fun getTag(): IObjectWrapper = ObjectWrapper.wrap(marker?.tag)
override fun getTag(): IObjectWrapper = ObjectWrapper.wrap(this.tag)

override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
if (super.onTransact(code, data, reply, flags)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.microg.gms.maps.hms.utils.toHms
import org.microg.gms.utils.warnOnTransactionIssues

class PolygonImpl(private val polygon: Polygon) : IPolygonDelegate.Stub() {
private var tag: Any? = null

override fun remove() {
polygon.remove()
Expand Down Expand Up @@ -121,7 +122,7 @@ class PolygonImpl(private val polygon: Polygon) : IPolygonDelegate.Stub() {
}

override fun getTag(): IObjectWrapper {
return ObjectWrapper.wrap(polygon.tag)
return ObjectWrapper.wrap(this.tag)
}

override fun isClickable(): Boolean {
Expand All @@ -141,7 +142,7 @@ class PolygonImpl(private val polygon: Polygon) : IPolygonDelegate.Stub() {
}

override fun setTag(tag: IObjectWrapper?) {
polygon.tag = tag.unwrap()
this.tag = tag.unwrap()
}

override fun equalsRemote(other: IPolygonDelegate?): Boolean = equals(other)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import org.microg.gms.maps.hms.utils.toHms
import org.microg.gms.maps.hms.utils.toHmsPolylineWidth

class PolylineImpl(private val polyline: Polyline, polylineOptions: PolylineOptions) : IPolylineDelegate.Stub() {
private var tag: Any? = null

override fun remove() {
polyline.remove()
Expand Down Expand Up @@ -121,7 +122,7 @@ class PolylineImpl(private val polyline: Polyline, polylineOptions: PolylineOpti
}

override fun getTag(): IObjectWrapper {
return ObjectWrapper.wrap(polyline.tag)
return ObjectWrapper.wrap(this.tag)
}

override fun setJointType(jointType: Int) {
Expand All @@ -138,7 +139,7 @@ class PolylineImpl(private val polyline: Polyline, polylineOptions: PolylineOpti
}

override fun setTag(tag: IObjectWrapper?) {
polyline.tag = tag.unwrap()
this.tag = tag.unwrap()
}

override fun setEndCap(endCap: Cap) {
Expand Down

0 comments on commit f2d3b8b

Please sign in to comment.