-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
16632 show items on group selection #17404
Conversation
@@ -324,10 +325,17 @@ public void fileVisibilityChanged() { | |||
this.fileVisibilityChanged = true; | |||
} | |||
|
|||
public void setAndroidAutoPoints(@Nullable Set<PoiUIFilter> points){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setAndroidAutoPoiFilters ?
} | ||
val favoriteGroupsSize = favoriteGroups.size | ||
val limitedFavoriteGroups = | ||
favoriteGroups.subList(0, favoriteGroupsSize.coerceAtMost(contentLimit - 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why -2 if other screens -1?
public void onDestroy(@NonNull LifecycleOwner owner) { | ||
DefaultLifecycleObserver.super.onDestroy(owner); | ||
getApp().getOsmandMap().getMapLayers().getFavouritesLayer().setAndroidAutoFavouritePoints(null); | ||
getApp().getOsmandMap().refreshMap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we should move this two rows in separate methods in each screen, also add getOsmandMap in base screen class
override fun onCreate(owner: LifecycleOwner) { | ||
super.onCreate(owner) | ||
isLoading = true | ||
loadGpxFilesThread = Thread { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AsyncTask is easier to support than thread, use it and replace isLoading flag with method to check asyncTask
NativeUtilities.clipLineInVisibleRect(mapRenderer, tileBox, center31, marker31); | ||
if (line == null) { | ||
continue; | ||
if (!getMapView().isCarView()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use local variable isCarView from above
@@ -370,7 +384,8 @@ public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings nightMode | |||
OsmandApplication app = getApplication(); | |||
OsmandSettings settings = app.getSettings(); | |||
|
|||
if (tileBox.getZoom() < 3 || !settings.SHOW_MAP_MARKERS.get()) { | |||
boolean isCarView = getMapView().isCarView(); | |||
if ((tileBox.getZoom() < 3 || !settings.SHOW_MAP_MARKERS.get()) && !isCarView || isCarView && Algorithms.isEmpty(androidAutoMarkers)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Markers in AA do not depend on zoom level?
@@ -130,7 +140,20 @@ public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSett | |||
boolean favoritesChanged = this.favoritesChangedTime != favoritesChangedTime; | |||
this.favoritesChangedTime = favoritesChangedTime; | |||
|
|||
if (hasMapRenderer()) { | |||
if (androidAutoFavouritePoints != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AA check isn`t necessary as in other places? Also no zoom check?
@@ -337,7 +338,16 @@ private void drawMovableWpt(@NonNull Canvas canvas, @NonNull RotatedTileBox tile | |||
@Override | |||
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) { | |||
super.onPrepareBufferImage(canvas, tileBox, settings); | |||
List<SelectedGpxFile> visibleGPXFiles = new ArrayList<>(selectedGpxHelper.getSelectedGPXFiles()); | |||
List<SelectedGpxFile> visibleGPXFiles; | |||
if (getMapView().isCarView()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably getMapView().isCarView() we could move to method in base class
public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvider, | ||
IContextMenuProviderSelection, ContextMenuLayer.IMoveObjectProvider { | ||
|
||
private static final Log LOG = PlatformUtil.getLog(FavouritesLayer.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not FavouritesLayer
@@ -58,6 +58,6 @@ abstract class BaseOsmAndAndroidAutoScreen(carContext: CarContext) : Screen(carC | |||
} | |||
|
|||
companion object { | |||
private const val DEFAULT_CONTENT_LIMIT = 12 | |||
private const val DEFAULT_CONTENT_LIMIT = 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 100? Possible crash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use system value from ConstraintManager. This value limits that value to reduce probability of crash
if (collectionSize == contentLimit) { | ||
break | ||
} | ||
if (contentLimit < 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically yes. If ConstraintManager gives such value
@@ -111,6 +117,10 @@ public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) | |||
} | |||
} | |||
|
|||
public void setAndroidAutoFavouritePoints(@Nullable List<FavouritePoint> points) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad approach. Do not inject AA specific code in layers. For example you may introduce some custom data iterator and assign it to layer(s).
…ndapp/OsmAnd into 16632-show_items_on_group_selection
@@ -25,9 +34,35 @@ class TracksScreen( | |||
private val trackTab: TrackTab | |||
) : BaseOsmAndAndroidAutoScreen(carContext) { | |||
val gpxDbHelper: GpxDbHelper = app.gpxDbHelper | |||
var loadGpxFilesThread: Thread? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullable property must be initialized
@@ -48,14 +86,20 @@ class TracksScreen( | |||
} | |||
|
|||
private fun prepareTrackItems() { | |||
loadedGpxFiles.clear() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible concurrency
} | ||
} | ||
invalidate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it legal to call it in non-ui thread?
No description provided.