Skip to content

Commit

Permalink
Updated the HeaderedTextBlock Forms nuspec tags to be similar to the …
Browse files Browse the repository at this point in the history
…native one.

Updated the Android and Windows HeaderedTextBlock control to have accessors to the view's controls to match across all platforms.

Removed the UWP specific component from the Networking library.
  • Loading branch information
jamesmcroft committed Jun 27, 2018
1 parent 2e93eec commit 4a66cbd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 38 deletions.
9 changes: 1 addition & 8 deletions MADE.App.Networking/MADE.App.Networking.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;uap10.0.16299</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down Expand Up @@ -52,18 +52,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.5.4" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'uap10.0.16299' ">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.5" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MADE.App\MADE.App.csproj" />
</ItemGroup>

<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />

</Project>
Expand Up @@ -43,7 +43,7 @@
<RepositoryUrl>https://github.com/MADE-Apps/MADE-App-Components</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIconUrl>https://pbs.twimg.com/profile_images/927154020422160385/6HSRU36P_400x400.jpg</PackageIconUrl>
<PackageTags>MADE App Development HeaderedTextBlock Xamarin.Forms View Custom Controls Windows Android iOS Xamarin</PackageTags>
<PackageTags>MADE App Development Controls View Header TextBlock TextView Xamarin.Forms Windows Android iOS Xamarin</PackageTags>
<RootNamespace>MADE.App.Views</RootNamespace>
</PropertyGroup>

