diff --git a/MPfm/MPfm.MVP/Navigation/MobileNavigationManager.cs b/MPfm/MPfm.MVP/Navigation/MobileNavigationManager.cs index 56f4a78b..f21fac96 100644 --- a/MPfm/MPfm.MVP/Navigation/MobileNavigationManager.cs +++ b/MPfm/MPfm.MVP/Navigation/MobileNavigationManager.cs @@ -78,7 +78,7 @@ public abstract class MobileNavigationManager public abstract void AddTab(MobileNavigationTabType type, string title, IBaseView view); public abstract void PushTabView(MobileNavigationTabType type, IBaseView view); public abstract void PushDialogView(string viewTitle, IBaseView view); - public abstract void PushDialogSubview(string viewTitle, IBaseView view); + public abstract void PushDialogSubview(string parentViewTitle, IBaseView view); public abstract void PushPlayerSubview(IPlayerView playerView, IBaseView view); public virtual void Start() @@ -458,6 +458,26 @@ public virtual IEqualizerPresetsView CreateEqualizerPresetsView() }; return _equalizerPresetsView; } + + public virtual IEqualizerPresetDetailsView CreateEqualizerPresetDetailsView() + { + // The view invokes the OnViewReady action when the view is ready. This means the presenter can be created and bound to the view. + Action onViewReady = (view) => + { + _equalizerPresetDetailsPresenter = Bootstrapper.GetContainer().Resolve(); + _equalizerPresetDetailsPresenter.BindView((IEqualizerPresetDetailsView)view); + }; + + // Create view and manage view destruction + _equalizerPresetDetailsView = Bootstrapper.GetContainer().Resolve(new NamedParameterOverloads() { { "onViewReady", onViewReady } }); + _equalizerPresetDetailsView.OnViewDestroy = (view) => + { + _equalizerPresetDetailsView = null; + _equalizerPresetDetailsPresenter = null; + }; + return _equalizerPresetDetailsView; + } + } public enum MobileNavigationTabType diff --git a/MPfm/MPfm.MVP/Presenters/EqualizerPresetsPresenter.cs b/MPfm/MPfm.MVP/Presenters/EqualizerPresetsPresenter.cs index 4de176b3..35496f11 100644 --- a/MPfm/MPfm.MVP/Presenters/EqualizerPresetsPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/EqualizerPresetsPresenter.cs @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with MPfm. If not, see . +using MPfm.MVP.Navigation; using MPfm.MVP.Presenters.Interfaces; using MPfm.MVP.Services.Interfaces; using MPfm.MVP.Views; @@ -23,46 +24,52 @@ namespace MPfm.MVP.Presenters { public class EqualizerPresetsPresenter : BasePresenter, IEqualizerPresetsPresenter { - readonly IPlayerService playerService; + readonly MobileNavigationManager _navigationManager; + readonly IPlayerService _playerService; - public EqualizerPresetsPresenter(IPlayerService playerService) + public EqualizerPresetsPresenter(MobileNavigationManager navigationManager, IPlayerService playerService) { - // Set properties - this.playerService = playerService; + _navigationManager = navigationManager; + _playerService = playerService; } - public void SetEQParam(int index, float value) + public override void BindView(IEqualizerPresetsView view) { - // Set EQ and update UI - playerService.UpdateEQBand(index, value, true); - View.UpdateFader(index, value); + base.BindView(view); + + view.OnBypassEqualizer = BypassEqualizer; + view.OnAddPreset = AddPreset; + view.OnLoadPreset = LoadPreset; + view.OnEditPreset = EditPreset; + view.OnDeletePreset = DeletePreset; + + RefreshPresets(); } - public void BypassEQ() + private void BypassEqualizer() { - playerService.BypassEQ(); + _playerService.BypassEQ(); } - public void AutoLevel() + private void AddPreset() { + var view = _navigationManager.CreateEqualizerPresetDetailsView(); + _navigationManager.PushDialogSubview("EqualizerPresets", view); } - public void Reset() + private void LoadPreset(string presetName) { - playerService.ResetEQ(); - for (int a = 0; a < 18; a++) - View.UpdateFader(a, 0); } - public void LoadPreset(string presetName) + private void EditPreset(string presetName) { } - public void SavePreset(string presetName) + private void DeletePreset(string presetName) { } - public void DeletePreset(string presetName) + private void RefreshPresets() { } } diff --git a/MPfm/MPfm.MVP/Presenters/Interfaces/IEqualizerPresetsPresenter.cs b/MPfm/MPfm.MVP/Presenters/Interfaces/IEqualizerPresetsPresenter.cs index f785aad0..31ddab59 100644 --- a/MPfm/MPfm.MVP/Presenters/Interfaces/IEqualizerPresetsPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/Interfaces/IEqualizerPresetsPresenter.cs @@ -21,14 +21,5 @@ namespace MPfm.MVP.Presenters.Interfaces { public interface IEqualizerPresetsPresenter : IBasePresenter { - void SetEQParam(int index, float value); - void BypassEQ(); - void AutoLevel(); - void Reset(); - - void LoadPreset(string presetName); - void SavePreset(string presetName); - void DeletePreset(string presetName); } } - diff --git a/MPfm/MPfm.MVP/Presenters/MobileOptionsMenuPresenter.cs b/MPfm/MPfm.MVP/Presenters/MobileOptionsMenuPresenter.cs index a2755d35..48e1703d 100644 --- a/MPfm/MPfm.MVP/Presenters/MobileOptionsMenuPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/MobileOptionsMenuPresenter.cs @@ -70,13 +70,13 @@ private void OnItemClick(MobileOptionsMenuType menuType) case MobileOptionsMenuType.UpdateLibrary: { var view = _navigationManager.CreateUpdateLibraryView(); - _navigationManager.PushDialogView("Update Library", view); + _navigationManager.PushDialogView("UpdateLibrary", view); break; } case MobileOptionsMenuType.EqualizerPresets: { var view = _navigationManager.CreateEqualizerPresetsView(); - _navigationManager.PushDialogView("Equalizer Presets", view); + _navigationManager.PushDialogView("EqualizerPresets", view); break; } case MobileOptionsMenuType.Preferences: diff --git a/MPfm/MPfm.MVP/Views/IEqualizerPresetDetailsView.cs b/MPfm/MPfm.MVP/Views/IEqualizerPresetDetailsView.cs index 99bd4b4d..0b9eaa44 100644 --- a/MPfm/MPfm.MVP/Views/IEqualizerPresetDetailsView.cs +++ b/MPfm/MPfm.MVP/Views/IEqualizerPresetDetailsView.cs @@ -22,6 +22,5 @@ namespace MPfm.MVP.Views public interface IEqualizerPresetDetailsView : IBaseView { void UpdateFader(int index, float value); - void UpdatePresetList(IEnumerable presets); } } diff --git a/MPfm/MPfm.MVP/Views/IEqualizerPresetsView.cs b/MPfm/MPfm.MVP/Views/IEqualizerPresetsView.cs index 932c7ec2..f61a4920 100644 --- a/MPfm/MPfm.MVP/Views/IEqualizerPresetsView.cs +++ b/MPfm/MPfm.MVP/Views/IEqualizerPresetsView.cs @@ -15,13 +15,19 @@ // You should have received a copy of the GNU General Public License // along with MPfm. If not, see . +using System; using System.Collections.Generic; namespace MPfm.MVP.Views { public interface IEqualizerPresetsView : IBaseView { - void UpdateFader(int index, float value); + Action OnBypassEqualizer { get; set; } + Action OnAddPreset { get; set; } + Action OnLoadPreset { get; set; } + Action OnEditPreset { get; set; } + Action OnDeletePreset { get; set; } + void UpdatePresetList(IEnumerable presets); } } diff --git a/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetDetailsViewController.cs b/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetDetailsViewController.cs index 0bbc6554..7d95aeeb 100644 --- a/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetDetailsViewController.cs +++ b/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetDetailsViewController.cs @@ -42,48 +42,45 @@ public EqualizerPresetDetailsViewController(Action onViewReady) public override void ViewDidLoad() { // Add navigation controller buttons - var btnDone = new UIButton(UIButtonType.Custom); - btnDone.SetTitle("Done", UIControlState.Normal); - btnDone.Layer.CornerRadius = 8; - btnDone.Layer.BackgroundColor = GlobalTheme.SecondaryColor.CGColor; - btnDone.Font = UIFont.FromName("HelveticaNeue-Bold", 12.0f); - btnDone.Frame = new RectangleF(0, 20, 60, 30); - btnDone.TouchUpInside += (sender, e) => { - this.DismissViewController(true, null); + var btnSave = new UIButton(UIButtonType.Custom); + btnSave.SetTitle("Save", UIControlState.Normal); + btnSave.Layer.CornerRadius = 8; + btnSave.Layer.BackgroundColor = GlobalTheme.SecondaryColor.CGColor; + btnSave.Font = UIFont.FromName("HelveticaNeue-Bold", 12.0f); + btnSave.Frame = new RectangleF(0, 20, 60, 30); + btnSave.TouchUpInside += (sender, e) => { + //this.DismissViewController(true, null); + NavigationController.PopViewControllerAnimated(true); }; - _btnDone = new UIBarButtonItem(btnDone); + _btnDone = new UIBarButtonItem(btnSave); - var btnAdd = new UIButton(UIButtonType.Custom); - btnAdd.SetTitle("+", UIControlState.Normal); - btnAdd.Layer.CornerRadius = 8; - btnAdd.Layer.BackgroundColor = GlobalTheme.SecondaryColor.CGColor; - btnAdd.Font = UIFont.FromName("HelveticaNeue-Bold", 18.0f); - btnAdd.Frame = new RectangleF(0, 12, 60, 30); - btnAdd.TouchUpInside += (sender, e) => { - this.DismissViewController(true, null); - }; - _btnAdd = new UIBarButtonItem(btnAdd); +// var btnAdd = new UIButton(UIButtonType.Custom); +// btnAdd.SetTitle("+", UIControlState.Normal); +// btnAdd.Layer.CornerRadius = 8; +// btnAdd.Layer.BackgroundColor = GlobalTheme.SecondaryColor.CGColor; +// btnAdd.Font = UIFont.FromName("HelveticaNeue-Bold", 18.0f); +// btnAdd.Frame = new RectangleF(0, 12, 60, 30); +// btnAdd.TouchUpInside += (sender, e) => { +// this.DismissViewController(true, null); +// }; +// _btnAdd = new UIBarButtonItem(btnAdd); NavigationItem.SetLeftBarButtonItem(_btnDone, true); - NavigationItem.SetRightBarButtonItem(_btnAdd, true); + //NavigationItem.SetRightBarButtonItem(_btnAdd, true); var navCtrl = (MPfmNavigationController)NavigationController; navCtrl.SetBackButtonVisible(false); - navCtrl.SetTitle("Effects", "Equalizer Presets"); + navCtrl.SetTitle("Equalizer Preset", ""); base.ViewDidLoad(); } - #region IEffectsView implementation + #region IEqualizerPresetDetailsView implementation public void UpdateFader(int index, float value) { } - public void UpdatePresetList(System.Collections.Generic.IEnumerable presets) - { - } - #endregion } } diff --git a/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetsViewController.cs b/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetsViewController.cs index 137730f2..861dce96 100644 --- a/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetsViewController.cs +++ b/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetsViewController.cs @@ -60,7 +60,7 @@ public override void ViewDidLoad() btnAdd.Font = UIFont.FromName("HelveticaNeue-Bold", 18.0f); btnAdd.Frame = new RectangleF(0, 12, 60, 30); btnAdd.TouchUpInside += (sender, e) => { - this.DismissViewController(true, null); + OnAddPreset(); }; _btnAdd = new UIBarButtonItem(btnAdd); @@ -69,16 +69,18 @@ public override void ViewDidLoad() var navCtrl = (MPfmNavigationController)NavigationController; navCtrl.SetBackButtonVisible(false); - navCtrl.SetTitle("Effects", "Equalizer Presets"); + navCtrl.SetTitle("Equalizer", "Presets"); base.ViewDidLoad(); } - #region IEffectsView implementation + #region IEqualizerPresetsView implementation - public void UpdateFader(int index, float value) - { - } + public Action OnBypassEqualizer { get; set; } + public Action OnAddPreset { get; set; } + public Action OnLoadPreset { get; set; } + public Action OnEditPreset { get; set; } + public Action OnDeletePreset { get; set; } public void UpdatePresetList(System.Collections.Generic.IEnumerable presets) { diff --git a/MPfm/MPfm.iOS/Classes/Controllers/MoreViewController.cs b/MPfm/MPfm.iOS/Classes/Controllers/MoreViewController.cs index d9bb87e3..d89e6364 100644 --- a/MPfm/MPfm.iOS/Classes/Controllers/MoreViewController.cs +++ b/MPfm/MPfm.iOS/Classes/Controllers/MoreViewController.cs @@ -74,7 +74,7 @@ public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) cell.TextLabel.Text = _items[indexPath.Row].Value; // Set font - cell.TextLabel.Font = UIFont.FromName("HelveticaNeue-Bold", 14); + cell.TextLabel.Font = UIFont.FromName("HelveticaNeue-Medium", 14); // Set chevron cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; diff --git a/MPfm/MPfm.iOS/Classes/Delegates/AppDelegate.cs b/MPfm/MPfm.iOS/Classes/Delegates/AppDelegate.cs index 510fd89b..b27e816c 100644 --- a/MPfm/MPfm.iOS/Classes/Delegates/AppDelegate.cs +++ b/MPfm/MPfm.iOS/Classes/Delegates/AppDelegate.cs @@ -207,10 +207,10 @@ public void PushDialogView(string viewTitle, UIViewController viewController) // TODO: Remove navCtrl from list when dialog is closed. } - public void PushDialogSubview(string viewTitle, UIViewController viewController) + public void PushDialogSubview(string parentViewTitle, UIViewController viewController) { InvokeOnMainThread(() => { - var navCtrl = _dialogNavigationControllers.FirstOrDefault(x => x.Key == viewTitle).Value; + var navCtrl = _dialogNavigationControllers.FirstOrDefault(x => x.Key == parentViewTitle).Value; navCtrl.PushViewController(viewController, true); }); } diff --git a/MPfm/MPfm.iOS/Classes/Navigation/iOSNavigationManager.cs b/MPfm/MPfm.iOS/Classes/Navigation/iOSNavigationManager.cs index ce1efb02..ece9a7bd 100644 --- a/MPfm/MPfm.iOS/Classes/Navigation/iOSNavigationManager.cs +++ b/MPfm/MPfm.iOS/Classes/Navigation/iOSNavigationManager.cs @@ -80,9 +80,9 @@ public override void PushDialogView(string viewTitle, IBaseView view) AppDelegate.PushDialogView(viewTitle, (UIViewController)view); } - public override void PushDialogSubview(string viewTitle, IBaseView view) + public override void PushDialogSubview(string parentViewTitle, IBaseView view) { - AppDelegate.PushDialogSubview(viewTitle, (UIViewController)view); + AppDelegate.PushDialogSubview(parentViewTitle, (UIViewController)view); } public override void PushPlayerSubview(IPlayerView playerView, IBaseView view) diff --git a/MPfm/MPfm.iOS/Info.plist b/MPfm/MPfm.iOS/Info.plist index e00a9199..ff30d882 100644 --- a/MPfm/MPfm.iOS/Info.plist +++ b/MPfm/MPfm.iOS/Info.plist @@ -2,8 +2,6 @@ - CFBundleDisplayName - MP4M CFBundleIconFiles Images/icon57.png @@ -51,5 +49,7 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + CFBundleDisplayName + MPfm