diff --git a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj index 7c1f681d..07016d17 100644 --- a/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj +++ b/BookAStar/BookAStar.Droid/BookAStar.Droid.csproj @@ -343,6 +343,7 @@ + diff --git a/BookAStar/BookAStar.Droid/Rendering/ImageButtonRenderer.cs b/BookAStar/BookAStar.Droid/Rendering/ImageButtonRenderer.cs new file mode 100644 index 00000000..9a568c9b --- /dev/null +++ b/BookAStar/BookAStar.Droid/Rendering/ImageButtonRenderer.cs @@ -0,0 +1,256 @@ +// *********************************************************************** +// Assembly : XLabs.Forms.Droid +// Author : XLabs Team +// Created : 12-27-2015 +// +// Last Modified By : XLabs Team +// Last Modified On : 01-04-2016 +// *********************************************************************** +// +// Copyright (c) XLabs Team. All rights reserved. +// +// +// This project is licensed under the Apache 2.0 license +// https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/LICENSE +// +// XLabs is a open source project that aims to provide a powerfull and cross +// platform set of controls tailored to work with Xamarin Forms. +// +// *********************************************************************** +// + +using System; +using System.ComponentModel; +using System.Threading.Tasks; +using Android.Graphics; +using Android.Graphics.Drawables; +using Android.Views; +using XLabs.Enums; +using XLabs.Forms.Extensions; +using Color = Xamarin.Forms.Color; +using View = Android.Views.View; +using BookAStar.Rendering; +using BookAStar.Views; +using Xamarin.Forms.Platform.Android.AppCompat; +using Xamarin.Forms; +using Xamarin.Forms.Platform.Android; +using System.IO; +using BookAStar.Helpers; +using System.Reflection; +using System.Threading; + +[assembly: ExportRenderer(typeof(ImageButton), typeof(ImageButtonRenderer))] +namespace BookAStar.Rendering +{ + /// + /// Draws a button on the Android platform with the image shown in the right + /// position with the right size. + /// + public partial class ImageButtonRenderer : Xamarin.Forms.Platform.Android.AppCompat.ButtonRenderer + { + private static float _density = float.MinValue; + + + /// + /// Sets up the button including the image. + /// + /// The event arguments. + private ImageButton ImageButton + { + get { return (ImageButton)Element; } + } + + protected override async void OnElementChanged(ElementChangedEventArgs