Skip to content

Commit 4873be3

Browse files
author
Mike Pham
committed
Merge branch 'development'
Conflicts: src/Xamarin.sln.DotSettings
2 parents 59393a5 + 13be932 commit 4873be3

35 files changed

+372
-109
lines changed

src/Demo/Demo.Droid/Demo.Droid.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@
121121
<ItemGroup>
122122
<AndroidResource Include="Resources\drawable\navbackground.png" />
123123
</ItemGroup>
124+
<ItemGroup>
125+
<AndroidResource Include="Resources\drawable-hdpi\ic_search.png" />
126+
</ItemGroup>
127+
<ItemGroup>
128+
<AndroidResource Include="Resources\drawable-xhdpi\ic_search.png" />
129+
</ItemGroup>
130+
<ItemGroup>
131+
<AndroidResource Include="Resources\drawable-xxhdpi\ic_search.png" />
132+
</ItemGroup>
124133
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
125134
<Import Project="..\..\packages\Xamarin.Forms.1.4.3.6376\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.1.4.3.6376\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
126135
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

src/Demo/Demo.Droid/MainActivity.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
using Xamarin.Forms;
1111

12-
[Activity(ConfigurationChanges = AppConfig, MainLauncher = true, Theme = CompatTheme)]
12+
[Activity(ConfigurationChanges = AppConfig, MainLauncher = true, Theme = CompatThemeLightDarkActionBar)]
1313
public class MainActivity : AppCompatFormsApplicationActivity
1414
{
1515
private const ConfigChanges AppConfig = ConfigChanges.Orientation | ConfigChanges.ScreenSize;

src/Demo/Demo.Droid/Resources/Resource.Designer.cs

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Loading
Loading
Loading

src/Demo/Demo/Demo.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
<Compile Include="Views\NestNavigationView.xaml.cs">
6868
<DependentUpon>NestNavigationView.xaml</DependentUpon>
6969
</Compile>
70+
<Compile Include="Views\Shared\MenuHeaderView.xaml.cs">
71+
<DependentUpon>MenuHeaderView.xaml</DependentUpon>
72+
</Compile>
7073
</ItemGroup>
7174
<ItemGroup>
7275
<Reference Include="PropertyChanged, Version=1.50.1.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd">
@@ -128,6 +131,12 @@
128131
<SubType>Designer</SubType>
129132
</EmbeddedResource>
130133
</ItemGroup>
134+
<ItemGroup>
135+
<EmbeddedResource Include="Views\Shared\MenuHeaderView.xaml">
136+
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
137+
<SubType>Designer</SubType>
138+
</EmbeddedResource>
139+
</ItemGroup>
131140
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
132141
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
133142
<PropertyGroup>

src/Demo/Demo/ViewModels/MainViewModel.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{
33
using System.Windows.Input;
44

5-
using NativeCode.Mobile.AppCompat.Controls;
65
using NativeCode.Mobile.AppCompat.Controls.Platforms;
76

87
using PropertyChanged;
@@ -23,6 +22,12 @@ public MainViewModel()
2322
this.Title = "Main";
2423
}
2524

25+
public double Elevation { get; set; }
26+
27+
public double Radius { get; set; }
28+
29+
public int Padding { get; set; }
30+
2631
[DoNotNotify]
2732
public ICommand FloatingButtonCommand { get; private set; }
2833

src/Demo/Demo/Views/ChooserView.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
x:Class="Demo.Views.ChooserView">
66
<controls:NavigationLayout>
77
<controls:NavigationLayout.Children>
8-
<controls:NavigationLayoutMenu Command="{Binding MasterDetailPatternOneCommand}" Text="Master Detail Pattern One" />
9-
<controls:NavigationLayoutMenu Command="{Binding MasterDetailPatternTwoCommand}" Text="Master Detail Pattern Two" />
10-
<controls:NavigationLayoutMenu Command="{Binding NavigationCommand}" Text="Navigation Pattern" />
11-
<controls:NavigationLayoutMenu Command="{Binding TabbedCommand}" Text="Tabbed Navigation" />
8+
<controls:NavigationLayoutMenu Command="{Binding NavigationCommand}" Group="0" Text="Navigation Pattern" />
9+
<controls:NavigationLayoutMenu Command="{Binding TabbedCommand}" Group="0" Text="Tabbed Navigation" />
10+
<controls:NavigationLayoutMenu Command="{Binding MasterDetailPatternOneCommand}" Group="1" Text="Master Detail Pattern One" />
11+
<controls:NavigationLayoutMenu Command="{Binding MasterDetailPatternTwoCommand}" Group="1" Text="Master Detail Pattern Two" />
1212
</controls:NavigationLayout.Children>
1313
</controls:NavigationLayout>
1414
</ContentPage>

src/Demo/Demo/Views/MainView.xaml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
xmlns:controls="clr-namespace:NativeCode.Mobile.AppCompat.Controls;assembly=NativeCode.Mobile.AppCompat.Controls"
5-
x:Class="Demo.Views.MainView" IsBusy="{Binding IsBusy}" Title="{Binding Title}">
5+
xmlns:shared="clr-namespace:Demo.Views.Shared;assembly=Demo"
6+
x:Class="Demo.Views.MainView" BackgroundColor="Gray" IsBusy="{Binding IsBusy}" Title="{Binding Title}">
67
<ScrollView>
78
<StackLayout Padding="20">
89
<Picker>
@@ -18,33 +19,36 @@
1819
<x:String>Item 9</x:String>
1920
</Picker.Items>
2021
</Picker>
21-
<controls:Card Padding="40" Radius="20">
22-
<controls:Card.Content>
23-
<StackLayout>
24-
<Button Command="{Binding ShowSnackBar}" Text="Hit me!" />
25-
<StackLayout Orientation="Horizontal">
26-
<Label Text="Switch On/Off" />
27-
<Switch />
28-
</StackLayout>
29-
<StackLayout Orientation="Horizontal">
30-
<Label Text="Entry Field" />
31-
<Entry HorizontalOptions="FillAndExpand" />
32-
</StackLayout>
22+
<Label Text="Elevation" />
23+
<Slider Minimum="0" Maximum="5" Value="{Binding Elevation}" />
24+
<Label Text="Radius" />
25+
<Slider Minimum="0" Maximum="20" Value="{Binding Radius}" />
26+
<Label Text="Padding" />
27+
<Slider Minimum="0" Maximum="20" Value="{Binding Padding}" />
28+
<controls:Card BackgroundColor="White" Elevation="{Binding Elevation}" Padding="{Binding Padding}" Radius="{Binding Radius}">
29+
<StackLayout>
30+
<Button Command="{Binding ShowSnackBar}" Text="Hit me!" />
31+
<StackLayout Orientation="Horizontal">
32+
<Label Text="Switch On/Off" />
33+
<Switch />
3334
</StackLayout>
34-
</controls:Card.Content>
35-
</controls:Card>
36-
<controls:Card>
37-
<controls:Card.Content>
3835
<StackLayout Orientation="Horizontal">
39-
<controls:FloatingButton ButtonSize="Mini" Color="Green" Command="{Binding FloatingButtonCommand}" Icon="launcher" />
40-
<controls:FloatingButton ButtonSize="Normal" Color="Green" Command="{Binding FloatingButtonCommand}" Icon="launcher" />
36+
<Label Text="Entry Field" />
37+
<Entry HorizontalOptions="FillAndExpand" />
4138
</StackLayout>
42-
</controls:Card.Content>
39+
</StackLayout>
40+
</controls:Card>
41+
<controls:Card BackgroundColor="White" Elevation="{Binding Elevation}" Padding="{Binding Padding}" Radius="{Binding Radius}">
42+
<StackLayout Orientation="Horizontal">
43+
<controls:FloatingButton ButtonSize="Mini" Color="Black" Command="{Binding FloatingButtonCommand}" Icon="ic_search" />
44+
<controls:FloatingButton ButtonSize="Normal" Command="{Binding FloatingButtonCommand}" Icon="ic_search" />
45+
</StackLayout>
46+
</controls:Card>
47+
<controls:Card BackgroundColor="White" Command="{Binding ShowSnackBar}" Elevation="{Binding Elevation}" Padding="{Binding Padding}" Radius="{Binding Radius}">
48+
<Label Text="Clickable CardView" />
4349
</controls:Card>
44-
<controls:Card Command="{Binding ShowSnackBar}">
45-
<controls:Card.Content>
46-
<Label Text="Clickable CardView" />
47-
</controls:Card.Content>
50+
<controls:Card BackgroundColor="White" Elevation="{Binding Elevation}" Padding="{Binding Padding}" Radius="{Binding Radius}">
51+
<shared:MenuHeaderView />
4852
</controls:Card>
4953
</StackLayout>
5054
</ScrollView>

src/Demo/Demo/Views/MenuView.xaml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,20 @@
22

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

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

1011
<controls:NavigationLayout.HeaderView>
11-
<ContentView>
12-
<RelativeLayout x:Name="Header">
13-
<Image x:Name="HeaderImage" Source="navbackground" IsOpaque="True" Opacity="0.75" />
14-
<StackLayout
15-
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=HeaderImage, Constant=0, Factor=1, Property=Height}"
16-
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Constant=0, Factor=0, Property=Y}"
17-
Padding="10">
18-
<Image Source="launcher" HeightRequest="64" WidthRequest="64" HorizontalOptions="Start" VerticalOptions="Start" />
19-
<Label HorizontalOptions="Start" VerticalOptions="EndAndExpand" Text="test@testable.com" />
20-
</StackLayout>
21-
</RelativeLayout>
22-
</ContentView>
12+
<shared:MenuHeaderView />
2313
</controls:NavigationLayout.HeaderView>
2414

