Skip to content

Commit ceb06b7

Browse files
MAUI viewer UI enhancements (#1464)
1 parent 830d0a1 commit ceb06b7

File tree

7 files changed

+79
-27
lines changed

7 files changed

+79
-27
lines changed

src/MAUI/Maui.Samples/AppShell.xaml

+11-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,21 @@
66
xmlns:local="clr-namespace:ArcGIS"
77
Shell.FlyoutBehavior="Flyout"
88
Shell.TabBarIsVisible="False">
9+
<Shell.Resources>
10+
<Style BasedOn="{StaticResource BaseStyle}" TargetType="local:AppShell" />
11+
</Shell.Resources>
912
<Shell.FlyoutHeader>
10-
<Label Margin="0,5"
13+
<Label Margin="5"
14+
Padding="5"
1115
FontAttributes="Bold"
16+
FontSize="18"
17+
HeightRequest="{OnPlatform MacCatalyst=80,
18+
iOS=65,
19+
Default=40}"
1220
HorizontalTextAlignment="Center"
1321
Text="Categories"
14-
VerticalTextAlignment="Center" />
22+
TextColor="White"
23+
VerticalTextAlignment="End" />
1524
</Shell.FlyoutHeader>
1625
<Shell.FlyoutContent>
1726
<controls:CategoriesFlyoutContent />

src/MAUI/Maui.Samples/ArcGIS.Samples.Maui.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<MauiIcon Include="Resources\appicon.svg" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'" />
4242

4343
<!-- Splash Screen -->
44-
<MauiSplashScreen Include="Resources\arcgissdkglyphfg.svg" Color="#512BD4" BaseSize="128,128" />
44+
<MauiSplashScreen Include="Resources\arcgissdkglyphfg.svg" Color="#832FBC" BaseSize="128,128" />
4545

4646
<!-- Images -->
4747
<MauiImage Include="Images\*" />

src/MAUI/Maui.Samples/Controls/CategoriesFlyoutContent.xaml

+15-1
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,28 @@
1313
<CollectionView.ItemTemplate>
1414
<DataTemplate x:DataType="viewModels:FlyoutCategoryViewModel">
1515
<HorizontalStackLayout HeightRequest="40">
16+
<HorizontalStackLayout.Triggers>
17+
<DataTrigger Binding="{Binding IsSelected}"
18+
TargetType="HorizontalStackLayout"
19+
Value="True">
20+
<Setter Property="BackgroundColor" Value="Grey" />
21+
</DataTrigger>
22+
<DataTrigger Binding="{Binding IsSelected}"
23+
TargetType="HorizontalStackLayout"
24+
Value="False">
25+
<Setter Property="BackgroundColor" Value="Transparent" />
26+
</DataTrigger>
27+
</HorizontalStackLayout.Triggers>
1628
<Label Margin="20,0"
1729
FontFamily="calcite-ui-icons-24"
18-
FontSize="20"
30+
FontSize="25"
1931
Text="{Binding CategoryIcon}"
32+
TextColor="White"
2033
VerticalOptions="Center" />
2134
<Label Margin="15,0,0,0"
2235
FontSize="16"
2336
Text="{Binding CategoryName}"
37+
TextColor="White"
2438
VerticalOptions="Center" />
2539
</HorizontalStackLayout>
2640
</DataTemplate>

src/MAUI/Maui.Samples/Controls/CategoriesFlyoutContent.xaml.cs

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ private void CategoriesCollectionView_SelectionChanged(object sender, SelectionC
2121
try
2222
{
2323
var selectedCategory = e.CurrentSelection.FirstOrDefault() as FlyoutCategoryViewModel;
24+
var previousCategory = e.PreviousSelection.FirstOrDefault() as FlyoutCategoryViewModel;
25+
26+
if (previousCategory == null)
27+
previousCategory = _viewModel.Categories.FirstOrDefault();
28+
29+
selectedCategory.IsSelected = true;
30+
previousCategory.IsSelected = false;
31+
2432
_viewModel.CategorySelected(selectedCategory.CategoryName);
2533

2634
}

src/MAUI/Maui.Samples/Helpers/FeedbackPrompt.cs

+20-11
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,38 @@ public async static Task ShowFeedbackPromptAsync()
2222
{
2323
await Application.Current.MainPage.DisplayActionSheet("Open an issue on GitHub:", "Cancel", null, [BugReport, FeatureRequest]).ContinueWith((result) =>
2424
{
25-
string link;
2625
switch (result.Result)
2726
{
2827
case BugReport:
29-
var sb = new StringBuilder("https://github.com/Esri/arcgis-maps-sdk-dotnet-samples/issues/new?assignees=&labels=Type%3A+Bug&projects=&template=bug_report.yml&title=%5BBug%5D");
30-
if (SampleManager.Current.SelectedSample != null)
31-
{
32-
sb.Append("+&impacted-samples=");
33-
sb.Append(SampleManager.Current.SelectedSample.FormalName);
34-
}
35-
_ = Browser.Default.OpenAsync(new Uri(sb.ToString()), BrowserLaunchMode.SystemPreferred);
28+
OpenBugReport();
3629
break;
3730

3831
case FeatureRequest:
39-
link =
40-
"https://github.com/Esri/arcgis-maps-sdk-dotnet-samples/issues/new?assignees=&labels=Type%3A+Feature&projects=&template=feature_request.yml&title=%5BFeature%5D";
41-
_ = Browser.Default.OpenAsync(new Uri(link), BrowserLaunchMode.SystemPreferred);
32+
OpenFeatureRequest();
4233
break;
4334

4435
case "Cancel":
4536
break;
4637
}
4738
}, TaskScheduler.FromCurrentSynchronizationContext());
4839
}
40+
41+
public static void OpenBugReport()
42+
{
43+
var sb = new StringBuilder("https://github.com/Esri/arcgis-maps-sdk-dotnet-samples/issues/new?assignees=&labels=Type%3A+Bug&projects=&template=bug_report.yml&title=%5BBug%5D");
44+
if (SampleManager.Current.SelectedSample != null)
45+
{
46+
sb.Append("+&impacted-samples=");
47+
sb.Append(SampleManager.Current.SelectedSample.FormalName);
48+
}
49+
_ = Browser.Default.OpenAsync(new Uri(sb.ToString()), BrowserLaunchMode.SystemPreferred);
50+
}
51+
52+
public static void OpenFeatureRequest()
53+
{
54+
string link =
55+
"https://github.com/Esri/arcgis-maps-sdk-dotnet-samples/issues/new?assignees=&labels=Type%3A+Feature&projects=&template=feature_request.yml&title=%5BFeature%5D";
56+
_ = Browser.Default.OpenAsync(new Uri(link), BrowserLaunchMode.SystemPreferred);
57+
}
4958
}
5059
}

