Skip to content

Commit

Permalink
iOS: Removed buttons from PlayerMetadataViewController. New playlist …
Browse files Browse the repository at this point in the history
…button is now working in PlayerViewController. Added new redesigned circular player buttons to PlayerViewController (with MPfmPlayerButton) with new glyphs.

Related to issue #405.
  • Loading branch information
ycastonguay committed Oct 10, 2013
1 parent d4e18a7 commit cb38bbe
Show file tree
Hide file tree
Showing 31 changed files with 305 additions and 636 deletions.
Expand Up @@ -39,6 +39,7 @@ public MobileNavigationManagerCommandMessage(object sender, MobileNavigationMana
public enum MobileNavigationManagerCommandMessageType
{
ShowPlayerView = 0,
ShowEqualizerPresetsView = 1
ShowEqualizerPresetsView = 1,
ShowPlaylistView = 2
}
}
5 changes: 3 additions & 2 deletions MPfm/MPfm.MVP/Navigation/MobileNavigationManager.cs
Expand Up @@ -99,6 +99,7 @@ public abstract class MobileNavigationManager
private IGeneralPreferencesPresenter _generalPreferencesPresenter;
private ILibraryPreferencesPresenter _libraryPreferencesPresenter;

protected IPlaylistView PlaylistView { get { return _playlistView; } }
protected IEqualizerPresetsView EqualizerPresetsView { get { return _equalizerPresetsView; } }
protected IPlayerView PlayerView { get { return _playerView; } }

Expand Down Expand Up @@ -868,8 +869,8 @@ protected virtual void CreatePlaylistViewInternal(IBaseView sourceView, Action<I
_playlistView = Bootstrapper.GetContainer().Resolve<IPlaylistView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });

#if !ANDROID
PushTabView(MobileNavigationTabType.More, _playlistView);
//PushDialogView("Playlist", View, view);
//PushTabView(MobileNavigationTabType.More, _playlistView);
PushDialogView(MobileDialogPresentationType.Standard, "Playlist", sourceView, _playlistView);
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions MPfm/MPfm.MVP/Presenters/PlayerMetadataPresenter.cs
Expand Up @@ -53,15 +53,15 @@ public override void BindView(IPlayerMetadataView view)
// Refresh initial data if player is already playing
if (_playerService.IsPlaying)
{
View.RefreshAudioFile(_playerService.CurrentPlaylistItem.AudioFile);
View.RefreshMetadata(_playerService.CurrentPlaylistItem.AudioFile, _playerService.CurrentPlaylist.CurrentItemIndex, _playerService.CurrentPlaylist.Items.Count);
View.RefreshRepeat(_playerService.RepeatType);
View.RefreshShuffle(_isShuffle);
}
}

private void OnPlaylistIndexChanged(PlayerPlaylistIndexChangedMessage message)
{
View.RefreshAudioFile(message.Data.AudioFileStarted);
View.RefreshMetadata(message.Data.AudioFileStarted, _playerService.CurrentPlaylist.CurrentItemIndex, _playerService.CurrentPlaylist.Items.Count);
}

private void OpenPlaylist()
Expand Down
2 changes: 1 addition & 1 deletion MPfm/MPfm.MVP/Views/IPlayerMetadataView.cs
Expand Up @@ -31,7 +31,7 @@ public interface IPlayerMetadataView : IBaseView
Action OnToggleShuffle { get; set; }
Action OnToggleRepeat { get; set; }

void RefreshAudioFile(AudioFile audioFile);
void RefreshMetadata(AudioFile audioFile, int playlistIndex, int playlistCount);
void RefreshShuffle(bool shuffle);
void RefreshRepeat(RepeatType repeatType);
}
Expand Down
4 changes: 0 additions & 4 deletions MPfm/MPfm.iOS/Classes/Controllers/MoreViewController.cs
Expand Up @@ -118,10 +118,6 @@ public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
cell.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron");
cell.ImageChevron.Hidden = false;

UIView viewBackgroundSelected = new UIView();
viewBackgroundSelected.BackgroundColor = GlobalTheme.SecondaryColor;
cell.SelectedBackgroundView = viewBackgroundSelected;

return cell;
}

Expand Down
42 changes: 4 additions & 38 deletions MPfm/MPfm.iOS/Classes/Controllers/PlayerMetadataViewController.cs
Expand Up @@ -45,32 +45,9 @@ public override void ViewDidLoad()
lblTitle.Text = string.Empty;
viewBackground.BackgroundColor = GlobalTheme.PlayerPanelBackgroundColor;

btnPlaylist.BackgroundColor = UIColor.Clear;
btnRepeat.BackgroundColor = UIColor.Clear;
btnShuffle.BackgroundColor = UIColor.Clear;
btnPlaylist.SetImage(UIImage.FromBundle("Images/Buttons/playlist"), UIControlState.Normal);
btnPlaylist.SetImage(UIImage.FromBundle("Images/Buttons/playlist_on"), UIControlState.Highlighted);
btnRepeat.SetImage(UIImage.FromBundle("Images/Buttons/repeat"), UIControlState.Normal);
btnShuffle.SetImage(UIImage.FromBundle("Images/Buttons/shuffle"), UIControlState.Normal);

base.ViewDidLoad();
}

partial void actionPlaylist(NSObject sender)
{
OnOpenPlaylist();
}

partial void actionRepeat(NSObject sender)
{
OnToggleRepeat();
}

partial void actionShuffle(NSObject sender)
{
OnToggleShuffle();
}

