Skip to content

Commit

Permalink
Added subviews for Player view on mobile devices.
Browse files Browse the repository at this point in the history
iOS: Added temp splash for iPhone 5
iOS: Added UIScrollView in PlayerViewController to present player sub views
Updated MobileNavigationManager

Related to issue #409.
  • Loading branch information
ycastonguay committed Feb 22, 2013
1 parent 75120f2 commit 9df5e96
Show file tree
Hide file tree
Showing 50 changed files with 2,610 additions and 166 deletions.
5 changes: 5 additions & 0 deletions MPfm/MPfm.MVP/Bootstrap/Bootstrapper.cs
Expand Up @@ -61,6 +61,11 @@ static Bootstrapper()
container.Register<IGeneralPreferencesPresenter, GeneralPreferencesPresenter>().AsSingleton();
container.Register<ILibraryPreferencesPresenter, LibraryPreferencesPresenter>().AsSingleton();
container.Register<IPlaylistPresenter, PlaylistPresenter>().AsSingleton();
container.Register<ILoopsPresenter, LoopsPresenter>().AsSingleton();
container.Register<IMarkersPresenter, MarkersPresenter>().AsSingleton();
container.Register<ITimeShiftingPresenter, TimeShiftingPresenter>().AsSingleton();
container.Register<IPitchShiftingPresenter, PitchShiftingPresenter>().AsSingleton();
container.Register<IPlayerMetadataPresenter, PlayerMetadataPresenter>().AsSingleton();
}

/// <summary>
Expand Down
15 changes: 15 additions & 0 deletions MPfm/MPfm.MVP/MPfm.MVP.iOS.csproj
Expand Up @@ -268,5 +268,20 @@
<Compile Include="Presenters\MainPresenter.cs" />
<Compile Include="Navigation\NavigationManager.cs" />
<Compile Include="Messages\AudioFileCacheUpdatedMessage.cs" />
<Compile Include="Views\ILoopsView.cs" />
<Compile Include="Views\IMarkersView.cs" />
<Compile Include="Views\IPitchShiftingView.cs" />
<Compile Include="Views\ITimeShiftingView.cs" />
<Compile Include="Views\IPlayerMetadataView.cs" />
<Compile Include="Presenters\Interfaces\ILoopsPresenter.cs" />
<Compile Include="Presenters\Interfaces\IMarkersPresenter.cs" />
<Compile Include="Presenters\Interfaces\ITimeShiftingPresenter.cs" />
<Compile Include="Presenters\Interfaces\IPitchShiftingPresenter.cs" />
<Compile Include="Presenters\LoopsPresenter.cs" />
<Compile Include="Presenters\MarkersPresenter.cs" />
<Compile Include="Presenters\TimeShiftingPresenter.cs" />
<Compile Include="Presenters\PitchShiftingPresenter.cs" />
<Compile Include="Presenters\Interfaces\IPlayerMetadataPresenter.cs" />
<Compile Include="Presenters\PlayerMetadataPresenter.cs" />
</ItemGroup>
</Project>
134 changes: 127 additions & 7 deletions MPfm/MPfm.MVP/Navigation/MobileNavigationManager.cs
Expand Up @@ -32,32 +32,43 @@ public abstract class MobileNavigationManager
{
private readonly object _locker = new object();

private IMobileOptionsMenuView _optionsMenuView;
private IMobileOptionsMenuPresenter _optionsMenuPresenter;

private ISplashView _splashView;
private ISplashPresenter _splashPresenter;

private IMobileOptionsMenuView _optionsMenuView;
private IMobileOptionsMenuPresenter _optionsMenuPresenter;
private IUpdateLibraryView _updateLibraryView;
private IUpdateLibraryPresenter _updateLibraryPresenter;
private IPlayerView _playerView;
private IPlayerPresenter _playerPresenter;

// Player sub views
private IPlayerMetadataView _playerMetadataView;
private IPlayerMetadataPresenter _playerMetadataPresenter;
private ILoopsView _loopsView;
private ILoopsPresenter _loopsPresenter;
private IMarkersView _markersView;
private IMarkersPresenter _markersPresenter;
private ITimeShiftingView _timeShiftingView;
private ITimeShiftingPresenter _timeShiftingPresenter;
private IPitchShiftingView _pitchShiftingView;
private IPitchShiftingPresenter _pitchShiftingPresenter;

// Preferences sub views
private IAudioPreferencesView _audioPreferencesView;
private IGeneralPreferencesView _generalPreferencesView;
private ILibraryPreferencesView _libraryPreferencesView;
private IAudioPreferencesPresenter _audioPreferencesPresenter;
private IGeneralPreferencesPresenter _generalPreferencesPresenter;
private ILibraryPreferencesPresenter _libraryPreferencesPresenter;

private IUpdateLibraryView _updateLibraryView;
private IUpdateLibraryPresenter _updateLibraryPresenter;

private Dictionary<IMobileLibraryBrowserView, IMobileLibraryBrowserPresenter> _mobileLibraryBrowserList = new Dictionary<IMobileLibraryBrowserView, IMobileLibraryBrowserPresenter>();

public abstract void ShowSplash(ISplashView view);
public abstract void HideSplash();
public abstract void AddTab(MobileNavigationTabType type, string title, IBaseView view);
public abstract void PushTabView(MobileNavigationTabType type, IBaseView view);
public abstract void PushDialogView(IBaseView view);
public abstract void PushPlayerSubview(IPlayerView playerView, IBaseView view);

public virtual void Start()
{
Expand Down Expand Up @@ -234,6 +245,20 @@ public virtual IPlayerView CreatePlayerView(Action<IBaseView> onViewBindedToPres
{
_playerPresenter = Bootstrapper.GetContainer().Resolve<IPlayerPresenter>();
_playerPresenter.BindView((IPlayerView)view);
// Add scroll view items
var playerMetadata = CreatePlayerMetadataView();
var loops = CreateLoopsView();
var markers = CreateMarkersView();
var timeShifting = CreateTimeShiftingView();
var pitchShifting = CreatePitchShiftingView();
PushPlayerSubview(_playerView, playerMetadata);
PushPlayerSubview(_playerView, loops);
PushPlayerSubview(_playerView, markers);
PushPlayerSubview(_playerView, timeShifting);
PushPlayerSubview(_playerView, pitchShifting);
if (onViewBindedToPresenter != null)
onViewBindedToPresenter(view);
};
Expand All @@ -247,6 +272,101 @@ public virtual IPlayerView CreatePlayerView(Action<IBaseView> onViewBindedToPres
};
return _playerView;
}

public virtual IPlayerMetadataView CreatePlayerMetadataView()
{
// The view invokes the OnViewReady action when the view is ready. This means the presenter can be created and bound to the view.
Action<IBaseView> onViewReady = (view) =>
{
_playerMetadataPresenter = Bootstrapper.GetContainer().Resolve<IPlayerMetadataPresenter>();
_playerMetadataPresenter.BindView((IPlayerMetadataView)view);
};

// Create view and manage view destruction
_playerMetadataView = Bootstrapper.GetContainer().Resolve<IPlayerMetadataView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });
_playerMetadataView.OnViewDestroy = (view) =>
{
_playerMetadataView = null;
_playerMetadataPresenter = null;
};
return _playerMetadataView;
}

