Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into add-tizen-platform-renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
rookiejava authored Feb 24, 2017
2 parents 3298f0a + 6d9fd89 commit 531aeb4
Show file tree
Hide file tree
Showing 128 changed files with 2,361 additions and 540 deletions.
5 changes: 4 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.jpeg binary
*.jpeg binary

# Always checkout docs using unix line endings because mdoc uses unix line endings even on windows
/docs/**/*.xml text eol=lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Xamarin.Forms.Xaml;

namespace Xamarin.Forms.Build.Tasks
{
class NullExtension : ICompiledMarkupExtension
{

public IEnumerable<Instruction> ProvideValue(IElementNode node, ModuleDefinition module, ILContext context, out TypeReference typeRef)
{
typeRef = module.TypeSystem.Object;
return new[] { Instruction.Create(OpCodes.Ldnull) };
}
}
}
1 change: 1 addition & 0 deletions Xamarin.Forms.Build.Tasks/Xamarin.Forms.Build.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
<Compile Include="CompiledValueProviders\PassthroughValueProvider.cs" />
<Compile Include="CompiledConverters\ListStringTypeConverter.cs" />
<Compile Include="CompiledMarkupExtensions\TypeExtension.cs" />
<Compile Include="CompiledMarkupExtensions\NullExtension.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild">
Expand Down
30 changes: 30 additions & 0 deletions Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@
using AView = Android.Views.View;
using Android.OS;
using System.Reflection;
using Android.Text;
using Android.Text.Method;
using Xamarin.Forms.Controls.Issues;

[assembly: ExportRenderer(typeof(Bugzilla31395.CustomContentView), typeof(CustomContentRenderer))]
[assembly: ExportRenderer(typeof(NativeListView), typeof(NativeListViewRenderer))]
[assembly: ExportRenderer(typeof(NativeListView2), typeof(NativeAndroidListViewRenderer))]
[assembly: ExportRenderer(typeof(NativeCell), typeof(NativeAndroidCellRenderer))]

[assembly: ExportRenderer(typeof(Bugzilla42000._42000NumericEntryNoDecimal), typeof(EntryRendererNoDecimal))]
[assembly: ExportRenderer(typeof(Bugzilla42000._42000NumericEntryNoNegative), typeof(EntryRendererNoNegative))]

#if PRE_APPLICATION_CLASS
#elif FORMS_APPLICATION_ACTIVITY
#else
Expand Down Expand Up @@ -485,5 +491,29 @@ protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
base.OnElementChanged(e);
}
}

// Custom renderers for Bugzilla42000 demonstration purposes

public class EntryRendererNoNegative : EntryRenderer
{
protected override NumberKeyListener GetDigitsKeyListener(InputTypes inputTypes)
{
// Disable the NumberFlagSigned bit
inputTypes &= ~InputTypes.NumberFlagSigned;

return base.GetDigitsKeyListener(inputTypes);
}
}

