Skip to content

Development #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Demo/Demo.Droid/Demo.Droid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@
<ItemGroup>
<AndroidResource Include="Resources\drawable\navbackground.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-hdpi\ic_search.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xhdpi\ic_search.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable-xxhdpi\ic_search.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Forms.1.4.3.6374\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.1.4.3.6374\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
2 changes: 1 addition & 1 deletion src/Demo/Demo.Droid/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using Xamarin.Forms;

[Activity(ConfigurationChanges = AppConfig, MainLauncher = true, Theme = CompatTheme)]
[Activity(ConfigurationChanges = AppConfig, MainLauncher = true, Theme = CompatThemeLightDarkActionBar)]
public class MainActivity : AppCompatFormsApplicationActivity
{
private const ConfigChanges AppConfig = ConfigChanges.Orientation | ConfigChanges.ScreenSize;
Expand Down
17 changes: 10 additions & 7 deletions src/Demo/Demo.Droid/Resources/Resource.Designer.cs

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

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.
9 changes: 9 additions & 0 deletions src/Demo/Demo/Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
<Compile Include="Views\NestNavigationView.xaml.cs">
<DependentUpon>NestNavigationView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Shared\MenuHeaderView.xaml.cs">
<DependentUpon>MenuHeaderView.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Reference Include="PropertyChanged, Version=1.50.1.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd">
Expand Down Expand Up @@ -128,6 +131,12 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Views\Shared\MenuHeaderView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
7 changes: 6 additions & 1 deletion src/Demo/Demo/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
using System.Windows.Input;

using NativeCode.Mobile.AppCompat.Controls;
using NativeCode.Mobile.AppCompat.Controls.Platforms;

using PropertyChanged;
Expand All @@ -23,6 +22,12 @@ public MainViewModel()
this.Title = "Main";
}

public double Elevation { get; set; }

public double Radius { get; set; }

public int Padding { get; set; }

[DoNotNotify]
public ICommand FloatingButtonCommand { get; private set; }

Expand Down
8 changes: 4 additions & 4 deletions src/Demo/Demo/Views/ChooserView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
x:Class="Demo.Views.ChooserView">
<controls:NavigationLayout>
<controls:NavigationLayout.Children>
<controls:NavigationLayoutMenu Command="{Binding MasterDetailPatternOneCommand}" Text="Master Detail Pattern One" />
<controls:NavigationLayoutMenu Command="{Binding MasterDetailPatternTwoCommand}" Text="Master Detail Pattern Two" />
<controls:NavigationLayoutMenu Command="{Binding NavigationCommand}" Text="Navigation Pattern" />
<controls:NavigationLayoutMenu Command="{Binding TabbedCommand}" Text="Tabbed Navigation" />
<controls:NavigationLayoutMenu Command="{Binding NavigationCommand}" Group="0" Text="Navigation Pattern" />
<controls:NavigationLayoutMenu Command="{Binding TabbedCommand}" Group="0" Text="Tabbed Navigation" />
<controls:NavigationLayoutMenu Command="{Binding MasterDetailPatternOneCommand}" Group="1" Text="Master Detail Pattern One" />
<controls:NavigationLayoutMenu Command="{Binding MasterDetailPatternTwoCommand}" Group="1" Text="Master Detail Pattern Two" />
</controls:NavigationLayout.Children>
</controls:NavigationLayout>
</ContentPage>
52 changes: 28 additions & 24 deletions src/Demo/Demo/Views/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:NativeCode.Mobile.AppCompat.Controls;assembly=NativeCode.Mobile.AppCompat.Controls"
x:Class="Demo.Views.MainView" IsBusy="{Binding IsBusy}" Title="{Binding Title}">
xmlns:shared="clr-namespace:Demo.Views.Shared;assembly=Demo"
x:Class="Demo.Views.MainView" BackgroundColor="Gray" IsBusy="{Binding IsBusy}" Title="{Binding Title}">
<ScrollView>
<StackLayout Padding="20">
<Picker>
Expand All @@ -18,33 +19,36 @@
<x:String>Item 9</x:String>
</Picker.Items>
</Picker>
<controls:Card Padding="40" Radius="20">
<controls:Card.Content>
<StackLayout>
<Button Command="{Binding ShowSnackBar}" Text="Hit me!" />
<StackLayout Orientation="Horizontal">
<Label Text="Switch On/Off" />
<Switch />
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="Entry Field" />
<Entry HorizontalOptions="FillAndExpand" />
</StackLayout>
<Label Text="Elevation" />
<Slider Minimum="0" Maximum="5" Value="{Binding Elevation}" />
<Label Text="Radius" />
<Slider Minimum="0" Maximum="20" Value="{Binding Radius}" />
<Label Text="Padding" />
<Slider Minimum="0" Maximum="20" Value="{Binding Padding}" />
<controls:Card BackgroundColor="White" Elevation="{Binding Elevation}" Padding="{Binding Padding}" Radius="{Binding Radius}">
<StackLayout>
<Button Command="{Binding ShowSnackBar}" Text="Hit me!" />
<StackLayout Orientation="Horizontal">
<Label Text="Switch On/Off" />
<Switch />
</StackLayout>
</controls:Card.Content>
</controls:Card>
<controls:Card>
<controls:Card.Content>
<StackLayout Orientation="Horizontal">
<controls:FloatingButton ButtonSize="Mini" Color="Green" Command="{Binding FloatingButtonCommand}" Icon="launcher" />
<controls:FloatingButton ButtonSize="Normal" Color="Green" Command="{Binding FloatingButtonCommand}" Icon="launcher" />
<Label Text="Entry Field" />
<Entry HorizontalOptions="FillAndExpand" />
</StackLayout>
</controls:Card.Content>
</StackLayout>
</controls:Card>
<controls:Card BackgroundColor="White" Elevation="{Binding Elevation}" Padding="{Binding Padding}" Radius="{Binding Radius}">
<StackLayout Orientation="Horizontal">
<controls:FloatingButton ButtonSize="Mini" Color="Black" Command="{Binding FloatingButtonCommand}" Icon="ic_search" />
<controls:FloatingButton ButtonSize="Normal" Command="{Binding FloatingButtonCommand}" Icon="ic_search" />
</StackLayout>
</controls:Card>
<controls:Card BackgroundColor="White" Command="{Binding ShowSnackBar}" Elevation="{Binding Elevation}" Padding="{Binding Padding}" Radius="{Binding Radius}">
<Label Text="Clickable CardView" />
</controls:Card>
<controls:Card Command="{Binding ShowSnackBar}">
<controls:Card.Content>
<Label Text="Clickable CardView" />
</controls:Card.Content>
<controls:Card BackgroundColor="White" Elevation="{Binding Elevation}" Padding="{Binding Padding}" Radius="{Binding Radius}">
<shared:MenuHeaderView />
</controls:Card>
</StackLayout>
</ScrollView>
Expand Down
20 changes: 5 additions & 15 deletions src/Demo/Demo/Views/MenuView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,20 @@

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:NativeCode.Mobile.AppCompat.Controls;assembly=NativeCode.Mobile.AppCompat.Controls"
xmlns:shared="clr-namespace:Demo.Views.Shared;assembly=Demo"
x:Class="Demo.Views.MenuView" IsBusy="{Binding IsBusy}" Title="{Binding Title}">
<StackLayout>