public virtual ILoopsView CreateLoopsView()
{
// The view invokes the OnViewReady action when the view is ready. This means the presenter can be created and bound to the view.
Action<IBaseView> onViewReady = (view) =>
{
_loopsPresenter = Bootstrapper.GetContainer().Resolve<ILoopsPresenter>();
_loopsPresenter.BindView((ILoopsView)view);
};

// Create view and manage view destruction
_loopsView = Bootstrapper.GetContainer().Resolve<ILoopsView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });
_loopsView.OnViewDestroy = (view) =>
{
_loopsView = null;
_loopsPresenter = null;
};
return _loopsView;
}

public virtual IMarkersView CreateMarkersView()
{
// The view invokes the OnViewReady action when the view is ready. This means the presenter can be created and bound to the view.
Action<IBaseView> onViewReady = (view) =>
{
_markersPresenter = Bootstrapper.GetContainer().Resolve<IMarkersPresenter>();
_markersPresenter.BindView((IMarkersView)view);
};

// Create view and manage view destruction
_markersView = Bootstrapper.GetContainer().Resolve<IMarkersView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });
_markersView.OnViewDestroy = (view) =>
{
_markersView = null;
_markersPresenter = null;
};
return _markersView;
}

public virtual ITimeShiftingView CreateTimeShiftingView()
{
// The view invokes the OnViewReady action when the view is ready. This means the presenter can be created and bound to the view.
Action<IBaseView> onViewReady = (view) =>
{
_timeShiftingPresenter = Bootstrapper.GetContainer().Resolve<ITimeShiftingPresenter>();
_timeShiftingPresenter.BindView((ITimeShiftingView)view);
};

// Create view and manage view destruction
_timeShiftingView = Bootstrapper.GetContainer().Resolve<ITimeShiftingView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });
_timeShiftingView.OnViewDestroy = (view) =>
{
_timeShiftingView = null;
_timeShiftingPresenter = null;
};
return _timeShiftingView;
}