Expand Down
Expand Up @@ -116,32 +116,32 @@ public HeaderedTextBlock(Context context, IAttributeSet attrs, int defStyleAttr,
/// <summary>
/// Gets the UI element associated with the container for the header and text content.
/// </summary>
public LinearLayout LayoutContainer { get; private set; }
public LinearLayout HeaderTextBlockContainer { get; private set; }

/// <summary>
/// Gets the UI element associated with the header text.
/// </summary>
public TextView HeaderTextView { get; private set; }
public TextView HeaderContent { get; private set; }

/// <summary>
/// Gets the UI element associated with the content text.
/// </summary>
public TextView ContentTextView { get; private set; }
public TextView TextContent { get; private set; }

/// <summary>
/// Gets or sets the string associated with the header.
/// </summary>
public string Header
{
get => this.HeaderTextView?.Text;
get => this.HeaderContent?.Text;
set
{
if (this.HeaderTextView == null || value == this.HeaderTextView.Text)
if (this.HeaderContent == null || value == this.HeaderContent.Text)
{
return;
}

this.HeaderTextView.Text = value;
this.HeaderContent.Text = value;
this.RaisePropertyChanged();
this.UpdateVisibility();
}
Expand All @@ -152,15 +152,15 @@ public string Header
/// </summary>
public string Text
{
get => this.ContentTextView?.Text;
get => this.TextContent?.Text;
set
{
if (this.ContentTextView == null || value == this.ContentTextView.Text)
if (this.TextContent == null || value == this.TextContent.Text)
{
return;
}

this.ContentTextView.Text = value;
this.TextContent.Text = value;
this.RaisePropertyChanged();
this.UpdateVisibility();
}
Expand Down Expand Up @@ -208,13 +208,13 @@ public override void OnApplyTemplate(IAttributeSet attrs, int defStyleAttr, int
{
base.OnApplyTemplate(attrs, defStyleAttr, defStyleRes);

this.LayoutContainer = this.View?.FindViewById<LinearLayout>(
this.HeaderTextBlockContainer = this.View?.FindViewById<LinearLayout>(
Controls.HeaderedTextBlock.Resource.Id.HeaderedTextBlock_LayoutContainer);

this.HeaderTextView = this.View?.FindViewById<TextView>(
this.HeaderContent = this.View?.FindViewById<TextView>(
Controls.HeaderedTextBlock.Resource.Id.HeaderedTextBlock_HeaderTextView);

this.ContentTextView = this.View?.FindViewById<TextView>(
this.TextContent = this.View?.FindViewById<TextView>(
Controls.HeaderedTextBlock.Resource.Id.HeaderedTextBlock_ContentTextView);

if (attrs != null)
Expand All @@ -229,18 +229,18 @@ public override void OnApplyTemplate(IAttributeSet attrs, int defStyleAttr, int
Controls.HeaderedTextBlock.Resource.Styleable.HeaderedTextBlock_hide_if_empty,
false);

if (this.HeaderTextView != null)
if (this.HeaderContent != null)
{
string header = typedArray.GetString(
Controls.HeaderedTextBlock.Resource.Styleable.HeaderedTextBlock_header);
this.HeaderTextView.Text = header;
this.HeaderContent.Text = header;
}

if (this.ContentTextView != null)
if (this.TextContent != null)
{
string text = typedArray.GetString(
Controls.HeaderedTextBlock.Resource.Styleable.HeaderedTextBlock_text);
this.ContentTextView.Text = text;
this.TextContent.Text = text;
}
}

Expand All @@ -253,7 +253,7 @@ public override void OnApplyTemplate(IAttributeSet attrs, int defStyleAttr, int
/// </summary>
public void UpdateOrientation()
{
this.LayoutContainer?.SetOrientation(this.Orientation);
this.HeaderTextBlockContainer?.SetOrientation(this.Orientation);
}

/// <summary>
Expand All @@ -264,14 +264,14 @@ public void UpdateVisibility()
if (!this.HideIfNullOrWhiteSpace || !string.IsNullOrWhiteSpace(this.Text))
{
this.IsVisible = true;
this.HeaderTextView?.SetVisible(!string.IsNullOrWhiteSpace(this.Header));
this.ContentTextView?.SetVisible(!string.IsNullOrWhiteSpace(this.Text));
this.HeaderContent?.SetVisible(!string.IsNullOrWhiteSpace(this.Header));
this.TextContent?.SetVisible(!string.IsNullOrWhiteSpace(this.Text));
}
else
{
this.IsVisible = false;
this.HeaderTextView?.SetVisible(false);
this.ContentTextView?.SetVisible(false);
this.HeaderContent?.SetVisible(false);
this.TextContent?.SetVisible(false);
}
}
}
Expand Down
Expand Up @@ -77,9 +77,9 @@ public HeaderedTextBlock()
this.DefaultStyleKey = typeof(HeaderedTextBlock);
}

public TextBlock HeaderTextBlock { get; private set; }
public TextBlock HeaderContent { get; private set; }

public TextBlock ContentTextBlock { get; private set; }
public TextBlock TextContent { get; private set; }

/// <summary>
/// Gets or sets a value indicating whether to hide the control if the <see cref="IHeaderedTextBlock.Text"/> is null or whitespace.
Expand Down Expand Up @@ -159,14 +159,14 @@ public void UpdateVisibility()
if (!this.HideIfNullOrWhiteSpace || !string.IsNullOrWhiteSpace(this.Text))
{
this.IsVisible = true;
this.HeaderTextBlock?.SetVisible(!string.IsNullOrWhiteSpace(this.Header));
this.ContentTextBlock?.SetVisible(!string.IsNullOrWhiteSpace(this.Text));
this.HeaderContent?.SetVisible(!string.IsNullOrWhiteSpace(this.Header));
this.TextContent?.SetVisible(!string.IsNullOrWhiteSpace(this.Text));
}
else
{
this.IsVisible = false;
this.HeaderTextBlock?.SetVisible(false);
this.ContentTextBlock?.SetVisible(false);
this.HeaderContent?.SetVisible(false);
this.TextContent?.SetVisible(false);
}
}

Expand All @@ -177,8 +177,8 @@ protected override void OnApplyTemplate()
{
base.OnApplyTemplate();

this.HeaderTextBlock = this.GetChildView<TextBlock>("HeaderContent");
this.ContentTextBlock = this.GetChildView<TextBlock>("TextContent");
this.HeaderContent = this.GetChildView<TextBlock>("HeaderContent");
this.TextContent = this.GetChildView<TextBlock>("TextContent");

this.UpdateVisibility();
this.UpdateOrientation();
Expand Down

0 comments on commit 4a66cbd

Please sign in to comment.