public void ShowPanel(bool show, bool swipeUp)
{
if (show && !swipeUp)
Expand Down Expand Up @@ -104,34 +81,21 @@ public void ShowPanel(bool show, bool swipeUp)

public void RefreshShuffle(bool shuffle)
{
InvokeOnMainThread(() => {
if(shuffle)
btnShuffle.SetImage(UIImage.FromBundle("Images/Buttons/shuffle_on"), UIControlState.Normal);
else
btnShuffle.SetImage(UIImage.FromBundle("Images/Buttons/shuffle"), UIControlState.Normal);
});
}

public void RefreshRepeat(RepeatType repeatType)
{
InvokeOnMainThread(() => {
if(repeatType == RepeatType.Off)
btnRepeat.SetImage(UIImage.FromBundle("Images/Buttons/repeat"), UIControlState.Normal);
else if(repeatType == RepeatType.Playlist)
btnRepeat.SetImage(UIImage.FromBundle("Images/Buttons/repeat_on"), UIControlState.Normal);
else
btnRepeat.SetImage(UIImage.FromBundle("Images/Buttons/repeat_song_on"), UIControlState.Normal);
});
}

public void RefreshAudioFile(AudioFile audioFile)
public void RefreshMetadata(AudioFile audioFile, int playlistIndex, int playlistCount)
{
InvokeOnMainThread(() => {
if(audioFile == null)
{
lblArtistName.Text = string.Empty;
lblAlbumTitle.Text = string.Empty;
lblTitle.Text = string.Empty;
lblSongCount.Text = string.Empty;
// Update AirPlay metadata with generic info
if(MPNowPlayingInfoCenter.DefaultCenter != null)
Expand All @@ -145,6 +109,8 @@ public void RefreshAudioFile(AudioFile audioFile)
lblArtistName.Text = audioFile.ArtistName;
lblAlbumTitle.Text = audioFile.AlbumTitle;
lblTitle.Text = audioFile.Title;
lblSongCount.Text = string.Format("{0}/{1}", playlistIndex+1, playlistCount);
ShowPanel(true, false);
// Update AirPlay metadata with generic info
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 18 additions & 14 deletions MPfm/MPfm.iOS/Classes/Controllers/PlayerViewController.cs
Expand Up @@ -45,7 +45,7 @@ public partial class PlayerViewController : BaseViewController, IPlayerView
NSTimer _timerHidePlayerMetadata;
bool _isPositionChanging = false;
string _currentAlbumArtKey = string.Empty;
string _currentNavigationSubtitle = string.Empty;
//string _currentNavigationSubtitle = string.Empty;
PlayerMetadataViewController _playerMetadataViewController;
float _lastSliderPositionValue = 0;

Expand All @@ -70,15 +70,11 @@ public override void DidReceiveMemoryWarning()

public override void ViewDidLoad()
{
btnPrevious.BackgroundColor = GlobalTheme.BackgroundColor;
btnPlayPause.BackgroundColor = GlobalTheme.BackgroundColor;
btnNext.BackgroundColor = GlobalTheme.BackgroundColor;
btnPrevious.SetImage(UIImage.FromBundle("Images/Buttons/previous"), UIControlState.Normal);
btnPrevious.SetImage(UIImage.FromBundle("Images/Buttons/previous_on"), UIControlState.Highlighted);
btnPlayPause.SetImage(UIImage.FromBundle("Images/Buttons/pause"), UIControlState.Normal);
btnPlayPause.SetImage(UIImage.FromBundle("Images/Buttons/pause_on"), UIControlState.Highlighted);
btnNext.SetImage(UIImage.FromBundle("Images/Buttons/next"), UIControlState.Normal);
btnNext.SetImage(UIImage.FromBundle("Images/Buttons/next_on"), UIControlState.Highlighted);
btnPrevious.GlyphImageView.Image = UIImage.FromBundle("Images/Player/previous");
btnPlayPause.GlyphImageView.Image = UIImage.FromBundle("Images/Player/pause");
btnNext.GlyphImageView.Image = UIImage.FromBundle("Images/Player/next");
btnShuffle.GlyphImageView.Image = UIImage.FromBundle("Images/Player/shuffle");
btnRepeat.GlyphImageView.Image = UIImage.FromBundle("Images/Player/repeat");

viewPosition.BackgroundColor = GlobalTheme.BackgroundColor;
viewMain.BackgroundColor = GlobalTheme.BackgroundColor;
Expand Down Expand Up @@ -368,6 +364,16 @@ private void CreateHidePlayerMetadataTimer()
OnPlayerNext();
}

partial void actionRepeat(NSObject sender)
{

}

partial void actionShuffle(NSObject sender)
{

}

#region IPlayerView implementation

public Action OnPlayerPlay { get; set; }
Expand Down Expand Up @@ -524,12 +530,10 @@ public void RefreshPlayerStatus(PlayerStatusType status)
switch (status)
{
case PlayerStatusType.Paused:
btnPlayPause.SetImage(UIImage.FromBundle("Images/Buttons/play"), UIControlState.Normal);
btnPlayPause.SetImage(UIImage.FromBundle("Images/Buttons/play_on"), UIControlState.Highlighted);
btnPlayPause.GlyphImageView.Image = UIImage.FromBundle("Images/Player/play");
break;
case PlayerStatusType.Playing:
btnPlayPause.SetImage(UIImage.FromBundle("Images/Buttons/pause"), UIControlState.Normal);
btnPlayPause.SetImage(UIImage.FromBundle("Images/Buttons/pause_on"), UIControlState.Highlighted);
btnPlayPause.GlyphImageView.Image = UIImage.FromBundle("Images/Player/pause");
break;
}
});
Expand Down

0 comments on commit cb38bbe

Please sign in to comment.