<controls:NavigationLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">

<controls:NavigationLayout.HeaderView>
<ContentView>
<RelativeLayout x:Name="Header">
<Image x:Name="HeaderImage" Source="navbackground" IsOpaque="True" Opacity="0.75" />
<StackLayout
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=HeaderImage, Constant=0, Factor=1, Property=Height}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Constant=0, Factor=0, Property=Y}"
Padding="10">
<Image Source="launcher" HeightRequest="64" WidthRequest="64" HorizontalOptions="Start" VerticalOptions="Start" />
<Label HorizontalOptions="Start" VerticalOptions="EndAndExpand" Text="[email protected]" />
</StackLayout>
</RelativeLayout>
</ContentView>
<shared:MenuHeaderView />
</controls:NavigationLayout.HeaderView>

<controls:NavigationLayout.Children>
<controls:NavigationLayoutMenu Command="{Binding HomeCommand}" Text="Home" />
<controls:NavigationLayoutMenu Command="{Binding LoremIpsumCommand}" Text="Lorem Ipsum" />
<controls:NavigationLayoutMenu Command="{Binding NavigationCommand}" Text="Nested Navigation" />
<controls:NavigationLayoutMenu Command="{Binding HomeCommand}" Group="0" Text="Home" />
<controls:NavigationLayoutMenu Command="{Binding LoremIpsumCommand}" Group="1" Text="Lorem Ipsum" />
<controls:NavigationLayoutMenu Command="{Binding NavigationCommand}" Group="1" Text="Nested Navigation" />
</controls:NavigationLayout.Children>

</controls:NavigationLayout>
Expand Down
7 changes: 7 additions & 0 deletions src/Demo/Demo/Views/Shared/MenuHeaderView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>

<controls:NavigationLayoutHeader xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:NativeCode.Mobile.AppCompat.Controls;assembly=NativeCode.Mobile.AppCompat.Controls"
x:Class="Demo.Views.Shared.MenuHeaderView" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Image x:Name="HeaderImage" Source="navbackground" IsOpaque="True" Opacity="0.75" />
</controls:NavigationLayoutHeader>
12 changes: 12 additions & 0 deletions src/Demo/Demo/Views/Shared/MenuHeaderView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Demo.Views.Shared
{
using NativeCode.Mobile.AppCompat.Controls;

public partial class MenuHeaderView : NavigationLayoutHeader
{
public MenuHeaderView()
{
this.InitializeComponent();
}
}
}
12 changes: 10 additions & 2 deletions src/NativeCode.Mobile.AppCompat.Controls/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ public class Card : ContentView, ICommandProvider
x => x.CommandParameter,
default(object));