public class EntryRendererNoDecimal : EntryRenderer
{
protected override NumberKeyListener GetDigitsKeyListener(InputTypes inputTypes)
{
// Disable the NumberFlagDecimal bit
inputTypes &= ~InputTypes.NumberFlagDecimal;

return base.GetDigitsKeyListener(inputTypes);
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="104"
android:viewportHeight="97"
android:width="104dp"
android:height="97dp">
<path
android:pathData="M14 85l3 9 72 0c0 0 5 -9 4 -10 -2 -2 -79 0 -79 1"
android:fillColor="#7c4e32" />
<path
android:pathData="M19 47c0 0 -9 7 -13 14 -5 6 3 7 3 7l1 14c0 0 10 8 23 8 14 0 26 1 28 0 2 -1 9 -2 9 -4 1 -1 27 1 27 -9C97 67 104 57 86 48 69 39 19 47 19 47"
android:fillColor="#e30000" />
<path
android:pathData="M17 32C14 80 97 75 88 29L53 14"
android:fillColor="#ffe1c4" />
<path
android:pathData="M17 32C26 -4 78 0 88 29 68 20 48 20 17 32"
android:fillColor="#8ed8f8" />
<path
android:pathData="M54 35a10 8 60 1 1 0 0.1zm-17 3a10 8 -60 1 1 0 0.1z"
android:fillColor="#ffffff" />
<path
android:pathData="M41 6c1 -1 4 -3 8 -3 3 0 9 -1 14 3L62 8 60 8 58 8C58 8 55 9 53 8 51 7 52 7 52 7L49 8 47 7 46 7c0 0 -1 2 -3 2 0 0 -2 -1 -2 -3m-24 28l0 -2c0 0 35 -20 71 -3l0 2C88 31 53 14 17 34M5 62c3 -2 5 -2 8 0 3 2 13 6 8 11 -2 2 -6 0 -8 0 -1 1 -4 2 -6 1C3 71 1 66 5 62m94 -3c0 0 -9 -2 -11 4l-3 5c0 1 -2 3 3 3 5 0 5 2 7 2 3 0 7 -1 7 -4 0 -4 -1 -11 -3 -10"
android:fillColor="#fff200" />
<path
android:pathData="M56 78l0 1m-1 -10l0 1m0 17l0 1"
android:strokeWidth="1"
android:fillColor="#000000"
android:strokeColor="#000000"
android:strokeLineCap="round" />
<path
android:pathData="M60 36a1 1 0 1 1 0 -0.1M49 36a1 1 0 1 1 0 -0.1M57 55a2 3 0 1 1 0 -0.1M12 94c0 0 20 -4 42 0 0 0 27 -4 39 0z"
android:fillColor="#000000" />
<path
android:pathData="M50 59c0 0 4 3 10 0m-4 7l2 12 -2 12M25 50c0 0 10 12 23 12 13 0 24 0 35 -15"
android:strokeWidth="0.5"
android:strokeColor="#000000" />
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="356dp"
android:height="508dp"
android:viewportWidth="356"
android:viewportHeight="508">
<path android:fillColor="#000000" android:pathData="M330.4 0H25.6C11.6 0 .2 11.4.2 25.4v457.2c0 14 11.4 25.4 25.4 25.4h304.8c14 0 25.4-11.4 25.4-25.4V25.4c0-14-11.4-25.4-25.4-25.4zM178 482.6c-14 0-25.4-11.4-25.4-25.4 0-14 11.4-25.4 25.4-25.4 14 0 25.4 11.4 25.4 25.4 0 14-11.4 25.4-25.4 25.4zm127-86.4c0 5.6-4.5 10.2-10.2 10.2H61.2c-5.6 0-10.2-4.6-10.2-10.2V61c0-5.6 4.5-10.2 10.2-10.2h233.7c5.6 0 10.2 4.6 10.2 10.2v335.2h-.1z"/>
<path android:fillColor="#000000" android:pathData="M178 101.6c-14 0-25.4 11.4-25.4 25.4 0 14 11.4 25.4 25.4 25.4 14 0 25.4-11.4 25.4-25.4 0-14-11.4-25.4-25.4-25.4zM178 203.2c-14 0-25.4 11.4-25.4 25.4v101.6c0 14 11.4 25.4 25.4 25.4 14 0 25.4-11.4 25.4-25.4V228.6c0-14-11.4-25.4-25.4-25.4z"/>
</vector>
17 changes: 17 additions & 0 deletions Xamarin.Forms.ControlGallery.Android/Resources/drawable/heart.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!-- res/drawable/heart.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="256dp"
android:width="256dp"
android:viewportWidth="32"
android:viewportHeight="32">

<!-- draw a path -->
<path android:fillColor="#8fff"
android:pathData="M20.5,9.5
c-1.955,0,-3.83,1.268,-4.5,3
c-0.67,-1.732,-2.547,-3,-4.5,-3
C8.957,9.5,7,11.432,7,14
c0,3.53,3.793,6.257,9,11.5
c5.207,-5.242,9,-7.97,9,-11.5
C25,11.432,23.043,9.5,20.5,9.5z" />
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,15 @@
<ItemGroup>
<TransformFile Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\error.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\heart.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\cartman.xml" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\drawable\caret_r.png" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public Bugzilla22229()
case Device.Android:
_prefix = "";
break;
case Device.Windows:
case Device.WinRT:
case Device.UWP:
case Device.WinPhone:
_prefix = "Assets/";
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace Xamarin.Forms.Controls
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 928650, "In a Listview on iOS, \"andExpand\" does not expand when text is two lines long")]
[Issue(IssueTracker.Bugzilla, 28650, "In a Listview on iOS, \"andExpand\" does not expand when text is two lines long")]
public class Bugzilla28650 : TestContentPage
{
const string caret_image = "caret_r.png";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
using System;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif

// Apply the default category of "Issues" to all of the tests in this assembly
// We use this as a catch-all for tests which haven't been individually categorized
#if UITEST
[assembly: NUnit.Framework.Category("Issues")]
#endif

namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 32865, "On MasterDetailPage trying to change Icon of Master page doesn\'t work if another view is pushed and Image is renderer in blue", PlatformAffected.iOS)]
public class Bugzilla32865 : TestMasterDetailPage // or TestMasterDetailPage, etc ...
{
public static Bugzilla32865 Mdp;

protected override void Init()
{
Mdp = this;

Master = new ContentPage {Title = "Master"};
Detail = new NavigationPage(new DetailView32865());
}

public void ChangeIcon()
{
Master.Icon = "settings";
}
public void ChangeIcon2()
{
Master.Icon = "menuIcon";
}
}

