Skip to content

Commit

Permalink
iOS: Adjusted all UITableViewCell heights to 52 to match Android heig…
Browse files Browse the repository at this point in the history
…ht. This will also leave space for loading the album art in the Artist cells.

Related to issue #405.
  • Loading branch information
ycastonguay committed Sep 17, 2013
1 parent 95101fc commit 07d1260
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 16 deletions.
1 change: 1 addition & 0 deletions MPfm/MPfm.Library/MPfm.Library.iOS.csproj
Expand Up @@ -160,6 +160,7 @@
<EmbeddedResource Include="WebApp\images\icon_download.png" />
<EmbeddedResource Include="WebApp\images\icon_upload.png" />
<EmbeddedResource Include="Scripts\1.04-1.05.sql" />
<EmbeddedResource Include="Scripts\1.05-1.06.sql" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Expand Up @@ -199,6 +199,12 @@ public void RowSelected(UITableView tableView, NSIndexPath indexPath)
tableView.DeselectRow(indexPath, true);
}

[Export ("tableView:heightForRowAtIndexPath:")]
public float HeightForRow(UITableView tableView, NSIndexPath indexPath)
{
return 52;
}

private void SetCheckmarkCell(NSIndexPath indexPath)
{
_selectedPresetId = _presets[indexPath.Row].EQPresetId;
Expand Down
Expand Up @@ -413,7 +413,7 @@ public void DidUnhighlightRowAtIndexPath(UITableView tableView, NSIndexPath inde
[Export ("tableView:heightForRowAtIndexPath:")]
public float HeightForRow(UITableView tableView, NSIndexPath indexPath)
{
return 44;
return 52;
}

#endregion
Expand Down
6 changes: 6 additions & 0 deletions MPfm/MPfm.iOS/Classes/Controllers/MoreViewController.cs
Expand Up @@ -145,6 +145,12 @@ public void DidUnhighlightRowAtIndexPath(UITableView tableView, NSIndexPath inde
cell.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron");
}

[Export ("tableView:heightForRowAtIndexPath:")]
public float HeightForRow(UITableView tableView, NSIndexPath indexPath)
{
return 52;
}

#region IMobileOptionsMenuView implementation

public Action<MobileOptionsMenuType> OnItemClick { get; set; }
Expand Down
Expand Up @@ -112,6 +112,12 @@ public void DidUnhighlightRowAtIndexPath(UITableView tableView, NSIndexPath inde
cell.ImageChevron.Image = UIImage.FromBundle("Images/Tables/chevron");
}

[Export ("tableView:heightForRowAtIndexPath:")]
public float HeightForRow(UITableView tableView, NSIndexPath indexPath)
{
return 52;
}

#region IPreferencesView implementation

public Action<string> OnSelectItem { get; set; }
Expand Down
6 changes: 6 additions & 0 deletions MPfm/MPfm.iOS/Classes/Controllers/SyncMenuViewController.cs
Expand Up @@ -225,6 +225,12 @@ private void RefreshCell(NSIndexPath indexPath)
tableView.ReloadRows(new NSIndexPath[1] { indexPath }, UITableViewRowAnimation.None);
}

[Export ("tableView:heightForRowAtIndexPath:")]
public float HeightForRow(UITableView tableView, NSIndexPath indexPath)
{
return 52;
}

#region ISyncMenuView implementation

public Action<SyncMenuItemEntity, object> OnExpandItem { get; set; }
Expand Down
6 changes: 6 additions & 0 deletions MPfm/MPfm.iOS/Classes/Controllers/SyncViewController.cs
Expand Up @@ -109,6 +109,12 @@ public void RowSelected(UITableView tableView, NSIndexPath indexPath)
OnConnectDevice(_devices[indexPath.Row]);
}

[Export ("tableView:heightForRowAtIndexPath:")]
public float HeightForRow(UITableView tableView, NSIndexPath indexPath)
{
return 52;
}