public static readonly BindableProperty RadiusProperty = BindableProperty.Create<Card, double>(x => x.Radius, 20.0d);
public static readonly BindableProperty ElevationProperty = BindableProperty.Create<Card, double>(x => x.Elevation, default(double));

public static readonly BindableProperty RadiusProperty = BindableProperty.Create<Card, double>(x => x.Radius, 5.0d);

public Card()
{
this.Padding = new Thickness(20);
this.Padding = new Thickness(5);
}

/// <summary>
Expand All @@ -37,6 +39,12 @@ public object CommandParameter
set { this.SetValue(CommandParameterProperty, value); }
}

public double Elevation
{
get { return (double)this.GetValue(ElevationProperty); }
set { this.SetValue(ElevationProperty, value); }
}

public double Radius
{
get { return (double)this.GetValue(RadiusProperty); }
Expand Down
10 changes: 9 additions & 1 deletion src/NativeCode.Mobile.AppCompat.Controls/FloatingButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public class FloatingButton : View, ICommandProvider
default(FloatingButtonSize),
BindingMode.OneWayToSource);

public static readonly BindableProperty ColorProperty = BindableProperty.Create<FloatingButton, Color>(x => x.Color, default(Color));
public static readonly BindableProperty ColorProperty = BindableProperty.Create<FloatingButton, Color>(x => x.Color, Color.Accent);

public static readonly BindableProperty ColorPressedProperty = BindableProperty.Create<FloatingButton, Color>(x => x.ColorPressed, Color.Accent);

public static readonly BindableProperty CommandProperty = BindableProperty.Create<FloatingButton, ICommand>(x => x.Command, default(ICommand));

Expand Down Expand Up @@ -42,6 +44,12 @@ public Color Color
set { this.SetValue(ColorProperty, value); }
}

public Color ColorPressed
{
get { return (Color)this.GetValue(ColorPressedProperty); }
set { this.SetValue(ColorPressedProperty, value); }
}

/// <summary>
/// Gets or sets the command.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Compile Include="Card.cs" />
Expand All @@ -42,6 +43,7 @@
<Compile Include="NavigationLayout.cs" />
<Compile Include="NavigationLayoutMenu.cs" />
<Compile Include="Platforms\IUserNotifier.cs" />
<Compile Include="NavigationLayoutHeader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
10 changes: 6 additions & 4 deletions src/NativeCode.Mobile.AppCompat.Controls/NavigationLayout.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
namespace NativeCode.Mobile.AppCompat.Controls
{
using NativeCode.Mobile.AppCompat.Controls.Platforms;

using Xamarin.Forms;

public class NavigationLayout : Layout<NavigationLayoutMenu>
{
public static readonly BindableProperty HeaderViewProperty = BindableProperty.Create<NavigationLayout, ContentView>(
public static readonly BindableProperty HeaderViewProperty = BindableProperty.Create<NavigationLayout, NavigationLayoutHeader>(
x => x.HeaderView,
default(ContentView));
default(NavigationLayoutHeader));

public ContentView HeaderView
public NavigationLayoutHeader HeaderView
{
get { return (ContentView)this.GetValue(HeaderViewProperty); }
get { return (NavigationLayoutHeader)this.GetValue(HeaderViewProperty); }
set { this.SetValue(HeaderViewProperty, value); }
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace NativeCode.Mobile.AppCompat.Controls
{
using Xamarin.Forms;

public class NavigationLayoutHeader : ContentView
{
}
}
12 changes: 9 additions & 3 deletions src/NativeCode.Mobile.AppCompat.Controls/NavigationLayoutMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class NavigationLayoutMenu : View, ICommandProvider
{
public static readonly BindableProperty CommandProperty = BindableProperty.Create<NavigationLayoutMenu, ICommand>(x => x.Command, default(ICommand));

public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create<NavigationLayoutMenu, object>(
x => x.CommandParameter,
default(object));
public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create<NavigationLayoutMenu, object>(x => x.CommandParameter, default(object));

public static readonly BindableProperty GroupProperty = BindableProperty.Create<NavigationLayoutMenu, int>(x => x.Group, default(int));

public static readonly BindableProperty IconProperty = BindableProperty.Create<NavigationLayoutMenu, ImageSource>(x => x.Icon, default(ImageSource));

Expand All @@ -28,6 +28,12 @@ public object CommandParameter
set { this.SetValue(CommandParameterProperty, value); }
}

public int Group
{
get { return (int)this.GetValue(GroupProperty); }
set { this.SetValue(GroupProperty, value); }
}

public ImageSource Icon
{
get { return (ImageSource)this.GetValue(IconProperty); }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;

[assembly: AssemblyCompany("NativeCode Development")]
[assembly: AssemblyConfiguration("")]
Expand All @@ -12,4 +13,5 @@
[assembly: AssemblyTitle("NativeCode.Mobile.AppCompat.Controls")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en")]
Loading