Skip to content

Commit

Permalink
Latest
Browse files Browse the repository at this point in the history
  • Loading branch information
Redth committed Jun 2, 2010
1 parent 9559fe5 commit 9d7b846
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 15 deletions.
3 changes: 2 additions & 1 deletion MonoTouch.Dialog/ActivityElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public class ActivityElement : UIViewElement, IElementSizing {
((UIActivityIndicatorView) View).StartAnimating ();
var sbounds = UIScreen.MainScreen.Bounds;
var vbounds = View.Bounds;
View.Frame = new RectangleF ((sbounds.Width-vbounds.Width)/2, 4, vbounds.Width, vbounds.Height + 8);
View.Frame = new RectangleF ((sbounds.Width-vbounds.Width)/2, 4, vbounds.Width, vbounds.Height + 0);
View.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
}

public bool Animating {
Expand Down
10 changes: 8 additions & 2 deletions MonoTouch.Dialog/Controls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ internal class RefreshTableHeaderView : UIView {

public RefreshTableHeaderView (RectangleF rect) : base (rect)
{
this.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;

BackgroundColor = new UIColor (0.88f, 0.9f, 0.92f, 1);
lastUpdateLabel = new UILabel (new RectangleF (0, rect.Height - 30, 320, 20)){
Font = UIFont.SystemFontOfSize (13f),
Expand All @@ -66,7 +68,8 @@ public RefreshTableHeaderView (RectangleF rect) : base (rect)
ShadowOffset = new SizeF (0, 1),
BackgroundColor = this.BackgroundColor,
Opaque = true,
TextAlignment = UITextAlignment.Center
TextAlignment = UITextAlignment.Center,
AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin
};
AddSubview (lastUpdateLabel);

Expand All @@ -78,20 +81,23 @@ public RefreshTableHeaderView (RectangleF rect) : base (rect)
BackgroundColor = this.BackgroundColor,
Opaque = true,
TextAlignment = UITextAlignment.Center,
AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin
};
AddSubview (statusLabel);
SetStatus (RefreshViewStatus.PullToReload);

arrowView = new UIImageView (new RectangleF (20, rect.Height - 65, 30, 55)){
ContentMode = UIViewContentMode.ScaleAspectFill,
Image = arrow,
AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin
};
arrowView.Layer.Transform = CATransform3D.MakeRotation ((float) Math.PI, 0, 0, 1);
AddSubview (arrowView);

activity = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.Gray) {
Frame = new RectangleF (25, rect.Height-38, 20, 20),
HidesWhenStopped = true
HidesWhenStopped = true,
AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin
};
AddSubview (activity);
}
Expand Down
9 changes: 9 additions & 0 deletions MonoTouch.Dialog/DialogViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientat
return Autorotate;
}

public override void DidRotate (UIInterfaceOrientation fromInterfaceOrientation)
{
base.DidRotate (fromInterfaceOrientation);

//JON DID THIS
this.ReloadData();
}


Section [] originalSections;
Element [][] originalElements;

Expand Down
6 changes: 3 additions & 3 deletions MonoTouch.Dialog/Elements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ public TimeElement (string caption, DateTime date) : base (caption, date)

public override string FormatDate (DateTime dt)
{
Console.WriteLine (dt.ToShortTimeString () + " - " + dt.ToLongTimeString ());
//Console.WriteLine (dt.ToShortTimeString () + " - " + dt.ToLongTimeString ());
return dt.ToLocalTime ().ToShortTimeString ();
}

Expand Down Expand Up @@ -1284,7 +1284,7 @@ public class Section : Element, IEnumerable {
public List<Element> Elements = new List<Element> ();

// X corresponds to the alignment, Y to the height of the password
internal SizeF EntryAlignment;
public SizeF EntryAlignment;

/// <summary>
/// Constructs a Section without header or footers.
Expand Down Expand Up @@ -1677,7 +1677,7 @@ public class RootElement : Element, IEnumerable {
internal Group group;
public bool UnevenRows;
public Func<RootElement, UIViewController> createOnSelected;
internal UITableView TableView;
public UITableView TableView;

/// <summary>
/// Initializes a RootSection with a caption
Expand Down
25 changes: 16 additions & 9 deletions MonoTouch.Dialog/LoadMoreElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public LoadMoreElement (string normalCaption, string loadingCaption, NSAction ta

cell = new UITableViewCell(UITableViewCellStyle.Default, "loadMoreElement");

if (this.tapped == null)
cell.SelectionStyle = UITableViewCellSelectionStyle.None;

activityIndicator = new UIActivityIndicatorView();
activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray;
activityIndicator.Hidden = true;
Expand Down Expand Up @@ -62,13 +65,16 @@ public override UITableViewCell GetCell (UITableView tv)
public override void Selected (MonoTouch.Dialog.DialogViewController dvc, UITableView tableView, NSIndexPath path)
{
tableView.DeselectRow(path, true);

caption.Text = this.LoadingCaption;
activityIndicator.Hidden = false;
activityIndicator.StartAnimating();
Layout();

System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(Tapped));

if (this.tapped != null)
{
caption.Text = this.LoadingCaption;
activityIndicator.Hidden = false;
activityIndicator.StartAnimating();
Layout();

System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(Tapped));
}
}

public float GetHeight (UITableView tableView, NSIndexPath indexPath)
Expand All @@ -89,10 +95,11 @@ void Layout()
{
float h = UIScreen.MainScreen.Bounds.Height;
float width = UIScreen.MainScreen.Bounds.Width;
width = cell.ContentView.Bounds.Width;


float captionHeight = 0.0625f * h;
float topPadding = 0.02083f * h;
float captionHeight = 0.04166f * h;
float topPadding = 0.03125f * h;
float itemPadding = 0.01042f * h;

var size = cell.StringSize(caption.Text, font, width - captionHeight - topPadding, UILineBreakMode.TailTruncation);
Expand Down
28 changes: 28 additions & 0 deletions MonoTouch.Dialog/MonoTouch.Dialog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,32 @@
<MtouchDebug>False</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AdHoc|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>False</MtouchDebug>
<MtouchLink>None</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AdHoc|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchDebug>False</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin</OutputPath>
<WarningLevel>4</WarningLevel>
<MtouchDebug>False</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
Expand All @@ -74,6 +100,8 @@
<Compile Include="Controls.cs" />
<Compile Include="ActivityElement.cs" />
<Compile Include="LoadMoreElement.cs" />
<Compile Include="OwnerDrawnElement.cs" />
<Compile Include="DrawnElement.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Images\" />
Expand Down

0 comments on commit 9d7b846

Please sign in to comment.