Added About popup page. and fixed issue where song was starting from the beginning when resuming. #14 #53
This commit is contained in:
@@ -8,6 +8,8 @@ using Android.Widget;
|
||||
using Android.OS;
|
||||
|
||||
using MediaManager;
|
||||
using Rg.Plugins.Popup;
|
||||
using Rg.Plugins.Popup.Pages;
|
||||
|
||||
namespace Mear.Droid
|
||||
{
|
||||
@@ -19,6 +21,8 @@ namespace Mear.Droid
|
||||
TabLayoutResource = Resource.Layout.Tabbar;
|
||||
ToolbarResource = Resource.Layout.Toolbar;
|
||||
|
||||
Popup.Init(this, savedInstanceState);
|
||||
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
|
||||
@@ -34,5 +38,17 @@ namespace Mear.Droid
|
||||
|
||||
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
public override void OnBackPressed()
|
||||
{
|
||||
if (Popup.SendBackPressed(base.OnBackPressed))
|
||||
{
|
||||
var demo = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
var demo = 0;
|
||||
}
|
||||
base.OnBackPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ namespace Mear.iOS
|
||||
//
|
||||
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
||||
{
|
||||
Rg.Plugins.Popup.Popup.Init();
|
||||
|
||||
global::Xamarin.Forms.Forms.Init();
|
||||
LoadApplication(new App());
|
||||
|
||||
|
||||
+2
-12
@@ -23,7 +23,7 @@
|
||||
<Color x:Key="EntryPlaceholderTextColor">#a300ff</Color>
|
||||
<Color x:Key="EntryBackgroundColor">#111111</Color>
|
||||
|
||||
<Color x:Key="SwitchBackgroundColor">#222222</Color>
|
||||
<Color x:Key="SwitchBackgroundColor">#101010</Color>
|
||||
<Color x:Key="SwitchActiveColor">#915dfa</Color>
|
||||
|
||||
<Color x:Key="SearchBarBackgroundColor">#222222</Color>
|
||||
@@ -36,17 +36,7 @@
|
||||
<Setter Property="BarBackgroundColor" Value="{DynamicResource NavigationBarColor}" />
|
||||
<Setter Property="BarTextColor" Value="{DynamicResource BarTextColor}" />
|
||||
</Style>
|
||||
<!--
|
||||
<Style TargetType="ContentPage">
|
||||
<Setter Property="BackgroundColor" Value="{DynamicResource NavigationPageBackgroundColor}" />
|
||||
<Setter Property="BackgroundColor" Value="Red" />
|
||||
</Style>
|
||||
-->
|
||||
<!--
|
||||
<Style TargetType="TabbedPage">
|
||||
<Setter Property="BarTextColor" Value="{DynamicResource TabbedBarTextColor}" />
|
||||
</Style>
|
||||
-->
|
||||
|
||||
<Style TargetType="StackLayout">
|
||||
<Setter Property="BackgroundColor" Value="{DynamicResource NavigationPageColor}" />
|
||||
</Style>
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Mear.Managers
|
||||
App.Current.Resources["EntryTextColor"] = Color.FromHex("#ffffff");
|
||||
App.Current.Resources["EntryPlaceholderTextColor"] = Color.FromHex("#a300ff");
|
||||
App.Current.Resources["EntryBackgroundColor"] = Color.FromHex("#111111");
|
||||
App.Current.Resources["SwitchBackgroundColor"] = Color.FromHex("#222222");
|
||||
App.Current.Resources["SwitchBackgroundColor"] = Color.FromHex("#101010");
|
||||
App.Current.Resources["SwitchActiveColor"] = Color.FromHex("#915dfa");
|
||||
App.Current.Resources["SearchBarBackgroundColor"] = Color.FromHex("#222222");
|
||||
App.Current.Resources["SearchBarCancelButtonColor"] = Color.FromHex("#9955fa");
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="Plugin.MediaManager" Version="0.6.7" />
|
||||
<PackageReference Include="RestSharp" Version="106.6.9" />
|
||||
<PackageReference Include="Rg.Plugins.Popup" Version="1.1.5.188" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.5.231" />
|
||||
<PackageReference Include="UXDivers.GorillaPlayer.SDK" Version="1.5.2" />
|
||||
<PackageReference Include="Xamarin.Forms" Version="4.0.0.482894" />
|
||||
@@ -45,6 +46,9 @@
|
||||
<EmbeddedResource Update="Views\MusicLibrary.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\Popups\AboutPopup.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Views\RegisterPage.xaml">
|
||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||
</EmbeddedResource>
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace Mear.Playback
|
||||
}
|
||||
private static async Task ResumeSong()
|
||||
{
|
||||
await CrossMediaManager.Current.Play();
|
||||
await CrossMediaManager.Current.PlayPause();
|
||||
}
|
||||
|
||||
private static void ToggleRepeat()
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
|
||||
using Mear.ViewModels;
|
||||
|
||||
namespace Mear.ViewModels.Popups
|
||||
{
|
||||
public class AboutViewModel : BaseViewModel
|
||||
{
|
||||
#region Fields
|
||||
private ObservableCollection<ContributorItem> _contributorItems;
|
||||
#endregion
|
||||
|
||||
|
||||
#region Properties
|
||||
public ObservableCollection<ContributorItem> ContributorItems
|
||||
{
|
||||
get => _contributorItems;
|
||||
set => _contributorItems = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Constructors
|
||||
public AboutViewModel()
|
||||
{
|
||||
_contributorItems = new ObservableCollection<ContributorItem>();
|
||||
|
||||
PopulateContributors();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
private void PopulateContributors()
|
||||
{
|
||||
_contributorItems.Clear();
|
||||
_contributorItems.Add(new ContributorItem
|
||||
{
|
||||
Contributor = "amazing-username",
|
||||
Role = "Author"
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Classes
|
||||
public class ContributorItem
|
||||
{
|
||||
public string Contributor { get; set; }
|
||||
public string Role { get; set; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ namespace Mear.ViewModels
|
||||
{
|
||||
#region Fields
|
||||
private ObservableCollection<SwitchItem> _switchItems;
|
||||
private ObservableCollection<SelectionItem> _selectionItems;
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -23,6 +24,11 @@ namespace Mear.ViewModels
|
||||
get => _switchItems;
|
||||
set => _switchItems = value;
|
||||
}
|
||||
public ObservableCollection<SelectionItem> SelectionItems
|
||||
{
|
||||
get => _selectionItems;
|
||||
set => _selectionItems = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -30,8 +36,10 @@ namespace Mear.ViewModels
|
||||
public SettingsViewModel()
|
||||
{
|
||||
_switchItems = new ObservableCollection<SwitchItem>();
|
||||
_selectionItems = new ObservableCollection<SelectionItem>();
|
||||
|
||||
PopulateSwitch();
|
||||
PopulateSelections();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -55,11 +63,23 @@ namespace Mear.ViewModels
|
||||
|
||||
return colorScheme;
|
||||
}
|
||||
|
||||
private void PopulateSwitch()
|
||||
{
|
||||
var colorScheme = RetrieveColorSchemeSwitch();
|
||||
_switchItems.Add(colorScheme);
|
||||
}
|
||||
private void PopulateSelections()
|
||||
{
|
||||
// TODO: When more selection options are added, will need to
|
||||
// come up with a better way but for now, this will suffice.
|
||||
_selectionItems.Clear();
|
||||
_selectionItems.Add(new SelectionItem
|
||||
{
|
||||
Title = "About",
|
||||
Description = "Information about the software"
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -69,6 +89,11 @@ namespace Mear.ViewModels
|
||||
public string Title { get; set; }
|
||||
public bool IsOn { get; set; }
|
||||
}
|
||||
public class SelectionItem
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Rg.Plugins.Popup;
|
||||
using Rg.Plugins.Popup.Pages;
|
||||
using Xamarin.Forms;
|
||||
|
||||
using Mear.ViewModels.Popups;
|
||||
|
||||
namespace Mear.Views.Popups
|
||||
{
|
||||
public partial class AboutPopup : Rg.Plugins.Popup.Pages.PopupPage
|
||||
{
|
||||
#region Fields
|
||||
private AboutViewModel _viewModel;
|
||||
#endregion
|
||||
|
||||
|
||||
#region Constructors
|
||||
public AboutPopup()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
BindingContext = _viewModel = new AboutViewModel();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
#region PopUpInit
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
}
|
||||
|
||||
protected override void OnDisappearing()
|
||||
{
|
||||
base.OnDisappearing();
|
||||
}
|
||||
|
||||
protected override void OnAppearingAnimationBegin()
|
||||
{
|
||||
base.OnAppearingAnimationBegin();
|
||||
}
|
||||
|
||||
protected override void OnAppearingAnimationEnd()
|
||||
{
|
||||
base.OnAppearingAnimationEnd();
|
||||
}
|
||||
|
||||
protected override void OnDisappearingAnimationBegin()
|
||||
{
|
||||
base.OnDisappearingAnimationBegin();
|
||||
}
|
||||
|
||||
protected override void OnDisappearingAnimationEnd()
|
||||
{
|
||||
base.OnDisappearingAnimationEnd();
|
||||
}
|
||||
|
||||
protected override Task OnAppearingAnimationBeginAsync()
|
||||
{
|
||||
return base.OnAppearingAnimationBeginAsync();
|
||||
}
|
||||
|
||||
protected override Task OnAppearingAnimationEndAsync()
|
||||
{
|
||||
return base.OnAppearingAnimationEndAsync();
|
||||
}
|
||||
|
||||
protected override Task OnDisappearingAnimationBeginAsync()
|
||||
{
|
||||
return base.OnDisappearingAnimationBeginAsync();
|
||||
}
|
||||
|
||||
protected override Task OnDisappearingAnimationEndAsync()
|
||||
{
|
||||
return base.OnDisappearingAnimationEndAsync();
|
||||
}
|
||||
|
||||
|
||||
protected override bool OnBackButtonPressed()
|
||||
{
|
||||
return base.OnBackButtonPressed();
|
||||
}
|
||||
|
||||
protected override bool OnBackgroundClicked()
|
||||
{
|
||||
return base.OnBackgroundClicked();
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<pages:PopupPage
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
|
||||
xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
|
||||
x:Class="Mear.Views.Popups.AboutPopup"
|
||||
xmlns:vm="clr-namespace:Mear.ViewModels">
|
||||
<pages:PopupPage.Animation>
|
||||
<animations:ScaleAnimation
|
||||
PositionIn="Center"
|
||||
PositionOut="Center"
|
||||
ScaleIn="1.2"
|
||||
ScaleOut="0.8"
|
||||
DurationIn="400"
|
||||
DurationOut="300"
|
||||
EasingIn="SinOut"
|
||||
EasingOut="SinIn"
|
||||
HasBackgroundAnimation="True"/>
|
||||
</pages:PopupPage.Animation>
|
||||
<StackLayout
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
Padding="40, 40, 40, 40">
|
||||
<Label
|
||||
Text="Mear"/>
|
||||
<Label
|
||||
Text="Pre-developement release version" />
|
||||
<ListView x:Name="ContributorsView"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Center"
|
||||
ItemsSource="{Binding ContributorItems}"
|
||||
HasUnevenRows="True" >
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label Text="{Binding Contributor}" />
|
||||
<Label Text="{Binding Role}" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
</pages:PopupPage>
|
||||
@@ -11,41 +11,59 @@
|
||||
<ContentPage.Content>
|
||||
<StackLayout>
|
||||
<ListView x:Name="Sliders"
|
||||
VerticalOptions="Start"
|
||||
ItemsSource="{Binding SwitchItems}"
|
||||
HasUnevenRows="False"
|
||||
RowHeight="75" >
|
||||
RowHeight="70" >
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<Grid MinimumHeightRequest="80" Padding="5">
|
||||
<Grid Padding="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackLayout Grid.Row="0" Grid.Column="0"
|
||||
HorizontalOptions="FillAndExpand"
|
||||
MinimumWidthRequest="300"
|
||||
Orientation="Vertical">
|
||||
<Label Text="{Binding Title}"
|
||||
d:Text="{Binding .}"
|
||||
LineBreakMode="NoWrap"
|
||||
FontSize="15" />
|
||||
</StackLayout>
|
||||
<StackLayout Grid.Row="0" Grid.Column="1"
|
||||
MinimumWidthRequest="120">
|
||||
<Switch IsToggled="{Binding On}"
|
||||
MinimumHeightRequest="120"
|
||||
Toggled="Switch_Toggled" />
|
||||
</StackLayout>
|
||||
<Label Text="{Binding Title}"
|
||||
Grid.Row="0" Grid.Column="0"
|
||||
MinimumHeightRequest="70"
|
||||
d:Text="{Binding .}"
|
||||
LineBreakMode="NoWrap"
|
||||
FontSize="22" />
|
||||
<Switch IsToggled="{Binding IsOn}"
|
||||
Grid.Row="0" Grid.Column="1"
|
||||
Scale="1.25"
|
||||
Toggled="Switch_Toggled" />
|
||||
</Grid>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<ListView x:Name="SelectionOptions"
|
||||
VerticalOptions="Start"
|
||||
ItemsSource="{Binding SelectionItems}"
|
||||
HasUnevenRows="False"
|
||||
ItemSelected="SelectionOptions_ItemSelected"
|
||||
RowHeight="70" >
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ViewCell>
|
||||
<StackLayout>
|
||||
<Label Text="{Binding Title}"
|
||||
d:Text="{Binding .}"
|
||||
LineBreakMode="NoWrap"
|
||||
FontSize="22" />
|
||||
<Label Text="{Binding Description}"
|
||||
d:Text="{Binding .}"
|
||||
LineBreakMode="WordWrap"
|
||||
FontSize="18" />
|
||||
</StackLayout>
|
||||
</ViewCell>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackLayout>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
||||
@@ -4,9 +4,12 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Rg.Plugins.Popup.Extensions;
|
||||
using Rg.Plugins.Popup.Services;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Xaml;
|
||||
|
||||
using Mear.Views.Popups;
|
||||
using Mear.ViewModels;
|
||||
|
||||
namespace Mear.Views
|
||||
@@ -33,8 +36,25 @@ namespace Mear.Views
|
||||
#region Events
|
||||
private void Switch_Toggled(object sender, ToggledEventArgs e)
|
||||
{
|
||||
var switchItem = (Switch)sender;
|
||||
bool? isDarkTheme = e.Value;
|
||||
_viewModel.ToggleTheme(isDarkTheme);
|
||||
|
||||
}
|
||||
private async void SelectionOptions_ItemSelected(object sender, SelectedItemChangedEventArgs e)
|
||||
{
|
||||
var item = ((sender as ListView).SelectedItem) as SettingsViewModel.SelectionItem;
|
||||
try
|
||||
{
|
||||
if (item.Title.Equals("About"))
|
||||
{
|
||||
await PopupNavigation.Instance.PushAsync(new AboutPopup(), false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var msg = ex.Message;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user