Skip to content

Commit

Permalink
ready for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
tkowalczyk committed May 20, 2015
1 parent a860114 commit bf41fa2
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 37 deletions.
2 changes: 2 additions & 0 deletions Application/DevTalkMobile/Models/FeedItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public string Title
}
}

public string DescriptionLongHtml { get; set; }

private string description;
public string Description
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public async Task<List<FeedItem>> GetAll(string rss)
{
Title = (string)item.Element("title"),
Description = (string)item.Element("description"),
DescriptionLongHtml = (string)item.Element("description"),
FileImage = (string)item.Element(content.GetName("encoded")).Value.GetImageFile(),
Link = (string)item.Element("link"),
PublishDate = (string)item.Element("pubDate"),
Expand Down
11 changes: 11 additions & 0 deletions Application/DevTalkMobile/ViewModels/BaseViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ public bool IsBusy
set { SetProperty(ref isBusy, value, IsBusyPropertyName); }
}

private bool isNotBusy;
/// <summary>
/// Gets or sets if the view is busy.
/// </summary>
public const string IsNotBusyPropertyName = "IsNotBusy";
public bool IsNotBusy
{
get { return isNotBusy; }
set { SetProperty(ref isNotBusy, value, IsNotBusyPropertyName); }
}

private bool canLoadMore = true;
/// <summary>
/// Gets or sets if we can load more.
Expand Down
2 changes: 2 additions & 0 deletions Application/DevTalkMobile/ViewModels/HomeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ private async Task ExecuteLoadItemsCommand()
return;

IsBusy = true;
IsNotBusy = false;

try
{
Expand All @@ -107,6 +108,7 @@ private async Task ExecuteLoadItemsCommand()
}

IsBusy = false;
IsNotBusy = true;
}
#endregion
}
Expand Down
91 changes: 55 additions & 36 deletions Application/DevTalkMobile/Views/HomeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using DevTalkMobile.Helpers;
using DevTalkMobile.Services;
using DevTalkMobile.ViewModels;
using DevTalkMobile.Views.XAML;
using Xamarin.Forms;

namespace DevTalkMobile.Views
Expand All @@ -13,10 +14,20 @@ public HomeView ()
{
this.Title = "DevTalk";

var layout = new RelativeLayout ();
var buttonPlay = new Button () {
Text = "Play",
BackgroundColor = Color.FromHex ("#FF6600"),
WidthRequest = 150
};
buttonPlay.SetBinding(Button.IsVisibleProperty, "IsNotBusy");

buttonPlay.Clicked += async (sender, args) =>
{
this.Navigation.PushAsync(new PodcastPlayView(ViewModel.LastFeedItem));
};

var picture = new Image () {
Aspect = Aspect.AspectFill,
Aspect = Aspect.AspectFit,
HeightRequest = 150,
WidthRequest = 150,
};
Expand All @@ -38,6 +49,7 @@ public HomeView ()
TextColor = Color.FromHex ("#B7A19B"),
FontFamily = Device.OnPlatform ("HelveticaNeue-CondensedBlack", "sans-serif-condensed", "")
};
dateLabel.SetBinding(Label.IsVisibleProperty, "IsNotBusy");

var date = new Label () {
FontSize = 20,
Expand All @@ -57,42 +69,49 @@ public HomeView ()
}
};

var buttonPlay = new Button () {
Text = "Play",
BackgroundColor = Color.FromHex ("#FF6600"),
WidthRequest = 150,
#region MainGrid
Grid mainGrid = new Grid
{
VerticalOptions = LayoutOptions.FillAndExpand,
RowDefinitions =
{
new RowDefinition { Height = GridLength.Auto},
new RowDefinition { Height = GridLength.Auto},
new RowDefinition { Height = new GridLength(10, GridUnitType.Star)}
},
ColumnDefinitions =
{
new ColumnDefinition { Width = GridLength.Auto}
}
};

mainGrid.Children.Add(buttonPlay, 0, 0);
mainGrid.Children.Add(picture, 0, 1);
mainGrid.Children.Add(details, 0, 2);
#endregion

#region ActivityIndicator
var activity = new ActivityIndicator
{
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
IsEnabled = true
};

var centerX = Constraint.RelativeToParent(parent => (parent.Width - picture.Width) / 2);
var centerY = Constraint.RelativeToParent(parent => (parent.Height - picture.Height) / 2.9);

layout.Children.Add (
picture,
centerX,
centerY
);

layout.Children.Add (
buttonPlay,
Constraint.RelativeToParent(parent => (parent.Width - buttonPlay.Width) / 2),
Constraint.RelativeToParent(parent => (buttonPlay.Height))
);

layout.Children.Add (
details,
Constraint.Constant (0),
Constraint.RelativeToParent ((parent) => {
return parent.Height * .5;
}),
Constraint.RelativeToParent ((parent) => {
return parent.Width;
}),
Constraint.RelativeToParent ((parent) => {
return parent.Height;
})
);

this.Content = layout;
activity.SetBinding(ActivityIndicator.IsVisibleProperty, "IsBusy");
activity.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
#endregion

var overlay = new AbsoluteLayout();

AbsoluteLayout.SetLayoutFlags(mainGrid, AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds(mainGrid, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
AbsoluteLayout.SetLayoutFlags(activity, AbsoluteLayoutFlags.PositionProportional);
AbsoluteLayout.SetLayoutBounds(activity, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
overlay.Children.Add(mainGrid);
overlay.Children.Add(activity);

this.Content = overlay;

// Accomodate iPhone status bar.
this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public PodcastPlayView (FeedItem item)
BindingContext = item;
webView.Source = new HtmlWebViewSource
{
Html = item.Description
Html = item.DescriptionLongHtml
};

var share = new ToolbarItem
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bf41fa2

Please sign in to comment.