2515
<controls:NavigationLayout.Children>
26-
<controls:NavigationLayoutMenu Command="{Binding HomeCommand}" Text="Home" />
27-
<controls:NavigationLayoutMenu Command="{Binding LoremIpsumCommand}" Text="Lorem Ipsum" />
28-
<controls:NavigationLayoutMenu Command="{Binding NavigationCommand}" Text="Nested Navigation" />
16+
<controls:NavigationLayoutMenu Command="{Binding HomeCommand}" Group="0" Text="Home" />
17+
<controls:NavigationLayoutMenu Command="{Binding LoremIpsumCommand}" Group="1" Text="Lorem Ipsum" />
18+
<controls:NavigationLayoutMenu Command="{Binding NavigationCommand}" Group="1" Text="Nested Navigation" />
2919
</controls:NavigationLayout.Children>
3020

3121
</controls:NavigationLayout>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<controls:NavigationLayoutHeader xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:controls="clr-namespace:NativeCode.Mobile.AppCompat.Controls;assembly=NativeCode.Mobile.AppCompat.Controls"
5+
x:Class="Demo.Views.Shared.MenuHeaderView" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
6+
<Image x:Name="HeaderImage" Source="navbackground" IsOpaque="True" Opacity="0.75" />
7+
</controls:NavigationLayoutHeader>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Demo.Views.Shared
2+
{
3+
using NativeCode.Mobile.AppCompat.Controls;
4+
5+
public partial class MenuHeaderView : NavigationLayoutHeader
6+
{
7+
public MenuHeaderView()
8+
{
9+
this.InitializeComponent();
10+
}
11+
}
12+
}

