Skip to content

Commit

Permalink
Update BasemapGallery and BasemapGalleryItem classes
Browse files Browse the repository at this point in the history
- In `BasemapGallery.Appearance.cs`, the visibility of `PART_LoadingScrim` Grid has been set to `False`.
- The `LoadBasemaps` method in `BasemapGallery.cs` and `BasemapGallery.Windows.cs` has been removed and its functionality has been moved to the `BasemapGallery_Loaded` method.
- In `BasemapGalleryItem.cs`, the `Equals` method has been updated to check for equality of `BaseLayers` count and existence of all layers in `Basemap` in the `other` object, in addition to the existing checks.
  • Loading branch information
prathameshnarkhede committed Jun 11, 2024
1 parent 68cee87 commit e06432b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static BasemapGallery()
</Style>
</Grid.Resources>
<CollectionView x:Name=""PART_InnerListView"" HorizontalOptions=""Fill"" VerticalOptions=""Fill"" SelectionMode=""Single"" BackgroundColor=""{{AppThemeBinding Light=#fff,Dark=#353535}}"" />
<Grid x:Name=""PART_LoadingScrim"">
<Grid x:Name=""PART_LoadingScrim"" IsVisible=""False"">
<Grid BackgroundColor=""{{AppThemeBinding Light=White, Dark=Black}}"" Opacity=""0.3"" />
<ActivityIndicator IsRunning=""True"" HorizontalOptions=""Center"" VerticalOptions=""Center"" />
</Grid>
Expand Down
13 changes: 1 addition & 12 deletions src/Toolkit/Toolkit.Maui/BasemapGallery/BasemapGallery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,10 @@ public BasemapGallery()

private void BasemapGallery_Loaded(object? sender, EventArgs e)
{
LoadBasemaps();
}

private void LoadBasemaps()
{
_controller.IsLoading = true;
if (AvailableBasemaps == null)
if (AvailableBasemaps is null)
{
_ = _controller.LoadFromDefaultPortal();
}
else
{
_controller.AvailableBasemaps = AvailableBasemaps;
}
_controller.IsLoading = false;
}

private void HandleControllerPropertyChanged(object? sender, PropertyChangedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,10 @@ public BasemapGallery()

private void BasemapGallery_Loaded(object? sender, RoutedEventArgs e)
{
LoadBasemaps();
}

private void LoadBasemaps()
{
_controller.IsLoading = true;
if (AvailableBasemaps == null)
if (AvailableBasemaps is null)
{
_ = _controller.LoadFromDefaultPortal();
}
else
{
_controller.AvailableBasemaps = AvailableBasemaps;
}
_controller.IsLoading = false;
}

private void HandleControllerPropertyChanged(object? sender, PropertyChangedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ internal bool EqualsBasemap(Basemap? other)
return false;
}

return other == Basemap || other.Name == Basemap?.Name
return other == Basemap || (Basemap.BaseLayers.Count == other.BaseLayers.Count
&& Basemap.BaseLayers.All(layer => other?.BaseLayers.FirstOrDefault(l => l.Name == layer.Name) is not null))
|| (other.Item?.ItemId != null && other.Item?.ItemId == Basemap?.Item?.ItemId)
|| (other.Uri != null && other.Uri == Basemap?.Uri);
}
Expand Down

0 comments on commit e06432b

Please sign in to comment.