From f0065cdbd1e24aa99c06033533664f980658f676 Mon Sep 17 00:00:00 2001 From: ycastonguay Date: Wed, 9 Oct 2013 00:13:45 -0400 Subject: [PATCH] iOS: Several bug fixes and optimizations for Artist cells in MobileLibraryBrowserViewController. More bug fixes for iOS 7. Related to issue #405. --- .../Presenters/SelectPlaylistPresenter.cs | 2 +- .../Controllers/AddPlaylistViewController.cs | 32 ++ .../AddPlaylistViewController.designer.cs | 36 +- .../EqualizerPresetDetailsViewController.cs | 4 +- .../EqualizerPresetsViewController.cs | 1 + .../MobileLibraryBrowserViewController.cs | 177 ++----- .../SelectPlaylistViewController.cs | 37 +- MPfm/MPfm.iOS/Classes/Controls/MPfmButton.cs | 16 +- .../Classes/Controls/MPfmImageButton.cs | 7 +- .../Controls/MPfmPlaylistTableViewCell.cs | 177 +++++++ MPfm/MPfm.iOS/Classes/Controls/MPfmTabBar.cs | 4 +- .../Classes/Controls/MPfmTableViewCell.cs | 127 ++++- .../MPfm.iOS/Classes/Delegates/AppDelegate.cs | 5 +- MPfm/MPfm.iOS/MPfm.iOS.csproj | 3 + .../AddPlaylistViewController_iPhone.xib | 192 +++----- ...izerPresetDetailsViewController_iPhone.xib | 454 +++--------------- .../iPhone/SyncMenuViewController_iPhone.xib | 10 +- .../XIB/iPhone/SyncViewController_iPhone.xib | 10 +- 18 files changed, 572 insertions(+), 722 deletions(-) create mode 100644 MPfm/MPfm.iOS/Classes/Controls/MPfmPlaylistTableViewCell.cs diff --git a/MPfm/MPfm.MVP/Presenters/SelectPlaylistPresenter.cs b/MPfm/MPfm.MVP/Presenters/SelectPlaylistPresenter.cs index d75881d9..7637a0b8 100644 --- a/MPfm/MPfm.MVP/Presenters/SelectPlaylistPresenter.cs +++ b/MPfm/MPfm.MVP/Presenters/SelectPlaylistPresenter.cs @@ -135,7 +135,7 @@ private void AddNewPlaylist() try { var view = _mobileNavigationManager.CreateAddPlaylistView(); - _mobileNavigationManager.PushDialogView(MobileDialogPresentationType.Standard, "Add New Playlist", View, view); + _mobileNavigationManager.PushDialogView(MobileDialogPresentationType.Overlay, "Add New Playlist", View, view); } catch (Exception ex) { diff --git a/MPfm/MPfm.iOS/Classes/Controllers/AddPlaylistViewController.cs b/MPfm/MPfm.iOS/Classes/Controllers/AddPlaylistViewController.cs index 2bb371ce..dcd9edf5 100644 --- a/MPfm/MPfm.iOS/Classes/Controllers/AddPlaylistViewController.cs +++ b/MPfm/MPfm.iOS/Classes/Controllers/AddPlaylistViewController.cs @@ -33,15 +33,47 @@ public AddPlaylistViewController(Action onViewReady) public override void ViewDidLoad() { + // Make sure the Done key closes the keyboard + txtPlaylistName.ShouldReturn = (a) => { + txtPlaylistName.ResignFirstResponder(); + return true; + }; + base.ViewDidLoad(); } + private void CloseDialog() + { + WillMoveToParentViewController(null); + UIView.Animate(0.2f, () => { + this.View.Alpha = 0; + }, () => { + View.RemoveFromSuperview(); + RemoveFromParentViewController(); + }); + } + + partial void actionCancel(NSObject sender) + { + CloseDialog(); + } + + partial void actionCreate(NSObject sender) + { + OnSavePlaylist(txtPlaylistName.Text); + CloseDialog(); + } + #region IAddPlaylistView implementation public Action OnSavePlaylist { get; set; } public void AddPlaylistError(Exception ex) { + InvokeOnMainThread(() => { + var alertView = new UIAlertView("AddPlaylist Error", ex.Message, null, "OK", null); + alertView.Show(); + }); } #endregion diff --git a/MPfm/MPfm.iOS/Classes/Controllers/AddPlaylistViewController.designer.cs b/MPfm/MPfm.iOS/Classes/Controllers/AddPlaylistViewController.designer.cs index 0fe0e6ec..570e7889 100644 --- a/MPfm/MPfm.iOS/Classes/Controllers/AddPlaylistViewController.designer.cs +++ b/MPfm/MPfm.iOS/Classes/Controllers/AddPlaylistViewController.designer.cs @@ -1,18 +1,48 @@ +// WARNING // -// This file has been generated automatically by MonoDevelop to store outlets and -// actions made in the Xcode designer. If it is removed, they will be lost. +// This file has been generated automatically by Xamarin Studio to store outlets and +// actions made in the UI designer. If it is removed, they will be lost. // Manual changes to this file may not be handled correctly. // using MonoTouch.Foundation; +using System.CodeDom.Compiler; namespace MPfm.iOS { [Register ("AddPlaylistViewController")] partial class AddPlaylistViewController { + [Outlet] + MPfm.iOS.Classes.Controls.MPfmButton btnCancel { get; set; } + + [Outlet] + MPfm.iOS.Classes.Controls.MPfmButton btnCreate { get; set; } + + [Outlet] + MonoTouch.UIKit.UITextField txtPlaylistName { get; set; } + + [Action ("actionCancel:")] + partial void actionCancel (MonoTouch.Foundation.NSObject sender); + + [Action ("actionCreate:")] + partial void actionCreate (MonoTouch.Foundation.NSObject sender); + void ReleaseDesignerOutlets () { + if (txtPlaylistName != null) { + txtPlaylistName.Dispose (); + txtPlaylistName = null; + } + + if (btnCancel != null) { + btnCancel.Dispose (); + btnCancel = null; + } + + if (btnCreate != null) { + btnCreate.Dispose (); + btnCreate = null; + } } } } - diff --git a/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetDetailsViewController.cs b/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetDetailsViewController.cs index 351d24a4..7c30a515 100644 --- a/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetDetailsViewController.cs +++ b/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetDetailsViewController.cs @@ -92,14 +92,14 @@ public override void ViewDidLoad() var btnReset = new MPfmButton(); btnReset.SetTitle("Reset", UIControlState.Normal); btnReset.Font = UIFont.FromName("HelveticaNeue", 12.0f); - btnReset.Frame = new RectangleF(0, 12, 60, 30); + btnReset.Frame = new RectangleF(0, 12, 60, 40); btnReset.TouchUpInside += HandleButtonResetTouchUpInside; _btnReset = new UIBarButtonItem(btnReset); var btnNormalize = new MPfmButton(); btnNormalize.SetTitle("Normalize", UIControlState.Normal); btnNormalize.Font = UIFont.FromName("HelveticaNeue", 12.0f); - btnNormalize.Frame = new RectangleF(0, 12, 80, 30); + btnNormalize.Frame = new RectangleF(0, 12, 80, 40); btnNormalize.TouchUpInside += HandleButtonNormalizeTouchUpInside; _btnNormalize = new UIBarButtonItem(btnNormalize); diff --git a/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetsViewController.cs b/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetsViewController.cs index be2987d9..5dca1982 100644 --- a/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetsViewController.cs +++ b/MPfm/MPfm.iOS/Classes/Controllers/EqualizerPresetsViewController.cs @@ -178,6 +178,7 @@ public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) cell.TextLabel.Text = _presets[indexPath.Row].Name; cell.TextLabel.Font = UIFont.FromName("HelveticaNeue-Light", 16); cell.TextLabel.TextColor = UIColor.Black; + cell.TextLabel.HighlightedTextColor = UIColor.White; cell.Accessory = UITableViewCellAccessory.None; cell.SelectionStyle = UITableViewCellSelectionStyle.Gray; diff --git a/MPfm/MPfm.iOS/Classes/Controllers/MobileLibraryBrowserViewController.cs b/MPfm/MPfm.iOS/Classes/Controllers/MobileLibraryBrowserViewController.cs index a9e299af..a7991acc 100644 --- a/MPfm/MPfm.iOS/Classes/Controllers/MobileLibraryBrowserViewController.cs +++ b/MPfm/MPfm.iOS/Classes/Controllers/MobileLibraryBrowserViewController.cs @@ -51,8 +51,6 @@ public partial class MobileLibraryBrowserViewController : BaseViewController, IM MobileLibraryBrowserType _browserType; List> _imageCache; List> _thumbnailImageCache; - UIButton _btnDelete; - int _deleteCellIndex = -1; int _editingTableCellRowPosition = -1; int _editingCollectionCellRowPosition = -1; @@ -90,46 +88,6 @@ public override void ViewDidLoad() imageViewAlbumCover.BackgroundColor = UIColor.Black; viewAlbumCover.BackgroundColor = GlobalTheme.MainDarkColor; - // TODO: Move this to a custom table view instead. - _btnDelete = new UIButton(UIButtonType.Custom); - _btnDelete.Alpha = 0; - _btnDelete.Font = UIFont.FromName("HelveticaNeue-Light", 15); - _btnDelete.SetTitle("Delete", UIControlState.Normal); - _btnDelete.BackgroundColor = UIColor.Red; - _btnDelete.SetTitleColor(UIColor.White, UIControlState.Normal); - _btnDelete.SetTitleColor(UIColor.FromRGB(255, 180, 180), UIControlState.Highlighted); - _btnDelete.TouchUpInside += (sender, e) => { - - var alertView = new UIAlertView("Delete confirmation", string.Format("Are you sure you wish to delete {0}?", - _items[_deleteCellIndex].Title), null, "OK", new string[1]{"Cancel"}); - alertView.Clicked += (sender2, e2) => { - if(e2.ButtonIndex == 0) - { - // Remove immediately from table view - _items.RemoveAt(_deleteCellIndex); - tableView.BeginUpdates(); - tableView.DeleteRows(new NSIndexPath[1]{ NSIndexPath.FromRowSection(_deleteCellIndex, 0) }, UITableViewRowAnimation.Right); - tableView.EndUpdates(); - - OnDeleteItem(_deleteCellIndex); - _deleteCellIndex = -1; - UIView.Animate(0.2, () => { - _btnDelete.Alpha = 0; - }); - } - else - { - UIView.Animate(0.2, () => { - var cell = (MPfmTableViewCell)tableView.CellAt(NSIndexPath.FromRowSection(_deleteCellIndex, 0)); - _btnDelete.Alpha = 0; - _btnDelete.Frame = new RectangleF(cell.Frame.Width + 60, _btnDelete.Frame.Y, 60, _btnDelete.Frame.Height); - cell.ImageChevron.Frame = new RectangleF(cell.Frame.Width - cell.ImageChevron.Bounds.Width, 0, cell.ImageChevron.Bounds.Width, cell.ImageChevron.Bounds.Height); - }); - } - }; - alertView.Show(); - }; - tableView.AddSubview(_btnDelete); _imageCache = new List>(); _thumbnailImageCache = new List>(); this.NavigationItem.HidesBackButton = true; @@ -172,28 +130,6 @@ public override void ViewDidDisappear(bool animated) FlushImages(); } - public override void ViewDidLayoutSubviews() - { - base.ViewDidLayoutSubviews(); - var screenSize = UIKitHelper.GetDeviceSize(); - - if(_deleteCellIndex >= 0) - { - _btnDelete.Frame = new RectangleF(screenSize.Width - 60, _btnDelete.Frame.Y, 60, _btnDelete.Frame.Height); - - var cell = tableView.CellAt(NSIndexPath.FromRowSection(_deleteCellIndex, 0)); - if(cell != null) - { - var customCell = (MPfmTableViewCell)cell; - customCell.ImageChevron.Frame = new RectangleF(customCell.Frame.Width - customCell.ImageChevron.Bounds.Width - 60, 0, customCell.ImageChevron.Bounds.Width, customCell.ImageChevron.Bounds.Height); - } - } - else - { - _btnDelete.Frame = new RectangleF(screenSize.Width + 60, _btnDelete.Frame.Y, 60, _btnDelete.Frame.Height); - } - } - private void HandleSwipe(UISwipeGestureRecognizer gestureRecognizer) { var point = gestureRecognizer.LocationInView(tableView); @@ -202,56 +138,6 @@ private void HandleSwipe(UISwipeGestureRecognizer gestureRecognizer) // IndexPath is null when swiping an empty cell if (indexPath == null) return; - - var cell = (MPfmTableViewCell)tableView.CellAt(indexPath); - - Console.WriteLine("MobileLibraryBrowserViewController - HandleSwipe - row: {0} deleteCellIndex: {1}", indexPath.Row, _deleteCellIndex); - if (_deleteCellIndex == -1) - { - // no previous selection; just show button - if(_btnDelete.Alpha == 0) - _btnDelete.Frame = new RectangleF(cell.Frame.Width, cell.Frame.Y, 60, cell.Frame.Height); - - UIView.Animate(0.2, () => { - _deleteCellIndex = indexPath.Row; - _btnDelete.Alpha = 1; - _btnDelete.Frame = new RectangleF(cell.Frame.Width - 60, _btnDelete.Frame.Y, 60, _btnDelete.Frame.Height); - cell.ImageChevron.Frame = new RectangleF(cell.Frame.Width - cell.ImageChevron.Bounds.Width - 60, 0, cell.ImageChevron.Bounds.Width, cell.ImageChevron.Bounds.Height); - }); - } - else if (_deleteCellIndex == indexPath.Row) - { - // same cell; hide button - UIView.Animate(0.2, () => { - _deleteCellIndex = -1; - _btnDelete.Alpha = 0; - _btnDelete.Frame = new RectangleF(cell.Frame.Width + 60, _btnDelete.Frame.Y, 60, _btnDelete.Frame.Height); - cell.ImageChevron.Frame = new RectangleF(cell.Frame.Width - cell.ImageChevron.Bounds.Width, 0, cell.ImageChevron.Bounds.Width, cell.ImageChevron.Bounds.Height); - }); - } - else - { - // else: hide the button in the other cell. - UIView.Animate(0.2, () => { - // Hide button in previous cell - var cellPrevious = (MPfmTableViewCell)tableView.CellAt(NSIndexPath.FromRowSection(_deleteCellIndex, 0)); - if(cellPrevious != null) - { - cellPrevious.ImageChevron.Frame = new RectangleF(cellPrevious.Frame.Width - cellPrevious.ImageChevron.Bounds.Width, 0, cellPrevious.ImageChevron.Bounds.Width, cellPrevious.ImageChevron.Bounds.Height); - _btnDelete.Frame = new RectangleF(cellPrevious.Frame.Width + 60, _btnDelete.Frame.Y, 60, _btnDelete.Frame.Height); - _btnDelete.Alpha = 0; - } - }, () => { - // Show button in new cell - _btnDelete.Frame = new RectangleF(cell.Frame.Width, cell.Frame.Y, 60, cell.Frame.Height); - UIView.Animate(0.2, () => { - _deleteCellIndex = indexPath.Row; - _btnDelete.Alpha = 1; - _btnDelete.Frame = new RectangleF(cell.Frame.Width - 60, _btnDelete.Frame.Y, 60, _btnDelete.Frame.Height); - cell.ImageChevron.Frame = new RectangleF(cell.Frame.Width - cell.ImageChevron.Bounds.Width - 60, 0, cell.ImageChevron.Bounds.Width, cell.ImageChevron.Bounds.Height); - }); - }); - } } private void HandleLongPressCollectionCellRow(UILongPressGestureRecognizer gestureRecognizer) @@ -475,10 +361,16 @@ private void SetEditingTableCellRow(int position) var oldCell = (MPfmTableViewCell)tableView.VisibleCells.FirstOrDefault(x => x.Tag == oldPosition); if (oldCell != null) { + //oldCell.SecondaryMenuBackground.Alpha = 0; UIView.Animate(0.2, 0, UIViewAnimationOptions.CurveEaseIn, () => { oldCell.PlayButton.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 138, 4, 44, 44); oldCell.AddButton.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 86, 4, 44, 44); oldCell.DeleteButton.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 34, 4, 44, 44); + //oldCell.SecondaryMenuBackground.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width, 0, 190, 52); + //Console.WriteLine(">>>>>>>>>>> MLB - Scale 1"); + oldCell.TextLabel.Transform = CGAffineTransform.MakeScale(1, 1); + oldCell.SecondaryMenuBackground.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 188, 4, 188, 44); + oldCell.SecondaryMenuBackground.Alpha = 0; oldCell.PlayButton.Alpha = 0; oldCell.AddButton.Alpha = 0; oldCell.DeleteButton.Alpha = 0; @@ -495,16 +387,23 @@ private void SetEditingTableCellRow(int position) cell.PlayButton.Alpha = 0; cell.AddButton.Alpha = 0; cell.DeleteButton.Alpha = 0; + cell.SecondaryMenuBackground.Alpha = 0; cell.PlayButton.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 138, 4, 44, 44); cell.AddButton.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 86, 4, 44, 44); cell.DeleteButton.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 34, 4, 44, 44); + //cell.SecondaryMenuBackground.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width, 4, 188, 44); + cell.SecondaryMenuBackground.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 188, 4, 188, 44); UIView.Animate(0.2, 0, UIViewAnimationOptions.CurveEaseIn, () => { cell.PlayButton.Alpha = 1; cell.AddButton.Alpha = 1; cell.DeleteButton.Alpha = 1; + cell.SecondaryMenuBackground.Alpha = 1; + //Console.WriteLine(">>>>>>>>>>> MLB - Scale 0.8f"); + cell.TextLabel.Transform = CGAffineTransform.MakeScale(0.86f, 0.86f); cell.PlayButton.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 182, 4, 44, 44); cell.AddButton.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 130, 4, 44, 44); cell.DeleteButton.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 78, 4, 44, 44); + cell.SecondaryMenuBackground.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 188, 4, 188, 44); }, null); } } @@ -537,6 +436,7 @@ public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) cell.Tag = indexPath.Row; cell.Accessory = UITableViewCellAccessory.None; + cell.IsTextAnimationEnabled = true; cell.TextLabel.Font = UIFont.FromName("HelveticaNeue", 14); cell.TextLabel.Text = item.Title; cell.DetailTextLabel.Font = UIFont.FromName("HelveticaNeue-Light", 12); @@ -552,12 +452,7 @@ public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) cell.ImageAlbum1.Tag = 1; cell.ImageAlbum2.Tag = 2; cell.ImageAlbum3.Tag = 3; - - // Set offset for delete icon - if (indexPath.Row == _deleteCellIndex) - cell.RightOffset = 60; - else - cell.RightOffset = 0; + cell.RightOffset = 0; // Change title font when the item has a subtitle if(String.IsNullOrEmpty(item.Subtitle)) @@ -566,6 +461,19 @@ public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) cell.PlayButton.Alpha = _editingTableCellRowPosition == indexPath.Row ? 1 : 0; cell.AddButton.Alpha = _editingTableCellRowPosition == indexPath.Row ? 1 : 0; cell.DeleteButton.Alpha = _editingTableCellRowPosition == indexPath.Row ? 1 : 0; + cell.SecondaryMenuBackground.Alpha = _editingTableCellRowPosition == indexPath.Row ? 1 : 0; + if (_editingTableCellRowPosition == indexPath.Row) + { + cell.TextLabel.Transform = CGAffineTransform.MakeScale(0.86f, 0.86f); + cell.DetailTextLabel.Transform = CGAffineTransform.MakeScale(0.9f, 0.9f); + cell.IndexTextLabel.Transform = CGAffineTransform.MakeScale(0.9f, 0.9f); + } + else + { + cell.TextLabel.Transform = CGAffineTransform.MakeScale(1f, 1f); + cell.DetailTextLabel.Transform = CGAffineTransform.MakeScale(1f, 1f); + cell.IndexTextLabel.Transform = CGAffineTransform.MakeScale(1f, 1f); + } if (_browserType == MobileLibraryBrowserType.Songs) { @@ -591,7 +499,7 @@ public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) albumFetchCount = item.AlbumTitles.Count == 3 ? 3 : albumFetchCount; // //albumFetchCount = item.AlbumTitles.Count == 3 ? 3 : item.AlbumTitles.Count; // Do not load a third album art when the count is visible! - Console.WriteLine("GetCell - title: {0} index: {1} albumFetchCount: {2}", item.Title, indexPath.Row, albumFetchCount); + //Console.WriteLine("GetCell - title: {0} index: {1} albumFetchCount: {2}", item.Title, indexPath.Row, albumFetchCount); int startIndex = 0; if (item.AlbumTitles.Count > 3) @@ -614,12 +522,12 @@ public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) KeyValuePair keyPair = _thumbnailImageCache.FirstOrDefault(x => x.Key == key); if (keyPair.Equals(default(KeyValuePair))) { - Console.WriteLine("MLBVC - GetCell - OnRequestAlbumArt - index: {0} key: {1}", indexPath.Row, key); + //Console.WriteLine("MLBVC - GetCell - OnRequestAlbumArt - index: {0} key: {1}", indexPath.Row, key); OnRequestAlbumArt(item.Query.ArtistName, item.AlbumTitles[a], imageAlbum); } else { - Console.WriteLine("MLBVC - GetCell - Taking image from cache - index: {0} key: {1}", indexPath.Row, key); + //Console.WriteLine("MLBVC - GetCell - Taking image from cache - index: {0} key: {1}", indexPath.Row, key); imageAlbum.Image = keyPair.Value; } @@ -646,15 +554,11 @@ public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) [Export ("tableView:didSelectRowAtIndexPath:")] public void RowSelected(UITableView tableView, NSIndexPath indexPath) { - if(_deleteCellIndex >= 0) + if (indexPath.Row == _editingTableCellRowPosition) { - UIView.Animate(0.2, () => { - var cell = (MPfmTableViewCell)tableView.CellAt(indexPath); - _deleteCellIndex = -1; - _btnDelete.Alpha = 0; - _btnDelete.Frame = new RectangleF(cell.Frame.Width + 60, _btnDelete.Frame.Y, 60, _btnDelete.Frame.Height); - cell.ImageChevron.Frame = new RectangleF(cell.Frame.Width - cell.ImageChevron.Bounds.Width, 0, cell.ImageChevron.Bounds.Width, cell.ImageChevron.Bounds.Height); - }); + tableView.DeselectRow(indexPath, true); + ResetEditingTableCellRow(); + return; } OnItemClick(indexPath.Row); @@ -667,7 +571,8 @@ public void DidHighlightRowAtIndexPath(UITableView tableView, NSIndexPath indexP if (cell == null) return; - ResetEditingTableCellRow(); + if(indexPath.Row != _editingTableCellRowPosition) + ResetEditingTableCellRow(); cell.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron_white"); cell.RightImage.Image = UIImage.FromBundle("Images/Icons/icon_speaker_white"); } @@ -796,7 +701,7 @@ public async void RefreshAlbumArtCell(string artistName, string albumTitle, byte }); var task = Task.Factory.StartNew(() => { - Console.WriteLine("MLBVC - RefreshAlbumArtCell - artistName: {0} albumTitle: {1} browserType: {2} height: {3}", artistName, albumTitle, _browserType, height); + //Console.WriteLine("MLBVC - RefreshAlbumArtCell - artistName: {0} albumTitle: {1} browserType: {2} height: {3}", artistName, albumTitle, _browserType, height); try { using (NSData imageData = NSData.FromArray(albumArtData)) @@ -806,7 +711,7 @@ public async void RefreshAlbumArtCell(string artistName, string albumTitle, byte if (imageFullSize != null) { UIImage imageResized = CoreGraphicsHelper.ScaleImage(imageFullSize, height); - Console.WriteLine("MLBVC - RefreshAlbumArtCell - Image resized!"); + //Console.WriteLine("MLBVC - RefreshAlbumArtCell - Image resized!"); return imageResized; } } @@ -817,7 +722,7 @@ public async void RefreshAlbumArtCell(string artistName, string albumTitle, byte Console.WriteLine("Error resizing image " + artistName + " - " + albumTitle + ": " + ex.Message); } - Console.WriteLine("MLBVC - RefreshAlbumArtCell - Returning null"); + //Console.WriteLine("MLBVC - RefreshAlbumArtCell - Returning null"); return null; }); @@ -825,7 +730,7 @@ public async void RefreshAlbumArtCell(string artistName, string albumTitle, byte //UIImage image = t.Result; UIImage image = await task; - Console.WriteLine("MLBVC - RefreshAlbumArtCell - ContinueWith - artistName: {0} albumTitle: {1} browserType: {2} userData==null: {3} image==null: {4}", artistName, albumTitle, _browserType, userData == null, image == null); + //Console.WriteLine("MLBVC - RefreshAlbumArtCell - ContinueWith - artistName: {0} albumTitle: {1} browserType: {2} userData==null: {3} image==null: {4}", artistName, albumTitle, _browserType, userData == null, image == null); if(image == null) return; diff --git a/MPfm/MPfm.iOS/Classes/Controllers/SelectPlaylistViewController.cs b/MPfm/MPfm.iOS/Classes/Controllers/SelectPlaylistViewController.cs index 2eb89cbc..edb3b333 100644 --- a/MPfm/MPfm.iOS/Classes/Controllers/SelectPlaylistViewController.cs +++ b/MPfm/MPfm.iOS/Classes/Controllers/SelectPlaylistViewController.cs @@ -49,22 +49,14 @@ public override void ViewDidLoad() base.ViewDidLoad(); } - public override void ViewWillAppear(bool animated) - { - base.ViewWillAppear(animated); - - MPfmNavigationController navCtrl = (MPfmNavigationController)this.NavigationController; - navCtrl.SetTitle("Select a playlist", ""); - } - partial void actionAddNewPlaylist(NSObject sender) { - + OnAddNewPlaylist(); } partial void actionSelect(NSObject sender) { - + //OnSelectPlaylist(); } partial void actionCancel(NSObject sender) @@ -87,19 +79,17 @@ public int RowsInSection(UITableView tableview, int section) [Export ("tableView:cellForRowAtIndexPath:")] public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { - MPfmTableViewCell cell = (MPfmTableViewCell)tableView.DequeueReusableCell(_cellIdentifier); + MPfmPlaylistTableViewCell cell = (MPfmPlaylistTableViewCell)tableView.DequeueReusableCell(_cellIdentifier); if (cell == null) { var cellStyle = UITableViewCellStyle.Subtitle; - cell = new MPfmTableViewCell(cellStyle, _cellIdentifier); + cell = new MPfmPlaylistTableViewCell(cellStyle, _cellIdentifier); } - //cell.ImageView.Alpha = 0.7f; cell.Accessory = UITableViewCellAccessory.None; - //cell.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron"); - //cell.ImageChevron.Hidden = false; cell.TextLabel.Font = UIFont.FromName("HelveticaNeue-Light", 16); cell.TextLabel.Text = _items[indexPath.Row].Name; + cell.TextLabel.TextColor = UIColor.White; UIView viewBackgroundSelected = new UIView(); viewBackgroundSelected.BackgroundColor = GlobalTheme.SecondaryColor; @@ -111,23 +101,9 @@ public UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) [Export ("tableView:didSelectRowAtIndexPath:")] public void RowSelected(UITableView tableView, NSIndexPath indexPath) { - //OnItemClick(_items[indexPath.Row].Key); + tableView.DeselectRow(indexPath, true); } -// [Export ("tableView:didHighlightRowAtIndexPath:")] -// public void DidHighlightRowAtIndexPath(UITableView tableView, NSIndexPath indexPath) -// { -// var cell = (MPfmTableViewCell)tableView.CellAt(indexPath); -// cell.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron_white"); -// } -// -// [Export ("tableView:didUnhighlightRowAtIndexPath:")] -// public void DidUnhighlightRowAtIndexPath(UITableView tableView, NSIndexPath indexPath) -// { -// var cell = (MPfmTableViewCell)tableView.CellAt(indexPath); -// cell.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron"); -// } - [Export ("tableView:heightForRowAtIndexPath:")] public float HeightForRow(UITableView tableView, NSIndexPath indexPath) { @@ -158,4 +134,3 @@ public void RefreshPlaylists(List playlists) #endregion } } - diff --git a/MPfm/MPfm.iOS/Classes/Controls/MPfmButton.cs b/MPfm/MPfm.iOS/Classes/Controls/MPfmButton.cs index 6a168fa7..d397cb91 100644 --- a/MPfm/MPfm.iOS/Classes/Controls/MPfmButton.cs +++ b/MPfm/MPfm.iOS/Classes/Controls/MPfmButton.cs @@ -98,10 +98,10 @@ private void AnimatePress(bool on) { UIView.Animate(0.1, () => { BackgroundColor = GlobalTheme.SecondaryColor; - if (LabelAlignment == UIControlContentHorizontalAlignment.Left) - TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X + 8, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); - else if (LabelAlignment == UIControlContentHorizontalAlignment.Right) - TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X - 4, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); +// if (LabelAlignment == UIControlContentHorizontalAlignment.Left) +// TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X + 8, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); +// else if (LabelAlignment == UIControlContentHorizontalAlignment.Right) +// TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X - 4, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); TitleLabel.Transform = CGAffineTransform.MakeScale(1, 1); Image.Transform = CGAffineTransform.MakeScale(1, 1); @@ -114,10 +114,10 @@ private void AnimatePress(bool on) TitleLabel.Transform = CGAffineTransform.MakeScale(0.9f, 0.9f); Image.Transform = CGAffineTransform.MakeScale(0.9f, 0.9f); - if(LabelAlignment == UIControlContentHorizontalAlignment.Left) - TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X - 8, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); - else if(LabelAlignment == UIControlContentHorizontalAlignment.Right) - TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X + 4, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); +// if(LabelAlignment == UIControlContentHorizontalAlignment.Left) +// TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X - 8, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); +// else if(LabelAlignment == UIControlContentHorizontalAlignment.Right) +// TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X + 4, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); }); } } diff --git a/MPfm/MPfm.iOS/Classes/Controls/MPfmImageButton.cs b/MPfm/MPfm.iOS/Classes/Controls/MPfmImageButton.cs index 547a21fa..7fc85c14 100644 --- a/MPfm/MPfm.iOS/Classes/Controls/MPfmImageButton.cs +++ b/MPfm/MPfm.iOS/Classes/Controls/MPfmImageButton.cs @@ -58,12 +58,14 @@ private void Initialize() public override void TouchesBegan(NSSet touches, UIEvent evt) { + Console.WriteLine("MPfmImageButton - TouchesBegan"); AnimatePress(true); base.TouchesBegan(touches, evt); } public override void TouchesEnded(NSSet touches, UIEvent evt) { + Console.WriteLine("MPfmImageButton - TouchesEnded"); AnimatePress(false); if (OnButtonClick != null) @@ -74,6 +76,7 @@ public override void TouchesEnded(NSSet touches, UIEvent evt) public override void TouchesCancelled(NSSet touches, UIEvent evt) { + Console.WriteLine("MPfmImageButton - TouchesCancelled"); AnimatePress(false); base.TouchesCancelled(touches, evt); } @@ -84,14 +87,14 @@ private void AnimatePress(bool on) { UIView.Animate(0.1, () => { BackgroundColor = UIColor.FromRGBA(80, 80, 80, 225); - ImageView.Transform = CGAffineTransform.MakeScale(1, 1); + //ImageView.Transform = CGAffineTransform.MakeScale(1, 1); }); } else { UIView.Animate(0.1, () => { BackgroundColor = UIColor.FromRGBA(50, 50, 50, 255); - ImageView.Transform = CGAffineTransform.MakeScale(0.7f, 0.7f); + //ImageView.Transform = CGAffineTransform.MakeScale(0.7f, 0.7f); }); } } diff --git a/MPfm/MPfm.iOS/Classes/Controls/MPfmPlaylistTableViewCell.cs b/MPfm/MPfm.iOS/Classes/Controls/MPfmPlaylistTableViewCell.cs new file mode 100644 index 00000000..f6bb6b45 --- /dev/null +++ b/MPfm/MPfm.iOS/Classes/Controls/MPfmPlaylistTableViewCell.cs @@ -0,0 +1,177 @@ +// 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 . + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using MonoTouch.Foundation; +using MonoTouch.UIKit; +using MPfm.MVP.Bootstrap; +using MPfm.MVP.Navigation; +using MonoTouch.CoreAnimation; +using MonoTouch.CoreGraphics; +using MPfm.iOS.Classes.Objects; +using MPfm.iOS.Helpers; + +namespace MPfm.iOS.Classes.Controls +{ + [Register("MPfmPlaylistTableViewCell")] + public class MPfmPlaylistTableViewCell : UITableViewCell + { + public UIButton RightButton { get; private set; } + + public MPfmPlaylistTableViewCell() : base() + { + Initialize(); + } + + public MPfmPlaylistTableViewCell(RectangleF frame) : base(frame) + { + Initialize(); + } + + public MPfmPlaylistTableViewCell(UITableViewCellStyle style, string reuseIdentifier) : base(style, reuseIdentifier) + { + Initialize(); + } + + public void Initialize() + { + var screenSize = UIKitHelper.GetDeviceSize(); + + UIView backView = new UIView(Frame); + backView.BackgroundColor = GlobalTheme.BackgroundColor; + BackgroundView = backView; + BackgroundColor = UIColor.White; + + UIView backViewSelected = new UIView(Frame); + backViewSelected.BackgroundColor = GlobalTheme.SecondaryColor; + SelectedBackgroundView = backViewSelected; + + TextLabel.BackgroundColor = UIColor.FromWhiteAlpha(0, 0); + TextLabel.Font = UIFont.FromName("HelveticaNeue-Medium", 14); + TextLabel.TextColor = UIColor.White; + TextLabel.HighlightedTextColor = UIColor.White; + DetailTextLabel.TextColor = UIColor.Gray; + DetailTextLabel.HighlightedTextColor = UIColor.White; + DetailTextLabel.Font = UIFont.FromName("HelveticaNeue", 12); + ImageView.BackgroundColor = UIColor.White; + + RightButton = new UIButton(UIButtonType.Custom); + RightButton.Hidden = true; + RightButton.Frame = new RectangleF(screenSize.Width - Bounds.Height, 4, Bounds.Height, Bounds.Height); + AddSubview(RightButton); + + // Make sure the text label is over all other subviews + TextLabel.RemoveFromSuperview(); + AddSubview(TextLabel); + } + + public override void LayoutSubviews() + { + base.LayoutSubviews(); + + var screenSize = UIKitHelper.GetDeviceSize(); + float padding = 8; + + // Determine width available for text + float textWidth = Bounds.Width; + if (Accessory != UITableViewCellAccessory.None) + textWidth -= 44; + if (ImageView.Image != null && !ImageView.Hidden) + textWidth -= 44 + padding; + if (RightButton.ImageView.Image != null) + textWidth -= 44 + padding; + + float x = 0; + if (ImageView.Image != null) + { + ImageView.Frame = new RectangleF(x, 4, 44, 44); + x += 44 + padding; + } + else + { + x += padding; + } + + float titleY = 10 + 4; + if (!string.IsNullOrEmpty(DetailTextLabel.Text)) + titleY = 2 + 4; + + //TextLabel.Frame = new RectangleF(x, titleY, textWidth, 22); + if (!string.IsNullOrEmpty(DetailTextLabel.Text)) + DetailTextLabel.Frame = new RectangleF(x, 22 + 4, textWidth, 16); + + if (RightButton.ImageView.Image != null || !string.IsNullOrEmpty(RightButton.Title(UIControlState.Normal))) + RightButton.Frame = new RectangleF(screenSize.Width - 44, 4, 44, 44); + + } + + public override void TouchesBegan(NSSet touches, UIEvent evt) + { + AnimatePress(true); + base.TouchesBegan(touches, evt); + } + + public override void TouchesEnded(NSSet touches, UIEvent evt) + { + AnimatePress(false); + base.TouchesEnded(touches, evt); + } + + public override void TouchesCancelled(NSSet touches, UIEvent evt) + { + AnimatePress(false); + base.TouchesCancelled(touches, evt); + } + + private void AnimatePress(bool on) + { + if (!on) + { + UIView.Animate(0.2, () => { + //BackgroundColor = GlobalTheme.SecondaryColor; + // if (LabelAlignment == UIControlContentHorizontalAlignment.Left) + // TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X + 8, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); + // else if (LabelAlignment == UIControlContentHorizontalAlignment.Right) + // TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X - 4, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); + + //TextLabel.Frame = new RectangleF(TextLabel.Frame.X - 26, TextLabel.Frame.Y, TextLabel.Frame.Width, TextLabel.Frame.Height); + //Console.WriteLine(">>>>>>>>>>> TVC - Scale 1"); + if(TextLabel.Transform.xx < 0.95f) return; // Ignore when scale is lower; it was done on purpose and will be restored to 1 later. + TextLabel.Transform = CGAffineTransform.MakeScale(1, 1); + //Image.Transform = CGAffineTransform.MakeScale(1, 1); + }); + } + else + { + UIView.Animate(0.2, () => { + //BackgroundColor = GlobalTheme.SecondaryDarkColor; + //Console.WriteLine(">>>>>>>>>>> TVC - Scale 0.95f"); + TextLabel.Transform = CGAffineTransform.MakeScale(0.9f, 0.9f); + //Image.Transform = CGAffineTransform.MakeScale(0.9f, 0.9f); + //TextLabel.Frame = new RectangleF(TextLabel.Frame.X + 26, TextLabel.Frame.Y, TextLabel.Frame.Width, TextLabel.Frame.Height); + // if(LabelAlignment == UIControlContentHorizontalAlignment.Left) + //TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X - 8, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); + // else if(LabelAlignment == UIControlContentHorizontalAlignment.Right) + // TitleLabel.Frame = new RectangleF(TitleLabel.Frame.X + 4, TitleLabel.Frame.Y, TitleLabel.Frame.Width, TitleLabel.Frame.Height); + }); + } + } + } +} diff --git a/MPfm/MPfm.iOS/Classes/Controls/MPfmTabBar.cs b/MPfm/MPfm.iOS/Classes/Controls/MPfmTabBar.cs index 2051140c..f9fdf0bf 100644 --- a/MPfm/MPfm.iOS/Classes/Controls/MPfmTabBar.cs +++ b/MPfm/MPfm.iOS/Classes/Controls/MPfmTabBar.cs @@ -30,8 +30,8 @@ public class MPfmTabBar : UITabBar { public MPfmTabBar() : base() { - TintColor = UIColor.FromRGBA(0.3f, 0.3f, 0.3f, 1); - SelectedImageTintColor = UIColor.White; + //TintColor = UIColor.FromRGBA(0.3f, 0.3f, 0.3f, 1); + //SelectedImageTintColor = UIColor.White; } public MPfmTabBar(IntPtr handle) : base (handle) diff --git a/MPfm/MPfm.iOS/Classes/Controls/MPfmTableViewCell.cs b/MPfm/MPfm.iOS/Classes/Controls/MPfmTableViewCell.cs index 2dc045d3..e61df570 100644 --- a/MPfm/MPfm.iOS/Classes/Controls/MPfmTableViewCell.cs +++ b/MPfm/MPfm.iOS/Classes/Controls/MPfmTableViewCell.cs @@ -41,11 +41,14 @@ public class MPfmTableViewCell : UITableViewCell public UIImageView ImageAlbum2 { get; private set; } public UIImageView ImageAlbum3 { get; private set; } public UILabel AlbumCountLabel { get; private set; } + public UIView SecondaryMenuBackground { get; private set; } public MPfmImageButton PlayButton { get; set; } public MPfmImageButton AddButton { get; set; } public MPfmImageButton DeleteButton { get; set; } + public bool IsTextAnimationEnabled { get; set; } + public float RightOffset { get; set; } public delegate void RightButtonTap(MPfmTableViewCell cell); @@ -68,16 +71,20 @@ public MPfmTableViewCell(UITableViewCellStyle style, string reuseIdentifier) : b public void Initialize() { + IsTextAnimationEnabled = false; + SelectionStyle = UITableViewCellSelectionStyle.None; var screenSize = UIKitHelper.GetDeviceSize(); - UIView backView = new UIView(Frame); - backView.BackgroundColor = GlobalTheme.LightColor; - BackgroundView = backView; - BackgroundColor = UIColor.White; +// UIView backView = new UIView(Frame); +// backView.BackgroundColor = GlobalTheme.LightColor; +// BackgroundView = backView; +// BackgroundColor = UIColor.White; UIView backViewSelected = new UIView(Frame); backViewSelected.BackgroundColor = GlobalTheme.SecondaryColor; - SelectedBackgroundView = backViewSelected; + SelectedBackgroundView = backViewSelected; + SelectedBackgroundView.Hidden = true; + AddSubview(SelectedBackgroundView); ImageAlbum1 = new UIImageView(); ImageAlbum1.BackgroundColor = UIColor.White; @@ -112,15 +119,21 @@ public void Initialize() AlbumCountLabel.HighlightedTextColor = UIColor.White; AddSubview(AlbumCountLabel); - TextLabel.BackgroundColor = UIColor.FromWhiteAlpha(0, 0); + TextLabel.Layer.AnchorPoint = new PointF(0, 0.5f); + TextLabel.BackgroundColor = UIColor.Clear; TextLabel.Font = UIFont.FromName("HelveticaNeue-Medium", 14); TextLabel.TextColor = UIColor.Black; TextLabel.HighlightedTextColor = UIColor.White; + DetailTextLabel.Layer.AnchorPoint = new PointF(0, 0.5f); DetailTextLabel.TextColor = UIColor.Gray; DetailTextLabel.HighlightedTextColor = UIColor.White; DetailTextLabel.Font = UIFont.FromName("HelveticaNeue", 12); ImageView.BackgroundColor = UIColor.White; + // Make sure the text label is over all other subviews + DetailTextLabel.RemoveFromSuperview(); + AddSubview(DetailTextLabel); + IndexTextLabel = new UILabel(); IndexTextLabel.BackgroundColor = UIColor.Clear; IndexTextLabel.Font = UIFont.FromName("HelveticaNeue", 16); @@ -152,6 +165,12 @@ public void Initialize() TextLabel.RemoveFromSuperview(); AddSubview(TextLabel); + SecondaryMenuBackground = new UIView(); + SecondaryMenuBackground.BackgroundColor = UIColor.White; + SecondaryMenuBackground.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width, 4, 188, 44); + //SecondaryMenuBackground.Alpha = 0; + AddSubview(SecondaryMenuBackground); + PlayButton = new MPfmImageButton(new RectangleF(UIScreen.MainScreen.Bounds.Width - 182, 4, 44, 44)); PlayButton.SetImage(UIImage.FromBundle("Images/ContextualButtons/play"), UIControlState.Normal); PlayButton.Alpha = 0; @@ -176,7 +195,8 @@ private void HandleRightButtonTouchUpInside(object sender, EventArgs e) public override void LayoutSubviews() { - base.LayoutSubviews(); + //BackgroundView.Frame = new RectangleF(0, 0, Frame.Width, Frame.Height); + SelectedBackgroundView.Frame = new RectangleF(0, 0, Frame.Width, Frame.Height); var screenSize = UIKitHelper.GetDeviceSize(); float padding = 8; @@ -210,14 +230,15 @@ public override void LayoutSubviews() } else { - x += padding; + x += padding + (padding / 2); } float titleY = 10 + 4; if (!string.IsNullOrEmpty(DetailTextLabel.Text)) titleY = 2 + 4; - TextLabel.Frame = new RectangleF(x, titleY, textWidth, 22); + if (_isTextLabelAllowedToChangeFrame) + TextLabel.Frame = new RectangleF(x, titleY, textWidth, 22); if (!string.IsNullOrEmpty(DetailTextLabel.Text)) DetailTextLabel.Frame = new RectangleF(x, 22 + 4, textWidth, 16); @@ -231,5 +252,93 @@ public override void LayoutSubviews() else RightImage.Frame = new RectangleF(screenSize.Width - 66 - RightOffset, 4, 44, 44); } + + public override void SetHighlighted(bool highlighted, bool animated) + { + SelectedBackgroundView.Alpha = 1; + SelectedBackgroundView.Hidden = !highlighted; + TextLabel.TextColor = highlighted ? UIColor.White : UIColor.Black; + DetailTextLabel.Highlighted = highlighted; + IndexTextLabel.Highlighted = highlighted; + DetailTextLabel.TextColor = highlighted ? UIColor.White : UIColor.Gray; + //IndexTextLabel.TextColor = highlighted ? UIColor.White : UIColor.FromRGBA(0.5f, 0.5f, 0.5f, 1); + SecondaryMenuBackground.BackgroundColor = highlighted ? GlobalTheme.SecondaryColor : GlobalTheme.LightColor; + + base.SetHighlighted(highlighted, animated); + } + + public override void SetSelected(bool selected, bool animated) + { + if(selected) + SecondaryMenuBackground.BackgroundColor = GlobalTheme.SecondaryColor; + + TextLabel.TextColor = selected ? UIColor.White : UIColor.Black; + DetailTextLabel.TextColor = selected ? UIColor.White : UIColor.Gray; + //IndexTextLabel.TextColor = selected ? UIColor.White : UIColor.FromRGBA(0.5f, 0.5f, 0.5f, 1); + + if (!selected) + { + UIView.Animate(0.5, () => { + SelectedBackgroundView.Alpha = 0; + }, () => { + SelectedBackgroundView.Hidden = true; + }); + } + else + { + SelectedBackgroundView.Hidden = false; + SelectedBackgroundView.Alpha = 1; + } + + base.SetSelected(selected, animated); + } + + public override void TouchesBegan(NSSet touches, UIEvent evt) + { + AnimatePress(true); + base.TouchesBegan(touches, evt); + } + + public override void TouchesEnded(NSSet touches, UIEvent evt) + { + AnimatePress(false); + base.TouchesEnded(touches, evt); + } + + public override void TouchesCancelled(NSSet touches, UIEvent evt) + { + AnimatePress(false); + base.TouchesCancelled(touches, evt); + } + + private bool _isTextLabelAllowedToChangeFrame = true; + + private void AnimatePress(bool on) + { + if (!IsTextAnimationEnabled) + return; + + _isTextLabelAllowedToChangeFrame = !on; + + if (!on) + { + UIView.Animate(0.1, 0, UIViewAnimationOptions.CurveEaseIn, () => { + // Ignore when scale is lower; it was done on purpose and will be restored to 1 later. + if(TextLabel.Transform.xx < 0.95f) return; + + TextLabel.Transform = CGAffineTransform.MakeScale(1, 1); + DetailTextLabel.Transform = CGAffineTransform.MakeScale(1, 1); + IndexTextLabel.Transform = CGAffineTransform.MakeScale(1, 1); + }, null); + } + else + { + UIView.Animate(0.1, 0, UIViewAnimationOptions.CurveEaseIn, () => { + TextLabel.Transform = CGAffineTransform.MakeScale(0.96f, 0.96f); + DetailTextLabel.Transform = CGAffineTransform.MakeScale(0.9f, 0.9f); + IndexTextLabel.Transform = CGAffineTransform.MakeScale(0.9f, 0.9f); + }, null); + } + } } } diff --git a/MPfm/MPfm.iOS/Classes/Delegates/AppDelegate.cs b/MPfm/MPfm.iOS/Classes/Delegates/AppDelegate.cs index 4a8e407c..7c20c3ac 100644 --- a/MPfm/MPfm.iOS/Classes/Delegates/AppDelegate.cs +++ b/MPfm/MPfm.iOS/Classes/Delegates/AppDelegate.cs @@ -65,9 +65,8 @@ public override bool FinishedLaunching(UIApplication app, NSDictionary options) UINavigationBar.Appearance.BackgroundColor = GlobalTheme.MainColor; UIToolbar.Appearance.SetBackgroundImage(new UIImage(), UIToolbarPosition.Bottom, UIBarMetrics.Default); UIToolbar.Appearance.BackgroundColor = GlobalTheme.MainColor; - UITabBar.Appearance.SelectionIndicatorImage = new UIImage(); - UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.BlackOpaque; - + UITabBar.Appearance.TintColor = UIColor.White; + UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent; _window = new MPfmWindow(UIScreen.MainScreen.Bounds); _window.TintColor = GlobalTheme.SecondaryColor; diff --git a/MPfm/MPfm.iOS/MPfm.iOS.csproj b/MPfm/MPfm.iOS/MPfm.iOS.csproj index 7fe9b4df..a0b1aaac 100644 --- a/MPfm/MPfm.iOS/MPfm.iOS.csproj +++ b/MPfm/MPfm.iOS/MPfm.iOS.csproj @@ -266,6 +266,9 @@ + + MPfmCollectionViewCell.cs + diff --git a/MPfm/MPfm.iOS/XIB/iPhone/AddPlaylistViewController_iPhone.xib b/MPfm/MPfm.iOS/XIB/iPhone/AddPlaylistViewController_iPhone.xib index b0867e75..b6b07e3c 100644 --- a/MPfm/MPfm.iOS/XIB/iPhone/AddPlaylistViewController_iPhone.xib +++ b/MPfm/MPfm.iOS/XIB/iPhone/AddPlaylistViewController_iPhone.xib @@ -1,118 +1,74 @@ - - - - 1280 - 11C25 - 1919 - 1138.11 - 566.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 916 - - - IBProxyObject - IBUIView - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - {{0, 20}, {320, 460}} - - - - 3 - MQA - - 2 - - - - IBCocoaTouchFramework - - - - - - - view - - - - 3 - - - - - - 0 - - - - - - 1 - - - - - -1 - - - File's Owner - - - -2 - - - - - - - AddPlaylistViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 3 - - - - - AddPlaylistViewController - UIViewController - - IBProjectSource - AddPlaylistViewController.h - - - - - 0 - IBCocoaTouchFramework - YES - 3 - 916 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MPfm/MPfm.iOS/XIB/iPhone/EqualizerPresetDetailsViewController_iPhone.xib b/MPfm/MPfm.iOS/XIB/iPhone/EqualizerPresetDetailsViewController_iPhone.xib index c5d14b92..a2d00b17 100644 --- a/MPfm/MPfm.iOS/XIB/iPhone/EqualizerPresetDetailsViewController_iPhone.xib +++ b/MPfm/MPfm.iOS/XIB/iPhone/EqualizerPresetDetailsViewController_iPhone.xib @@ -1,391 +1,63 @@ - - - - 1552 - 12D78 - 3084 - 1187.37 - 626.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 2083 - - - IBProxyObject - IBUILabel - IBUIScrollView - IBUITextField - IBUIToolbar - IBUIView - - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 274 - - - - 292 - - - - 292 - {{10, 65}, {96, 21}} - - - - _NS:9 - NO - YES - 7 - NO - IBCocoaTouchFramework - Preset Name: - - 3 - MQA - - - 0 - - HelveticaNeue-Light - Helvetica Neue - 0 - 14 - - - HelveticaNeue-Medium - 14 - 16 - - NO - - - - 292 - {{107, 63}, {200, 27}} - - - - _NS:9 - - NO - YES - IBCocoaTouchFramework - 0 - - - 3 - MAA - - 2 - - - YES - 17 - - 9 - YES - IBCocoaTouchFramework - - - 1 - 14 - - - Helvetica - 14 - 16 - - - - - 290 - {320, 60} - - - - _NS:9 - - 3 - MAA - - IBCocoaTouchFramework - - - {320, 94} - - - - _NS:9 - - 3 - MC42NjY2NjY2NjY3AA - - IBCocoaTouchFramework - - - - 274 - {{0, 94}, {320, 322}} - - - - _NS:9 - YES - YES - IBCocoaTouchFramework - - - - 266 - {{0, 416}, {320, 44}} - - - _NS:9 - NO - NO - IBCocoaTouchFramework - - - - {{0, 20}, {320, 460}} - - - - - 3 - MQA - - - - IBCocoaTouchFramework - - - - - - - view - - - - 3 - - - - lblPresetName - - - - 15 - - - - txtPresetName - - - - 16 - - - - scrollView - - - - 17 - - - - toolbar - - - - 18 - - - - viewOptions - - - - 21 - - - - presetGraph - - - - 23 - - - - - - 0 - - - - - - 1 - - - - - - - - - - -1 - - - File's Owner - - - -2 - - - - - 7 - - - - - - - - - - 9 - - - - - 10 - - - - - 11 - - - - - 12 - - - - - - 22 - - - - - - - EqualizerPresetDetailsViewController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - MPfmEqualizerPresetGraphView - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - - - 23 - - - - - EqualizerPresetDetailsViewController - UIViewController - - UIBarButtonItem - UILabel - MPfmEqualizerPresetGraphView - UIScrollView - UIToolbar - UITextField - UIView - - - - btnReset - UIBarButtonItem - - - lblPresetName - UILabel - - - presetGraph - MPfmEqualizerPresetGraphView - - - scrollView - UIScrollView - - - toolbar - UIToolbar - - - txtPresetName - UITextField - - - viewOptions - UIView - - - - IBProjectSource - ./Classes/EqualizerPresetDetailsViewController.h - - - - MPfmEqualizerPresetGraphView - UIView - - IBProjectSource - ./Classes/MPfmEqualizerPresetGraphView.h - - - - - 0 - IBCocoaTouchFramework - YES - 3 - 2083 - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MPfm/MPfm.iOS/XIB/iPhone/SyncMenuViewController_iPhone.xib b/MPfm/MPfm.iOS/XIB/iPhone/SyncMenuViewController_iPhone.xib index fe416082..d2eccaff 100644 --- a/MPfm/MPfm.iOS/XIB/iPhone/SyncMenuViewController_iPhone.xib +++ b/MPfm/MPfm.iOS/XIB/iPhone/SyncMenuViewController_iPhone.xib @@ -27,17 +27,11 @@ -