src/NativeCode.Mobile.AppCompat.Controls/Card.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ public class Card : ContentView, ICommandProvider
1212
x => x.CommandParameter,
1313
default(object));
1414

15-
public static readonly BindableProperty RadiusProperty = BindableProperty.Create<Card, double>(x => x.Radius, 20.0d);
15+
public static readonly BindableProperty ElevationProperty = BindableProperty.Create<Card, double>(x => x.Elevation, default(double));
16+
17+
public static readonly BindableProperty RadiusProperty = BindableProperty.Create<Card, double>(x => x.Radius, 5.0d);
1618

1719
public Card()
1820
{
19-
this.Padding = new Thickness(20);
21+
this.Padding = new Thickness(5);
2022
}
2123

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

42+
public double Elevation
43+
{
44+
get { return (double)this.GetValue(ElevationProperty); }
45+
set { this.SetValue(ElevationProperty, value); }
46+
}
47+
4048
public double Radius
4149
{
4250
get { return (double)this.GetValue(RadiusProperty); }

src/NativeCode.Mobile.AppCompat.Controls/FloatingButton.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ public class FloatingButton : View, ICommandProvider
1414
default(FloatingButtonSize),
1515
BindingMode.OneWayToSource);
1616

17-
public static readonly BindableProperty ColorProperty = BindableProperty.Create<FloatingButton, Color>(x => x.Color, default(Color));
17+
public static readonly BindableProperty ColorProperty = BindableProperty.Create<FloatingButton, Color>(x => x.Color, Color.Accent);
18+
19+
public static readonly BindableProperty ColorPressedProperty = BindableProperty.Create<FloatingButton, Color>(x => x.ColorPressed, Color.Accent);
1820

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

@@ -42,6 +44,12 @@ public Color Color
4244
set { this.SetValue(ColorProperty, value); }
4345
}
4446

