fix(android/action-bar): process Icon Fonts in NavigationButton the same way as in ActionItem (#7842)

* fix(android/action-bar): process Icon Fonts in NavigationButton the same way as in ActionItem

* Add NavigationButton with font icons to corresponding page in ui tests app
This commit is contained in:
Yurii Cherniavskyi
2019-09-25 13:23:33 +03:00
committed by Martin Yankov
parent 3e8d6350b9
commit 4991e6dc99
2 changed files with 16 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
<Page>
<Page.actionBar>
<ActionBar automationText="actionBar">
<NavigationButton icon="font://&#xF137;" class="font-awesome font-size color"/>
<ActionBar.actionItems>
<!-- font family + font size + color -->
<ActionItem icon="font://&#xF10B;" class="font-awesome font-size color" tap="navigate"/>

View File

@@ -227,11 +227,23 @@ export class ActionBar extends ActionBarBase {
}
}
else if (navButton.icon) {
if (isFontIconURI(navButton.icon)) {
const fontIconCode = navButton.icon.split("//")[1];
const font = navButton.style.fontInternal;
const color = navButton.style.color;
const is = fromFontIconCode(fontIconCode, font, color);
if (is && is.android) {
const drawable = new android.graphics.drawable.BitmapDrawable(appResources, is.android);
this.nativeViewProtected.setNavigationIcon(drawable);
}
} else {
let drawableOrId = getDrawableOrResourceId(navButton.icon, appResources);
if (drawableOrId) {
this.nativeViewProtected.setNavigationIcon(drawableOrId);
}
}
}
// Set navigation content descripion, used by screen readers for the vision-impaired users
this.nativeViewProtected.setNavigationContentDescription(navButton.text || null);