8000 fix(android/action-bar): process Icon Fonts in NavigationButton the s… · NativeScript/NativeScript@49d9105 · GitHub
[go: up one dir, main page]

Skip to content

Commit 49d9105

Browse files
committed
fix(android/action-bar): process Icon Fonts in NavigationButton the same way as in ActionItem
1 parent 3b57851 commit 49d9105

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tns-core-modules/ui/action-bar/action-bar.android.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,21 @@ export class ActionBar extends ActionBarBase {
227227
}
228228
}
229229
else if (navButton.icon) {
230-
let drawableOrId = getDrawableOrResourceId(navButton.icon, appResources);
231-
if (drawableOrId) {
232-
this.nativeViewProtected.setNavigationIcon(drawableOrId);
230+
if (isFontIconURI(navButton.icon)) {
231+
const fontIconCode = navButton.icon.split("//")[1];
232+
const font = navButton.style.fontInternal;
233+
const color = navButton.style.color;
234+
const is = fromFontIconCode(fontIconCode, font, color);
235+
236+
if (is && is.android) {
237+
const drawable = new android.graphics.drawable.BitmapDrawable(appResources, is.android);
238+
this.nativeViewProtected.setNavigationIcon(drawable);
239+
}
240+
} else {
241+
let drawableOrId = getDrawableOrResourceId(navButton.icon, appResources);
242+
if (drawableOrId) {
243+
this.nativeViewProtected.setNavigationIcon(drawableOrId);
244+
}
233245
}
234246
}
235247

0 commit comments

Comments
 (0)
0