47+
public Color ColorPressed
48+
{
49+
get { return (Color)this.GetValue(ColorPressedProperty); }
50+
set { this.SetValue(ColorPressedProperty, value); }
51+
}
52+
4553
/// <summary>
4654
/// Gets or sets the command.
4755
/// </summary>

src/NativeCode.Mobile.AppCompat.Controls/NativeCode.Mobile.AppCompat.Controls.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<DefineConstants>TRACE</DefineConstants>
3434
<ErrorReport>prompt</ErrorReport>
3535
<WarningLevel>4</WarningLevel>
36+
<RunCodeAnalysis>true</RunCodeAnalysis>
3637
</PropertyGroup>
3738
<ItemGroup>
3839
<Compile Include="Card.cs" />
@@ -42,6 +43,7 @@
4243
<Compile Include="NavigationLayout.cs" />
4344
<Compile Include="NavigationLayoutMenu.cs" />
4445
<Compile Include="Platforms\IUserNotifier.cs" />
46+
<Compile Include="NavigationLayoutHeader.cs" />
4547
<Compile Include="Properties\AssemblyInfo.cs" />
4648
</ItemGroup>
4749
<ItemGroup>

src/NativeCode.Mobile.AppCompat.Controls/NavigationLayout.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
namespace NativeCode.Mobile.AppCompat.Controls
22
{
3+
using NativeCode.Mobile.AppCompat.Controls.Platforms;
4+
35
using Xamarin.Forms;
46

57
public class NavigationLayout : Layout<NavigationLayoutMenu>
68
{
7-
public static readonly BindableProperty HeaderViewProperty = BindableProperty.Create<NavigationLayout, ContentView>(
9+
public static readonly BindableProperty HeaderViewProperty = BindableProperty.Create<NavigationLayout, NavigationLayoutHeader>(
810
x => x.HeaderView,
9-
default(ContentView));
11+
default(NavigationLayoutHeader));
1012

11-
public ContentView HeaderView
13+
public NavigationLayoutHeader HeaderView
1214
{
13-
get { return (ContentView)this.GetValue(HeaderViewProperty); }
15+
get { return (NavigationLayoutHeader)this.GetValue(HeaderViewProperty); }
1416
set { this.SetValue(HeaderViewProperty, value); }
1517
}
1618

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace NativeCode.Mobile.AppCompat.Controls
2+
{
3+
using Xamarin.Forms;
4+
5+
public class NavigationLayoutHeader : ContentView
6+
{
7+
}
8+
}

src/NativeCode.Mobile.AppCompat.Controls/NavigationLayoutMenu.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ public class NavigationLayoutMenu : View, ICommandProvider
88
{
99
public static readonly BindableProperty CommandProperty = BindableProperty.Create<NavigationLayoutMenu, ICommand>(x => x.Command, default(ICommand));
1010

11-
public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create<NavigationLayoutMenu, object>(
12-
x => x.CommandParameter,
13-
default(object));
11+
public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create<NavigationLayoutMenu, object>(x => x.CommandParameter, default(object));
12+
13+
public static readonly BindableProperty GroupProperty = BindableProperty.Create<NavigationLayoutMenu, int>(x => x.Group, default(int));
1414

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

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

31+
public int Group
32+
{
33+
get { return (int)this.GetValue(GroupProperty); }
34+
set { this.SetValue(GroupProperty, value); }
35+
}
36+
3137
public ImageSource Icon
3238
{
3339
get { return (ImageSource)this.GetValue(IconProperty); }

src/NativeCode.Mobile.AppCompat.Controls/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Reflection;
22
using System.Resources;
3+
using System.Runtime.InteropServices;
34

45
[assembly: AssemblyCompany("NativeCode Development")]
56
[assembly: AssemblyConfiguration("")]
@@ -12,4 +13,5 @@
1213
[assembly: AssemblyTitle("NativeCode.Mobile.AppCompat.Controls")]
1314
[assembly: AssemblyTrademark("")]
1415
[assembly: AssemblyVersion("1.0.0.0")]
16+
[assembly: ComVisible(false)]
1517
[assembly: NeutralResourcesLanguage("en")]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace NativeCode.Mobile.AppCompat.Renderers.Helpers
2+
{
3+
using Android.Views;
4+
5+
internal static class MeasureSpecFactory
6+
{
7+
public static int MakeMeasureSpec(int size, MeasureSpecMode mode)
8+
{
9+
return (int)(size + mode);
10+
}
11+
12+
public static int GetSize(int measureSpec)
13+
{
14+
return measureSpec & 1073741823;
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)