Skip to content

Commit

Permalink
iOS: Fixed positioning issues in PreferencesTableViewCell. Added load…
Browse files Browse the repository at this point in the history
…ing and button to open Cloud Preferences for ResumePlaybackViewController.
  • Loading branch information
ycastonguay committed Nov 18, 2013
1 parent a2b80c9 commit 98078b1
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 25 deletions.
47 changes: 42 additions & 5 deletions MPfm/MPfm.iOS/Classes/Controllers/ResumePlaybackViewController.cs
Expand Up @@ -47,7 +47,16 @@ public override void ViewDidLoad()
tableView.WeakDataSource = this;
tableView.WeakDelegate = this;

this.View.BackgroundColor = GlobalTheme.BackgroundColor;
lblLoading.Alpha = 1;
activityIndicator.Alpha = 1;
lblTitle.Alpha = 0;
tableView.Alpha = 0;
viewAppNotLinked.Alpha = 0;

activityIndicator.StartAnimating();
View.BackgroundColor = GlobalTheme.BackgroundColor;
viewAppNotLinked.BackgroundColor = GlobalTheme.BackgroundColor;
btnOpenCloudPreferences.SetImage(UIImage.FromBundle("Images/Buttons/cloud"));

base.ViewDidLoad();

Expand All @@ -61,6 +70,8 @@ public override void ViewWillAppear(bool animated)

MPfmNavigationController navCtrl = (MPfmNavigationController)this.NavigationController;
navCtrl.SetTitle("Resume Playback");

OnCheckCloudLoginStatus();
}

[Export ("tableView:numberOfRowsInSection:")]
Expand Down Expand Up @@ -122,6 +133,11 @@ public float HeightForRow(UITableView tableView, NSIndexPath indexPath)
//Console.WriteLine("indexPath: {0}", indexPath);
}

partial void actionOpenCloudPreferences(NSObject sender)
{
OnOpenPreferencesView();
}

#region IResumePlaybackView implementation

public Action<CloudDeviceInfo> OnResumePlayback { get; set; }
Expand All @@ -130,22 +146,43 @@ public float HeightForRow(UITableView tableView, NSIndexPath indexPath)

public void ResumePlaybackError(Exception ex)
{
InvokeOnMainThread(() => {
UIAlertView alertView = new UIAlertView("ResumePlayback Error", ex.Message, null, "OK", null);
alertView.Show();
});
ShowErrorDialog(ex);
}

public void RefreshDevices(IEnumerable<CloudDeviceInfo> devices)
{
Console.WriteLine("ResumePlaybackViewController - RefreshDevices - devices.Count: {0}", devices.Count());
InvokeOnMainThread(() => {
lblTitle.Alpha = 0;
tableView.Alpha = 0;
activityIndicator.StopAnimating();
UIView.Animate(0.2, () => {
lblTitle.Alpha = 1;
tableView.Alpha = 1;
lblLoading.Alpha = 0;
activityIndicator.Alpha = 0;
});
_devices = devices.ToList();
tableView.ReloadData();
});
}

public void RefreshAppLinkedStatus(bool isAppLinked)
{
Console.WriteLine("ResumePlaybackViewController - RefreshAppLinkedStatus - isAppLinked: {0}", isAppLinked);
InvokeOnMainThread(() => {
activityIndicator.StopAnimating();
UIView.Animate(0.2, () => {
lblLoading.Alpha = 0;
activityIndicator.Alpha = 0;
lblTitle.Alpha = isAppLinked ? 1 : 0;
tableView.Alpha = isAppLinked ? 1 : 0;
viewAppNotLinked.Alpha = isAppLinked ? 0 : 1;
});
});
}

#endregion
Expand Down

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