partial void actionConnectDeviceManually(NSObject sender)
{
// TODO: Popup window asking for host and port.
Expand Down
30 changes: 15 additions & 15 deletions MPfm/MPfm.iOS/Classes/Controls/MPfmTableViewCell.cs
Expand Up @@ -89,21 +89,21 @@ public void Initialize()

RightButton = new UIButton(UIButtonType.Custom);
RightButton.Hidden = true;
RightButton.Frame = new RectangleF(screenSize.Width - Bounds.Height, 0, Bounds.Height, Bounds.Height);
RightButton.Frame = new RectangleF(screenSize.Width - Bounds.Height, 4, Bounds.Height, Bounds.Height);
RightButton.TouchUpInside += HandleRightButtonTouchUpInside;
AddSubview(RightButton);

ImageChevron = new UIImageView(UIImage.FromBundle("Images/Tables/chevron"));
ImageChevron.BackgroundColor = UIColor.Clear;
ImageChevron.Hidden = true;
ImageChevron.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 22, 0, 22, 44);
ImageChevron.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 22, 4, 22, 44);
AddSubview(ImageChevron);

RightImage = new UIImageView(UIImage.FromBundle("Images/Icons/icon_speaker"));
RightImage.Alpha = 0.7f;
RightImage.BackgroundColor = UIColor.Clear;
RightImage.Hidden = true;
RightImage.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 66, 0, 44, 44);
RightImage.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Width - 66, 4, 44, 44);
AddSubview(RightImage);
}

Expand All @@ -125,9 +125,9 @@ public override void LayoutSubviews()
if (Accessory != UITableViewCellAccessory.None)
textWidth -= 44;
if (ImageView.Image != null && !ImageView.Hidden)
textWidth -= Bounds.Height + padding;
textWidth -= 44 + padding;
if (RightButton.ImageView.Image != null)
textWidth -= Bounds.Height + padding;
textWidth -= 44 + padding;
if (!string.IsNullOrEmpty(IndexTextLabel.Text))
textWidth -= 22 + padding + padding;
if (ImageChevron.Image != null && !ImageChevron.Hidden)
Expand All @@ -138,37 +138,37 @@ public override void LayoutSubviews()
float x = 0;
if (ImageView.Image != null)
{
ImageView.Frame = new RectangleF(x, 0, Bounds.Height, Bounds.Height);
x += Bounds.Height + padding;
ImageView.Frame = new RectangleF(x, 4, 44, 44);
x += 44 + padding;
}
else if (!string.IsNullOrEmpty(IndexTextLabel.Text))
{
x += padding;
IndexTextLabel.Frame = new RectangleF(x, 2, 22, 38);
IndexTextLabel.Frame = new RectangleF(x, 6, 22, 38);
x += 22 + padding;
}
else
{
x += padding;
}

float titleY = 10;
float titleY = 10 + 4;
if (!string.IsNullOrEmpty(DetailTextLabel.Text))
titleY = 2;
titleY = 2 + 4;

TextLabel.Frame = new RectangleF(x, titleY, textWidth, 22);
if (!string.IsNullOrEmpty(DetailTextLabel.Text))
DetailTextLabel.Frame = new RectangleF(x, 22, textWidth, 16);
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 - Bounds.Height, 0, Bounds.Height, Bounds.Height);
RightButton.Frame = new RectangleF(screenSize.Width - 44, 4, 44, 44);

ImageChevron.Frame = new RectangleF(screenSize.Width - 22 - RightOffset, 0, 22, 44);
ImageChevron.Frame = new RectangleF(screenSize.Width - 22 - RightOffset, 4, 22, 44);

if(ImageChevron.Hidden)
RightImage.Frame = new RectangleF(screenSize.Width - 44 - RightOffset, 0, 44, 44);
RightImage.Frame = new RectangleF(screenSize.Width - 44 - RightOffset, 4, 44, 44);
else
RightImage.Frame = new RectangleF(screenSize.Width - 66 - RightOffset, 0, 44, 44);
RightImage.Frame = new RectangleF(screenSize.Width - 66 - RightOffset, 4, 44, 44);
}
}
}

0 comments on commit 07d1260

Please sign in to comment.