Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor track details components to use org.envirocar.map module #1005

Conversation

alexmercerind
Copy link
Member

This pull-request refactors the track details views to utilize the newly introduced map module:

The referenced views now use org.envirocar.map module instead of Mapbox v9 directly. A substantial part of implementation (primarily the files including any map related code) has been migrated to Kotlin.

@alexmercerind
Copy link
Member Author

The migrated code appears to be working properly with org.envirocar.map module.

mapbox://styles/mapbox/streets-v12 https://api.maptiler.com/maps/basic/style.json

Unfortunately, other views which are still dependent on Mapbox v9 directly are crashing due to this. The workaround resolves the compile time issue, but crashes on runtime.

Copy link
Contributor

@SebaDro SebaDro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be an issue with reinstantiating a MapView, which occurs in the TrackListRemoteCardFragment:

FATAL EXCEPTION: main
Process: org.envirocar.app.debug, PID: 15112
java.lang.IllegalStateException: MapView is already initialized with a different MapProvider.
	at org.envirocar.map.MapView.getController(MapView.kt:56)
	at org.envirocar.app.views.tracklist.AbstractTrackListCardAdapter.setupMapView(AbstractTrackListCardAdapter.kt:185)
	at org.envirocar.app.views.tracklist.AbstractTrackListCardAdapter.bindTrackCardViewHolder(AbstractTrackListCardAdapter.kt:103)
	at org.envirocar.app.views.tracklist.AbstractTrackListCardAdapter.onBindViewHolder(AbstractTrackListCardAdapter.kt:92)
	at org.envirocar.app.views.tracklist.AbstractTrackListCardAdapter.onBindViewHolder(AbstractTrackListCardAdapter.kt:24)
	at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7747)
	at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7847)
	at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6646)
	at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6917)
	at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
	at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
	at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
	at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
	at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
	at android.os.Handler.handleCallback(Handler.java:907)
	at android.os.Handler.dispatchMessage(Handler.java:105)
	at android.os.Looper.loop(Looper.java:216)
	at android.app.ActivityThread.main(ActivityThread.java:7625)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

The error occurs, when scrolling throuh the track list. I would expect that the same issue will occur in the TrackListLocalCardFragment, too.

Is it really necessary to throw an error here, when a MapView has been already instantiated. I would say to do nothing in this case or what could go wrong? Maybe just log a warning about it, but do not throw an error.

What do you think?

@SebaDro SebaDro self-requested a review July 1, 2024 06:51
@SebaDro SebaDro merged commit c3c4ce2 into enviroCar:gsoc2024-map-libre-migration Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants