diff --git a/Mear/Mear.Android/MainActivity.cs b/Mear/Mear.Android/MainActivity.cs index 899ecfc..240c888 100644 --- a/Mear/Mear.Android/MainActivity.cs +++ b/Mear/Mear.Android/MainActivity.cs @@ -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(); + } } } \ No newline at end of file diff --git a/Mear/Mear.iOS/AppDelegate.cs b/Mear/Mear.iOS/AppDelegate.cs index 5ba3543..c91fccd 100644 --- a/Mear/Mear.iOS/AppDelegate.cs +++ b/Mear/Mear.iOS/AppDelegate.cs @@ -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()); diff --git a/Mear/Mear/App.xaml b/Mear/Mear/App.xaml index ec1a171..132d285 100644 --- a/Mear/Mear/App.xaml +++ b/Mear/Mear/App.xaml @@ -23,7 +23,7 @@ #a300ff #111111 - #222222 + #101010 #915dfa #222222 @@ -36,17 +36,7 @@ - - + diff --git a/Mear/Mear/Managers/ThemeManager.cs b/Mear/Mear/Managers/ThemeManager.cs index 2f80550..cb1f6dd 100644 --- a/Mear/Mear/Managers/ThemeManager.cs +++ b/Mear/Mear/Managers/ThemeManager.cs @@ -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"); diff --git a/Mear/Mear/Mear.csproj b/Mear/Mear/Mear.csproj index 34b6ada..33cac5a 100644 --- a/Mear/Mear/Mear.csproj +++ b/Mear/Mear/Mear.csproj @@ -14,6 +14,7 @@ + @@ -45,6 +46,9 @@ MSBuild:UpdateDesignTimeXaml + + MSBuild:UpdateDesignTimeXaml + MSBuild:UpdateDesignTimeXaml diff --git a/Mear/Mear/Playback/MearPlayer.cs b/Mear/Mear/Playback/MearPlayer.cs index be59961..adfb5c6 100644 --- a/Mear/Mear/Playback/MearPlayer.cs +++ b/Mear/Mear/Playback/MearPlayer.cs @@ -308,7 +308,7 @@ namespace Mear.Playback } private static async Task ResumeSong() { - await CrossMediaManager.Current.Play(); + await CrossMediaManager.Current.PlayPause(); } private static void ToggleRepeat() diff --git a/Mear/Mear/ViewModels/Popups/AboutViewModel.cs b/Mear/Mear/ViewModels/Popups/AboutViewModel.cs new file mode 100644 index 0000000..f4443b8 --- /dev/null +++ b/Mear/Mear/ViewModels/Popups/AboutViewModel.cs @@ -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 _contributorItems; + #endregion + + + #region Properties + public ObservableCollection ContributorItems + { + get => _contributorItems; + set => _contributorItems = value; + } + #endregion + + + #region Constructors + public AboutViewModel() + { + _contributorItems = new ObservableCollection(); + + 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 + } +} diff --git a/Mear/Mear/ViewModels/SettingsViewModel.cs b/Mear/Mear/ViewModels/SettingsViewModel.cs index 46bd398..0133ac4 100644 --- a/Mear/Mear/ViewModels/SettingsViewModel.cs +++ b/Mear/Mear/ViewModels/SettingsViewModel.cs @@ -14,6 +14,7 @@ namespace Mear.ViewModels { #region Fields private ObservableCollection _switchItems; + private ObservableCollection _selectionItems; #endregion @@ -23,6 +24,11 @@ namespace Mear.ViewModels get => _switchItems; set => _switchItems = value; } + public ObservableCollection SelectionItems + { + get => _selectionItems; + set => _selectionItems = value; + } #endregion @@ -30,8 +36,10 @@ namespace Mear.ViewModels public SettingsViewModel() { _switchItems = new ObservableCollection(); + _selectionItems = new ObservableCollection(); 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 } } diff --git a/Mear/Mear/Views/Popups/AboutPopup.cs b/Mear/Mear/Views/Popups/AboutPopup.cs new file mode 100644 index 0000000..6569c62 --- /dev/null +++ b/Mear/Mear/Views/Popups/AboutPopup.cs @@ -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 + } +} diff --git a/Mear/Mear/Views/Popups/AboutPopup.xaml b/Mear/Mear/Views/Popups/AboutPopup.xaml new file mode 100644 index 0000000..c34384f --- /dev/null +++ b/Mear/Mear/Views/Popups/AboutPopup.xaml @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/Mear/Mear/Views/SettingsPage.xaml b/Mear/Mear/Views/SettingsPage.xaml index a04875d..2dd81e0 100644 --- a/Mear/Mear/Views/SettingsPage.xaml +++ b/Mear/Mear/Views/SettingsPage.xaml @@ -11,41 +11,59 @@ + RowHeight="70" > - + - + - + - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/Mear/Mear/Views/SettingsPage.xaml.cs b/Mear/Mear/Views/SettingsPage.xaml.cs index 7769549..d0b3a75 100644 --- a/Mear/Mear/Views/SettingsPage.xaml.cs +++ b/Mear/Mear/Views/SettingsPage.xaml.cs @@ -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