-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
569 additions
and
4 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
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,3 +1,7 @@ | ||
global using MauiTubePlayer.Views; | ||
global using System.Text.Json.Serialization; | ||
global using MauiTubePlayer.Models; | ||
global using MauiTubePlayer.Models; | ||
global using Maui.Apps.Framework.MVVM; | ||
global using CommunityToolkit.Mvvm.Input; | ||
global using MauiTubePlayer.IServices; | ||
global using Maui.Apps.Framework.UI; |
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
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
32 changes: 32 additions & 0 deletions
32
src/MauiTubePlayer/ViewControls/Common/ErrorIndicator.xaml
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,32 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<VerticalStackLayout | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="MauiTubePlayer.ViewControls.Common.ErrorIndicator" | ||
IsVisible="False" | ||
Padding="48,12"> | ||
|
||
<Image | ||
x:Name="imgError" | ||
Source="{Binding ErrorImage, Mode=OneWay}" | ||
HorizontalOptions="Center" | ||
WidthRequest="64" | ||
HeightRequest="64" | ||
Aspect="AspectFit"/> | ||
|
||
<Label | ||
Margin="0,12,0,0" | ||
Text="Uh-Oh!" | ||
Style="{StaticResource MediumLightText18}" | ||
HorizontalOptions="Center" | ||
HorizontalTextAlignment="Center" /> | ||
|
||
<Label | ||
x:Name="lblErrorText" | ||
Style="{StaticResource RegularLightText14}" | ||
LineBreakMode="WordWrap" | ||
HorizontalOptions="Center" | ||
HorizontalTextAlignment="Center" /> | ||
|
||
</VerticalStackLayout> | ||
|
68 changes: 68 additions & 0 deletions
68
src/MauiTubePlayer/ViewControls/Common/ErrorIndicator.xaml.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,68 @@ | ||
namespace MauiTubePlayer.ViewControls.Common; | ||
|
||
public partial class ErrorIndicator : VerticalStackLayout | ||
{ | ||
//Bindable Properties | ||
|
||
public static readonly BindableProperty IsErrorProperty = BindableProperty.Create( | ||
"IsError", | ||
typeof(bool), | ||
typeof(ErrorIndicator), | ||
false, | ||
BindingMode.OneWay, | ||
null, | ||
SetIsError); | ||
|
||
public bool IsError | ||
{ | ||
get => (bool)this.GetValue(IsErrorProperty); | ||
set => this.SetValue(IsErrorProperty, value); | ||
} | ||
|
||
private static void SetIsError(BindableObject bindable, object oldValue, object newValue) => | ||
(bindable as ErrorIndicator).IsVisible = (bool)newValue; | ||
|
||
|
||
public static readonly BindableProperty ErrorTextProperty = BindableProperty.Create( | ||
"ErrorText", | ||
typeof(string), | ||
typeof(ErrorIndicator), | ||
string.Empty, | ||
BindingMode.OneWay, | ||
null, | ||
SetErrorText); | ||
|
||
public string ErrorText | ||
{ | ||
get => (string)this.GetValue(ErrorTextProperty); | ||
set => this.SetValue(ErrorTextProperty, value); | ||
} | ||
|
||
private static void SetErrorText(BindableObject bindable, object oldValue, object newValue) => | ||
(bindable as ErrorIndicator).lblErrorText.Text = (string)newValue; | ||
|
||
|
||
public static readonly BindableProperty ErrorImageProperty = BindableProperty.Create( | ||
"ErrorImage", | ||
typeof(ImageSource), | ||
typeof(ErrorIndicator), | ||
null, | ||
BindingMode.OneWay, | ||
null, | ||
SetErrorImage); | ||
|
||
public ImageSource ErrorImage | ||
{ | ||
get => (ImageSource)this.GetValue(ErrorImageProperty); | ||
set => this.SetValue(ErrorImageProperty, value); | ||
} | ||
|
||
private static void SetErrorImage(BindableObject bindable, object oldValue, object newValue) => | ||
(bindable as ErrorIndicator).imgError.Source = (ImageSource)newValue; | ||
|
||
|
||
public ErrorIndicator() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/MauiTubePlayer/ViewControls/Common/LoadingIndicator.xaml
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,27 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<VerticalStackLayout | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="MauiTubePlayer.ViewControls.Common.LoadingIndicator" | ||
IsVisible="False" | ||
Padding="48,12" | ||
Spacing="4"> | ||
|
||
<ActivityIndicator | ||
x:Name="actIndicator" | ||
IsRunning="False" | ||
WidthRequest="44" | ||
HeightRequest="44" | ||
HorizontalOptions="Center" | ||
Color="{StaticResource LightColor}" | ||
Scale="{OnPlatform iOS=1.3, Android=1.0}" /> | ||
|
||
<Label | ||
x:Name="lblLoadingText" | ||
Style="{StaticResource RegularLightText14}" | ||
LineBreakMode="WordWrap" | ||
HorizontalOptions="Center" | ||
HorizontalTextAlignment="Center" /> | ||
|
||
</VerticalStackLayout> | ||
|
53 changes: 53 additions & 0 deletions
53
src/MauiTubePlayer/ViewControls/Common/LoadingIndicator.xaml.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,53 @@ | ||
namespace MauiTubePlayer.ViewControls.Common; | ||
|
||
public partial class LoadingIndicator : VerticalStackLayout | ||
{ | ||
//Bindable Properties | ||
|
||
public static readonly BindableProperty IsBusyProperty = BindableProperty.Create( | ||
"IsBusy", | ||
typeof(bool), | ||
typeof(LoadingIndicator), | ||
false, | ||
BindingMode.OneWay, | ||
null, | ||
SetIsBusy); | ||
|
||
public bool IsBusy | ||
{ | ||
get => (bool)this.GetValue(IsBusyProperty); | ||
set => this.SetValue(IsBusyProperty, value); | ||
} | ||
|
||
private static void SetIsBusy(BindableObject bindable, object oldValue, object newValue) | ||
{ | ||
LoadingIndicator control = bindable as LoadingIndicator; | ||
|
||
control.IsVisible = (bool)newValue; | ||
control.actIndicator.IsRunning = (bool)newValue; | ||
} | ||
|
||
|
||
public static readonly BindableProperty LoadingTextProperty = BindableProperty.Create( | ||
"LoadingText", | ||
typeof(string), | ||
typeof(LoadingIndicator), | ||
string.Empty, | ||
BindingMode.OneWay, | ||
null, | ||
SetLoadingText); | ||
|
||
public string LoadingText | ||
{ | ||
get => (string)this.GetValue(LoadingTextProperty); | ||
set => this.SetValue(LoadingTextProperty, value); | ||
} | ||
|
||
private static void SetLoadingText(BindableObject bindable, object oldValue, object newValue) => | ||
(bindable as LoadingIndicator).lblLoadingText.Text = (string)newValue; | ||
|
||
public LoadingIndicator() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
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,24 @@ | ||
namespace MauiTubePlayer.ViewModels.Base; | ||
|
||
public partial class AppViewModelBase : ViewModelBase | ||
{ | ||
public INavigation NavigationService { get; set; } | ||
public Page PageService { get; set; } | ||
|
||
protected IApiService _appApiService { get; set; } | ||
|
||
public AppViewModelBase(IApiService appApiService) :base() | ||
{ | ||
_appApiService = appApiService; | ||
} | ||
|
||
[RelayCommand] | ||
private async Task NavigateBack() => | ||
await NavigationService.PopAsync(); | ||
|
||
[RelayCommand] | ||
private async Task CloseModal() => | ||
await NavigationService.PopModalAsync(); | ||
|
||
} | ||
|
Oops, something went wrong.