summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-04-25 10:52:48 -0600
committerRui Marinho <me@ruimarinho.net>2016-04-25 12:52:48 -0400
commit07df05ced2b43446c84d47f4b7a8325abcd0f767 (patch)
tree21ac508248e24266a884f9bf0fc28acadf7978fc /Xamarin.Forms.Platform.Android
parent6c0c11960b26c4ccb3322fec04e0eb6f55d9da07 (diff)
downloadxamarin-forms-07df05ced2b43446c84d47f4b7a8325abcd0f767.tar.gz
xamarin-forms-07df05ced2b43446c84d47f4b7a8325abcd0f767.tar.bz2
xamarin-forms-07df05ced2b43446c84d47f4b7a8325abcd0f767.zip
Remove ToolBar from Core; Remove ToolBar renderers and unit tests (#124)
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/ToolbarRenderer.cs65
-rw-r--r--Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj1
2 files changed, 0 insertions, 66 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/ToolbarRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ToolbarRenderer.cs
deleted file mode 100644
index 92a774e8..00000000
--- a/Xamarin.Forms.Platform.Android/Renderers/ToolbarRenderer.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using Android.Widget;
-using AScrollView = Android.Widget.ScrollView;
-using AButton = Android.Widget.Button;
-using AView = Android.Views.View;
-
-namespace Xamarin.Forms.Platform.Android
-{
- public class ToolbarRenderer : ViewRenderer
- {
- public ToolbarRenderer()
- {
- AutoPackage = false;
- }
-
- protected override void OnElementChanged(ElementChangedEventArgs<View> e)
- {
- base.OnElementChanged(e);
-
- if (e.OldElement == null)
- {
- var layout = new LinearLayout(Context);
- layout.SetBackgroundColor(new Color(0.2, 0.2, 0.2, 0.5).ToAndroid());
-
- layout.Orientation = Orientation.Horizontal;
-
- SetNativeControl(layout);
- }
- else
- {
- var oldToolbar = (Toolbar)e.OldElement;
- oldToolbar.ItemAdded -= OnToolbarItemsChanged;
- oldToolbar.ItemRemoved -= OnToolbarItemsChanged;
- }
-
- UpdateChildren();
-
- var toolbar = (Toolbar)e.NewElement;
- toolbar.ItemAdded += OnToolbarItemsChanged;
- toolbar.ItemRemoved += OnToolbarItemsChanged;
- }
-
- void OnToolbarItemsChanged(object sender, ToolbarItemEventArgs e)
- {
- UpdateChildren();
- }
-
- void UpdateChildren()
- {
- RemoveAllViews();
-
- foreach (ToolbarItem child in ((Toolbar)Element).Items)
- {
- AView view = null;
-
- if (!string.IsNullOrEmpty(child.Icon))
- view = new ToolbarImageButton(Context, child);
- else
- view = new AButton(Context);
-
- using (var param = new LinearLayout.LayoutParams(LayoutParams.WrapContent, (int)Context.ToPixels(48), 1))
- ((LinearLayout)Control).AddView(view, param);
- }
- }
- }
-} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj b/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj
index 2dea12eb..44bac817 100644
--- a/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj
+++ b/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj
@@ -223,7 +223,6 @@
<Compile Include="Renderers\TableViewModelRenderer.cs" />
<Compile Include="Renderers\TableViewRenderer.cs" />
<Compile Include="Renderers\TimePickerRenderer.cs" />
- <Compile Include="Renderers\ToolbarRenderer.cs" />
<Compile Include="Renderers\WebViewRenderer.cs" />
<Compile Include="ResourceManager.cs" />
<Compile Include="ViewExtensions.cs" />