2 changes: 2 additions & 0 deletions MPfm/MPfm.iOS/Classes/Controls/MPfmPreferenceTableViewCell.cs
Expand Up @@ -166,11 +166,13 @@ public override void LayoutSubviews()
{
if (IsLargeIcon)
{
x = 8;
ImageView.Frame = new RectangleF(x, 6, 40, 40);
x += 44 + padding;
}
else
{
x = 12;
ImageView.Frame = new RectangleF(x, 14, 24, 24);
x += 32 + padding;
}
Expand Down
4 changes: 4 additions & 0 deletions MPfm/MPfm.iOS/Classes/Services/iOSDropboxService.cs
Expand Up @@ -30,6 +30,7 @@
using Newtonsoft.Json;
using MPfm.Library.Objects;
using MonoTouch.UIKit;
using MPfm.Library.Services.Exceptions;

namespace MPfm.iOS.Classes.Services
{
Expand Down Expand Up @@ -247,6 +248,9 @@ public IEnumerable<CloudDeviceInfo> PullDeviceInfos()

try
{
if(_fileSystem == null)
throw new CloudAppNotLinkedException();

var fileInfos = _fileSystem.ListFolder(new DBPath("/Devices"), out error);
if(error != null)
throw new Exception(error.Description);
Expand Down
Binary file added MPfm/MPfm.iOS/Images/Buttons/cloud.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MPfm/MPfm.iOS/Images/Buttons/cloud@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions MPfm/MPfm.iOS/MPfm.iOS.csproj
Expand Up @@ -594,6 +594,8 @@
<BundleResource Include="Images\Icons\reset%402x.png" />
<BundleResource Include="Images\Icons\update.png" />
<BundleResource Include="Images\Icons\update%402x.png" />
<BundleResource Include="Images\Buttons\cloud.png" />
<BundleResource Include="Images\Buttons\cloud%402x.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MPfm.Core\MPfm.Core.iOS.csproj">
Expand Down
55 changes: 42 additions & 13 deletions MPfm/MPfm.iOS/XIB/iPhone/ResumePlaybackViewController_iPhone.xib
@@ -1,21 +1,50 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4510" systemVersion="12E55" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4510" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ResumePlaybackViewController">
<connections>
<outlet property="btnResumePlayback" destination="181-yh-9pI" id="4Wr-Rv-fjJ"/>
<outlet property="activityIndicator" destination="Qf3-fh-X4v" id="hRy-Pt-NHc"/>
<outlet property="btnOpenCloudPreferences" destination="UEz-bI-6fi" id="zhs-Nz-q1v"/>
<outlet property="lblLoading" destination="UGn-de-wTw" id="LXK-bD-Kdd"/>
<outlet property="lblTitle" destination="Fmt-h4-3LP" id="UHe-Le-0an"/>
<outlet property="tableView" destination="nYx-or-spr" id="cV6-1X-Ld5"/>
<outlet property="view" destination="1" id="3"/>
<outlet property="viewAppNotLinked" destination="uAh-YE-TjF" id="hMr-Ci-f7N"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="1">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" id="uAh-YE-TjF">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This application is not linked with a cloud account." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HF3-eH-HyO">
<rect key="frame" x="14" y="184" width="292" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="16"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="UEz-bI-6fi" customClass="MPfmButton">
<rect key="frame" x="14" y="251" width="292" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="14"/>
<state key="normal" title="Open Cloud Preferences">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="actionOpenCloudPreferences:" destination="-1" eventType="touchUpInside" id="Zl9-7h-pKr"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</view>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Select a device from the to list to resume playback:" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Fmt-h4-3LP">
<rect key="frame" x="13" y="8" width="292" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
Expand All @@ -29,17 +58,17 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</tableView>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="181-yh-9pI" customClass="MPfmButton">
<rect key="frame" x="25" y="22" width="280" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="13"/>
<state key="normal" title="Re">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="actionResumePlayback:" destination="-1" eventType="touchUpInside" id="5kI-8k-cel"/>
</connections>
</button>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="whiteLarge" id="Qf3-fh-X4v">
<rect key="frame" x="141" y="201" width="37" height="37"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</activityIndicatorView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Loading..." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="UGn-de-wTw">
<rect key="frame" x="14" y="235" width="292" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="16"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
Expand Down
8 changes: 4 additions & 4 deletions MPfm/MPfm.iOS/XIB/iPhone/SyncViewController_iPhone.xib
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4510" systemVersion="12E55" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4510" systemVersion="13A603" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment version="1552" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
Expand Down Expand Up @@ -28,7 +28,7 @@
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</tableView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="My IP address is:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="5">
<rect key="frame" x="20" y="5" width="280" height="21"/>
<rect key="frame" x="14" y="5" width="280" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="13"/>
<color key="textColor" red="0.87450980392156863" green="0.87450980392156863" blue="0.87450980392156863" alpha="1" colorSpace="calibratedRGB"/>
Expand All @@ -48,14 +48,14 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Refreshing devices..." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="11">
<rect key="frame" x="48" y="3" width="252" height="21"/>
<rect key="frame" x="42" y="3" width="252" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="13"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" style="white" id="12">
<rect key="frame" x="20" y="4" width="20" height="20"/>
<rect key="frame" x="14" y="4" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</activityIndicatorView>
</subviews>
Expand Down

0 comments on commit 98078b1

Please sign in to comment.