summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/Platform.cs
diff options
context:
space:
mode:
authoradrianknight89 <adrianknight89@outlook.com>2016-11-03 13:38:38 -0500
committerSamantha Houts <samantha@teamredwall.com>2016-11-03 11:38:38 -0700
commit84995a921221811d2e7047d54dcefde0c8063397 (patch)
tree5868bf9bd5ffd6dd2fb0c8d8b22fd8728b9c4764 /Xamarin.Forms.Platform.Android/Platform.cs
parenta2fae62d8384f78c1b5f0ba3dc088000946479bc (diff)
downloadxamarin-forms-84995a921221811d2e7047d54dcefde0c8063397.tar.gz
xamarin-forms-84995a921221811d2e7047d54dcefde0c8063397.tar.bz2
xamarin-forms-84995a921221811d2e7047d54dcefde0c8063397.zip
[Android] Allow path-based icons to be loaded as toolbar icons (#437)
* Created a bitmap method to check for resource as well as path * Update platform and navigationrenderer to get images from two locations * CellAdapter could use path-based icon finding * sample app to test toolbaritem icons
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Platform.cs')
-rw-r--r--Xamarin.Forms.Platform.Android/Platform.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Xamarin.Forms.Platform.Android/Platform.cs b/Xamarin.Forms.Platform.Android/Platform.cs
index 3334ba6e..29af59f7 100644
--- a/Xamarin.Forms.Platform.Android/Platform.cs
+++ b/Xamarin.Forms.Platform.Android/Platform.cs
@@ -361,8 +361,8 @@ namespace Xamarin.Forms.Platform.Android
IMenuItem menuItem = menu.Add(item.Text);
if (!string.IsNullOrEmpty(item.Icon))
{
- Drawable iconBitmap = _context.Resources.GetDrawable(item.Icon);
- if (iconBitmap != null)
+ var iconBitmap = new BitmapDrawable(_context.Resources, ResourceManager.GetBitmap(_context.Resources, item.Icon));
+ if (iconBitmap != null && iconBitmap.Bitmap != null)
menuItem.SetIcon(iconBitmap);
}
menuItem.SetEnabled(controller.IsEnabled);
@@ -948,7 +948,10 @@ namespace Xamarin.Forms.Platform.Android
FileImageSource titleIcon = NavigationPage.GetTitleIcon(view);
if (!string.IsNullOrWhiteSpace(titleIcon))
{
- actionBar.SetLogo(_context.Resources.GetDrawable(titleIcon));
+ var iconBitmap = new BitmapDrawable(_context.Resources, ResourceManager.GetBitmap(_context.Resources, titleIcon));
+ if (iconBitmap != null && iconBitmap.Bitmap != null)
+ actionBar.SetLogo(iconBitmap);
+
useLogo = true;
showHome = true;
showTitle = true;