public virtual IPitchShiftingView CreatePitchShiftingView()
{
// The view invokes the OnViewReady action when the view is ready. This means the presenter can be created and bound to the view.
Action<IBaseView> onViewReady = (view) =>
{
_pitchShiftingPresenter = Bootstrapper.GetContainer().Resolve<IPitchShiftingPresenter>();
_pitchShiftingPresenter.BindView((IPitchShiftingView)view);
};

// Create view and manage view destruction
_pitchShiftingView = Bootstrapper.GetContainer().Resolve<IPitchShiftingView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });
_pitchShiftingView.OnViewDestroy = (view) =>
{
_pitchShiftingView = null;
_pitchShiftingPresenter = null;
};
return _pitchShiftingView;
}
}

public enum MobileNavigationTabType
Expand Down
29 changes: 29 additions & 0 deletions MPfm/MPfm.MVP/Presenters/Interfaces/ILoopsPresenter.cs
@@ -0,0 +1,29 @@
// Copyright © 2011-2013 Yanick Castonguay
//
// This file is part of MPfm.
//
// MPfm is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MPfm is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using MPfm.MVP.Models;
using MPfm.MVP.Views;

namespace MPfm.MVP.Presenters.Interfaces
{
/// <summary>
/// Loops presenter interface.
/// </summary>
public interface ILoopsPresenter : IBasePresenter<ILoopsView>
{
}
}
29 changes: 29 additions & 0 deletions MPfm/MPfm.MVP/Presenters/Interfaces/IMarkersPresenter.cs
@@ -0,0 +1,29 @@
// Copyright © 2011-2013 Yanick Castonguay
//
// This file is part of MPfm.
//
// MPfm is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MPfm is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using MPfm.MVP.Models;
using MPfm.MVP.Views;

namespace MPfm.MVP.Presenters.Interfaces
{
/// <summary>
/// Markers presenter interface.
/// </summary>
public interface IMarkersPresenter : IBasePresenter<IMarkersView>
{
}
}
29 changes: 29 additions & 0 deletions MPfm/MPfm.MVP/Presenters/Interfaces/IPitchShiftingPresenter.cs
@@ -0,0 +1,29 @@
// Copyright © 2011-2013 Yanick Castonguay
//
// This file is part of MPfm.
//
// MPfm is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MPfm is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using MPfm.MVP.Models;
using MPfm.MVP.Views;

namespace MPfm.MVP.Presenters.Interfaces
{
/// <summary>
/// Pitch shifting presenter interface.
/// </summary>
public interface IPitchShiftingPresenter : IBasePresenter<IPitchShiftingView>
{
}
}
29 changes: 29 additions & 0 deletions MPfm/MPfm.MVP/Presenters/Interfaces/IPlayerMetadataPresenter.cs
@@ -0,0 +1,29 @@
// Copyright © 2011-2013 Yanick Castonguay
//
// This file is part of MPfm.
//
// MPfm is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MPfm is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using MPfm.MVP.Models;
using MPfm.MVP.Views;

namespace MPfm.MVP.Presenters.Interfaces
{
/// <summary>
/// Player metadata presenter interface.
/// </summary>
public interface IPlayerMetadataPresenter : IBasePresenter<IPlayerMetadataView>
{
}
}
29 changes: 29 additions & 0 deletions MPfm/MPfm.MVP/Presenters/Interfaces/ITimeShiftingPresenter.cs
@@ -0,0 +1,29 @@
// Copyright © 2011-2013 Yanick Castonguay
//
// This file is part of MPfm.
//
// MPfm is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MPfm is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using MPfm.MVP.Models;
using MPfm.MVP.Views;

namespace MPfm.MVP.Presenters.Interfaces
{
/// <summary>
/// Time shifting presenter interface.
/// </summary>
public interface ITimeShiftingPresenter : IBasePresenter<ITimeShiftingView>
{
}
}
41 changes: 41 additions & 0 deletions MPfm/MPfm.MVP/Presenters/LoopsPresenter.cs
@@ -0,0 +1,41 @@
// Copyright © 2011-2013 Yanick Castonguay
//
// This file is part of MPfm.
//
// MPfm is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MPfm is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using MPfm.MVP.Navigation;
using MPfm.MVP.Presenters.Interfaces;
using MPfm.MVP.Views;

namespace MPfm.MVP.Presenters
{
/// <summary>
/// Loops view presenter.
/// </summary>
public class LoopsPresenter : BasePresenter<ILoopsView>, ILoopsPresenter
{
public LoopsPresenter()
{
}

public override void BindView(ILoopsView view)
{
// Subscribe to view actions

base.BindView(view);
}
}
}

0 comments on commit 9df5e96

Please sign in to comment.