-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed image paths and removed android nav bar
- Loading branch information
Ben Harnett
committed
Nov 27, 2023
1 parent
c87dfe3
commit 112a215
Showing
138 changed files
with
821 additions
and
890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,154 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Shell | ||
x:Class="RightToAskClient.Maui.AppShell" | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="clr-namespace:RightToAskClient.Maui" | ||
Shell.FlyoutBehavior="Disabled"> | ||
|
||
<ShellContent | ||
Title="Home" | ||
ContentTemplate="{DataTemplate local:MainPage}" | ||
Route="MainPage" /> | ||
|
||
</Shell> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:rta="clr-namespace:RightToAskClient.Maui" | ||
xmlns:local="clr-namespace:RightToAskClient.Maui.Views" | ||
xmlns:helpers="clr-namespace:RightToAskClient.Maui.Helpers;assembly=RightToAskClient.Maui" | ||
xmlns:extensions="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" | ||
x:Class="RightToAskClient.Maui.Views.AppShell" | ||
|
||
FlyoutBackgroundColor="{AppThemeBinding Light={StaticResource WindowBackgroundColor}, Dark={StaticResource WindowBackgroundColorDark}}"> | ||
|
||
<!-- | ||
The overall app visual hierarchy is defined here, along with navigation. | ||
https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/ | ||
--> | ||
|
||
<Shell.Resources> | ||
<ResourceDictionary> | ||
<Style x:Key="BaseStyle" TargetType="Element"> | ||
<Setter Property="Shell.BackgroundColor" Value="{StaticResource Primary}" /> | ||
<Setter Property="Shell.ForegroundColor" Value="White" /> | ||
<Setter Property="Shell.TitleColor" Value="White" /> | ||
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" /> | ||
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" /> | ||
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource Primary}" /> | ||
<Setter Property="Shell.TabBarForegroundColor" Value="White"/> | ||
<Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/> | ||
<Setter Property="Shell.TabBarTitleColor" Value="White"/> | ||
</Style> | ||
<Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" /> | ||
<Style TargetType="FlyoutItem" BasedOn="{StaticResource BaseStyle}" /> | ||
|
||
<!-- | ||
Default Styles for all Flyout Items | ||
https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/flyout#flyoutitem-and-menuitem-style-classes | ||
--> | ||
<Style Class="FlyoutItemLabelStyle" TargetType="Label"> | ||
<Setter Property="TextColor" Value="White" /> | ||
</Style> | ||
<Style Class="FlyoutItemLayoutStyle" TargetType="Layout" ApplyToDerivedTypes="True"> | ||
<Setter Property="VisualStateManager.VisualStateGroups"> | ||
<VisualStateGroupList> | ||
<VisualStateGroup x:Name="CommonStates"> | ||
<VisualState x:Name="Normal"> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="{x:OnPlatform WinUI=Transparent, iOS=White}" /> | ||
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{StaticResource Primary}" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
<VisualState x:Name="Selected"> | ||
<VisualState.Setters> | ||
<Setter Property="BackgroundColor" Value="{StaticResource Primary}" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateGroupList> | ||
</Setter> | ||
</Style> | ||
|
||
<!-- | ||
Custom Style you can apply to any Flyout Item | ||
--> | ||
<Style Class="MenuItemLayoutStyle" TargetType="Layout" ApplyToDerivedTypes="True"> | ||
<Setter Property="VisualStateManager.VisualStateGroups"> | ||
<VisualStateGroupList> | ||
<VisualStateGroup x:Name="CommonStates"> | ||
<VisualState x:Name="Normal"> | ||
<VisualState.Setters> | ||
<Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{StaticResource Primary}" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateGroupList> | ||
</Setter> | ||
</Style> | ||
</ResourceDictionary> | ||
</Shell.Resources> | ||
|
||
<!-- | ||
When the Flyout is visible this defines the content to display in the flyout. | ||
FlyoutDisplayOptions="AsMultipleItems" will create a separate flyout item for each child element | ||
https://docs.microsoft.com/dotnet/api/xamarin.forms.shellgroupitem.flyoutdisplayoptions?view=xamarin-forms | ||
--> | ||
|
||
<FlyoutItem Title="Home" FlyoutIcon="home4.png"> | ||
<ShellContent Route="ReadingPage" ContentTemplate="{DataTemplate local:ReadingPage}" /> | ||
</FlyoutItem> | ||
<FlyoutItem Title="My questions" FlyoutIcon="emu_75.png"> | ||
<ShellContent Route="ReadingPageByQuestionWriter" ContentTemplate="{DataTemplate local:ReadingPage}" /> | ||
</FlyoutItem> | ||
<FlyoutItem Title="Account" FlyoutIcon="info_48.png"> | ||
<ShellContent Route="Account" ContentTemplate="{DataTemplate local:AccountPage}" /> | ||
</FlyoutItem> | ||
<FlyoutItem Title="How To"> | ||
<ShellContent Route="HowToPublishPage" ContentTemplate="{DataTemplate local:HowToPublishPage}" /> | ||
</FlyoutItem> | ||
<FlyoutItem Title="About" FlyoutIcon="emu_75.png"> | ||
<ShellContent Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" /> | ||
</FlyoutItem> | ||
|
||
<!-- When the Flyout is visible this will be a menu item you can tie a click behavior to --> | ||
<!--<MenuItem Text="Logout" StyleClass="MenuItemLayoutStyle" Clicked="OnMenuItemClicked"> | ||
</MenuItem>--> | ||
|
||
<!-- | ||
TabBar lets you define content that won't show up in a flyout menu. When this content is active | ||
the flyout menu won't be available. This is useful for creating areas of the application where | ||
you don't want users to be able to navigate away from. If you would like to navigate to this | ||
content you can do so by calling | ||
await Shell.Current.GoToAsync("//LoginPage"); | ||
--> | ||
<!-- | ||
<TabBar> | ||
<ShellContent Route="ReadingPage" ContentTemplate="{DataTemplate local:MainPage}" /> | ||
</TabBar> | ||
<TabBar> | ||
<ShellContent Route="MainPage" ContentTemplate="{DataTemplate local:MainPage}" /> | ||
</TabBar> --> | ||
|
||
<!-- Optional Templates | ||
// These may be provided inline as below or as separate classes. | ||
// This header appears at the top of the Flyout. | ||
// https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/flyout#flyout-header | ||
<Shell.FlyoutHeaderTemplate> | ||
<DataTemplate> | ||
<Grid>ContentHere</Grid> | ||
</DataTemplate> | ||
</Shell.FlyoutHeaderTemplate> | ||
// ItemTemplate is for ShellItems as displayed in a Flyout | ||
// https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/flyout#define-flyoutitem-appearance | ||
<Shell.ItemTemplate> | ||
<DataTemplate> | ||
<ContentView> | ||
Bindable Properties: Title, Icon | ||
</ContentView> | ||
</DataTemplate> | ||
</Shell.ItemTemplate> | ||
// MenuItemTemplate is for MenuItems as displayed in a Flyout | ||
// https://docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/shell/flyout#define-menuitem-appearance | ||
<Shell.MenuItemTemplate> | ||
<DataTemplate> | ||
<ContentView> | ||
Bindable Properties: Text, Icon | ||
</ContentView> | ||
</DataTemplate> | ||
</Shell.MenuItemTemplate> | ||
--> | ||
|
||
</Shell> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,45 @@ | ||
namespace RightToAskClient.Maui | ||
using System; | ||
using System.Diagnostics; | ||
using RightToAskClient.Maui.Models; | ||
using RightToAskClient.Maui.ViewModels; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui; | ||
|
||
namespace RightToAskClient.Maui.Views | ||
{ | ||
public partial class AppShell : Shell | ||
public partial class AppShell : Microsoft.Maui.Controls.Shell | ||
{ | ||
public AppShell() | ||
{ | ||
InitializeComponent(); | ||
Routing.RegisterRoute(nameof(QuestionAskerPage), typeof(QuestionAskerPage)); | ||
Routing.RegisterRoute(nameof(QuestionDetailPage), typeof(QuestionDetailPage)); | ||
Routing.RegisterRoute(nameof(RegisterAccountPage), typeof(RegisterAccountPage)); | ||
Routing.RegisterRoute(nameof(FindMPsPage), typeof(FindMPsPage)); | ||
Routing.RegisterRoute(nameof(OtherUserProfilePage), typeof(OtherUserProfilePage)); | ||
Routing.RegisterRoute(nameof(QuestionAnswererPage), typeof(QuestionAnswererPage)); | ||
Routing.RegisterRoute(nameof(AdvancedSearchFiltersPage), typeof(AdvancedSearchFiltersPage)); | ||
Routing.RegisterRoute(nameof(MPRegistrationVerificationPage), typeof(MPRegistrationVerificationPage)); | ||
Routing.RegisterRoute(nameof(HowAnsweredOptionPage), typeof(HowAnsweredOptionPage)); | ||
Routing.RegisterRoute(nameof(QuestionBackgroundPage), typeof(QuestionBackgroundPage)); | ||
Routing.RegisterRoute(nameof(SelectableListPage), typeof(SelectableListPage)); | ||
Routing.RegisterRoute(nameof(ReportQuestionPage), typeof(ReportQuestionPage)); | ||
Routing.RegisterRoute(nameof(CodeOfConductPage), typeof(CodeOfConductPage)); | ||
// Routing.RegisterRoute(nameof(FindMPsPage), typeof(FindMPsPage)); | ||
} | ||
|
||
protected override void OnNavigating(ShellNavigatingEventArgs args) | ||
{ | ||
base.OnNavigating(args); | ||
if (args.Target.Location.OriginalString.ToLower().Contains("account")) | ||
{ | ||
AccountPageExchanger.Registration = IndividualParticipant.getInstance().ProfileData.RegistrationInfo; | ||
} | ||
|
||
if (args.Target.Location.OriginalString.ToLower().Contains("readingpagebyquestionwriter")) | ||
{ | ||
ReadingPageExchanger.ByQuestionWriter = true; | ||
} | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
RightToAskClient/RightToAskClient.Maui/Helpers/HyperLinkSpan.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Android.Content.Res; | ||
using RightToAskClient.Maui.Resx; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace RightToAskClient.Maui.Helpers | ||
{ | ||
//https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/label?view=net-maui-8.0#create-a-hyperlink | ||
public class HyperlinkSpan : Span | ||
{ | ||
public static readonly BindableProperty UrlProperty = | ||
BindableProperty.Create(nameof(Url), typeof(string), typeof(HyperlinkSpan), null); | ||
|
||
public string Url | ||
{ | ||
get { return (string)GetValue(UrlProperty); } | ||
set { SetValue(UrlProperty, value); } | ||
} | ||
|
||
public HyperlinkSpan() | ||
{ | ||
TextDecorations = TextDecorations.Underline; | ||
TextColor = (Color)Application.Current.Resources["UrlTextColorLightMode"]; | ||
GestureRecognizers.Add(new TapGestureRecognizer | ||
{ | ||
// Launcher.OpenAsync is provided by Essentials. | ||
Command = new Command(async () => await OpenUrl(Url)) | ||
}); | ||
} | ||
|
||
//TODO: test on real device | ||
public async Task OpenUrl(string url) | ||
{ | ||
await Launcher.OpenAsync(url); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.