src/MAUI/Maui.Samples/Resources/Styles/Styles.xaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,10 @@
467467
</Style>
468468

469469
<Style x:Key="BaseStyle" TargetType="Element">
470-
<Setter Property="Shell.BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource Black}}" />
471-
<Setter Property="Shell.TitleColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource White}}" />
470+
<Setter Property="Shell.BackgroundColor" Value="#832FBC" />
471+
<Setter Property="Shell.ForegroundColor" Value="White" />
472+
<Setter Property="Shell.TitleColor" Value="White" />
473+
<Setter Property="Shell.FlyoutBackground" Value="#832FBC" />
472474
<Setter Property="Shell.DisabledColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
473475
<Setter Property="Shell.UnselectedColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
474476
<Setter Property="Shell.NavBarHasShadow" Value="False" />

src/MAUI/Maui.Samples/Views/SamplePage.xaml.cs

+20-10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#endif
1717

1818
using ArcGIS.Samples.Managers;
19+
using ArcGIS.Helpers;
1920
using ArcGIS.Samples.Shared.Models;
2021
using CommunityToolkit.Maui.Views;
2122
using Esri.ArcGISRuntime.Maui;
@@ -46,6 +47,8 @@ public partial class SamplePage : ContentPage
4647
public ObservableCollection<SourceCodeFile> SourceFiles { get; } = new ObservableCollection<SourceCodeFile>();
4748

4849
// Toolbar item titles as displayed in UI
50+
private const string BugReport = "Open a Bug Report";
51+
private const string FeatureRequest = "Request a Feature";
4952
private const string ViewOnGitHub = "View on GitHub";
5053
private const string SourceCode = "Source Code";
5154
private const string Description = "Description";
@@ -337,13 +340,6 @@ protected override bool OnBackButtonPressed()
337340

338341
private void SetToolbarItems()
339342
{
340-
// Feedback toolbar item should be placed last on desktop and first on mobile.
341-
var feedbackToolbarItem = new ToolbarItem
342-
{
343-
IconImageSource = "feedback.png",
344-
Text = "Feedback"
345-
};
346-
feedbackToolbarItem.Clicked += FeedbackToolbarItem_Clicked;
347343

348344
#if WINDOWS
349345
// Add the screenshot tool if enabled in settings.
@@ -385,17 +381,23 @@ private void SetToolbarItems()
385381
gitHubToolbarItem.Clicked += GitHubToolbarItem_Clicked;
386382
ToolbarItems.Add(gitHubToolbarItem);
387383

384+
// Feedback toolbar item should only be present on desktop platforms.
385+
var feedbackToolbarItem = new ToolbarItem
386+
{
387+
IconImageSource = "feedback.png",
388+
Text = "Feedback"
389+
};
390+
feedbackToolbarItem.Clicked += FeedbackToolbarItem_Clicked;
388391
ToolbarItems.Add(feedbackToolbarItem);
392+
// On mobile platforms, issue forms are accessible via the vertical handle.
389393
#else
390-
ToolbarItems.Add(feedbackToolbarItem);
391394
var verticalHandle = new ToolbarItem
392395
{
393396
IconImageSource = "verticalhandle.png"
394397
};
395398
verticalHandle.Clicked += VerticalHandle_Clicked;
396399
ToolbarItems.Add(verticalHandle);
397400
#endif
398-
399401
}
400402

401403
#if WINDOWS
@@ -417,7 +419,7 @@ private ToolbarItem PrepareScreenshotTool()
417419

418420
private async void VerticalHandle_Clicked(object sender, EventArgs e)
419421
{
420-
await DisplayActionSheet("Select a view", "Cancel", null, new string[] { LiveSample, Description, SourceCode, ViewOnGitHub }).ContinueWith((result) =>
422+
await DisplayActionSheet("", "Cancel", null, [LiveSample, Description, SourceCode, ViewOnGitHub, BugReport, FeatureRequest]).ContinueWith((result) =>
421423
{
422424
if (result.Result != "Cancel")
423425
{
@@ -438,6 +440,14 @@ private async void VerticalHandle_Clicked(object sender, EventArgs e)
438440
case ViewOnGitHub:
439441
_ = OpenGitHub();
440442
break;
443+
444+
case BugReport:
445+
FeedbackPrompt.OpenBugReport();
446+
break;
447+
448+
case FeatureRequest:
449+
FeedbackPrompt.OpenFeatureRequest();
450+
break;
441451
}
442452
}
443453
}, TaskScheduler.FromCurrentSynchronizationContext());

0 commit comments

Comments
 (0)