[Preserve(AllMembers = true)]
public class DetailView32865 : ContentPage
{
public DetailView32865()
{
Title = "Page1";

var label = new Label
{
Text = "Push a page and then change master icon. The icon should be changeable from any page on the navigation stack.",
HorizontalTextAlignment = TextAlignment.Center,
VerticalTextAlignment = TextAlignment.Center
};

var button = new Button()
{
Text = "Icon 1",
};
button.Clicked += Button_Clicked;
var button2 = new Button()
{
Text = "Icon 2",
};
button2.Clicked += Button2_Clicked;
var button3 = new Button()
{
Text = "Push Page",
};
button3.Clicked += Button3_Clicked;

var layout = new StackLayout()
{
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
Children = { label, button, button2, button3 },
};
Content = layout;
}
void Button3_Clicked(object sender, EventArgs e)
{
Navigation.PushAsync(new DetailView232865());
}

void Button_Clicked(object sender, EventArgs e)
{
Bugzilla32865.Mdp.ChangeIcon();
}

void Button2_Clicked(object sender, EventArgs e)
{
Bugzilla32865.Mdp.ChangeIcon2();
}
}

[Preserve(AllMembers = true)]
public class DetailView232865 : ContentPage
{
public DetailView232865()
{
Title = "Page2";

var button = new Button()
{
Text = "Icon 1",
};
button.Clicked += Button_Clicked;

var button2 = new Button()
{
Text = "Icon 2",
};
button2.Clicked += Button2_Clicked;

var layout = new StackLayout()
{
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
Children = { button, button2 },
};

Content = layout;
}

void Button_Clicked(object sender, EventArgs e)
{
Bugzilla32865.Mdp.ChangeIcon();
}

void Button2_Clicked(object sender, EventArgs e)
{
Bugzilla32865.Mdp.ChangeIcon2();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Bugzilla34632 : TestMasterDetailPage
{
protected override void Init ()
{
if (Device.RuntimePlatform == Device.Windows)
if (Device.RuntimePlatform == Device.UWP || Device.RuntimePlatform == Device.WinRT)
MasterBehavior = MasterBehavior.Split;
else
MasterBehavior = MasterBehavior.SplitOnLandscape;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using System.Collections.Generic;

#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 41600, "[Android] Invalid item param value for ScrollTo throws an error", PlatformAffected.Android)]
public class Bugzilla41600 : TestContentPage
{
protected override void Init()
{
var items = new List<string>();
for (var i = 0; i <= 30; i++)
items.Add(i.ToString());

var listView = new ListView
{
ItemsSource = items
};
Content = new StackLayout
{
Children =
{
listView,
new Button
{
Text = "Click for ScrollTo (should do nothing)",
Command = new Command(() =>
{
listView.ScrollTo("Hello", ScrollToPosition.Start, true);
})
},
new Button
{
Text = "Click for ScrollTo (should go to 15)",
Command = new Command(() =>
{
listView.ScrollTo(items[15], ScrollToPosition.Start, false);
})
}
}
};
}
}
}
Loading

0 comments on commit 531aeb4

Please sign in to comment.