mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
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:
committed by
Martin Yankov
parent
3e8d6350b9
commit
4991e6dc99
@@ -1,6 +1,7 @@
|
||||
<Page>
|
||||
<Page.actionBar>
|
||||
<ActionBar automationText="actionBar">
|
||||
<NavigationButton icon="font://" class="font-awesome font-size color"/>
|
||||
<ActionBar.actionItems>
|
||||
<!-- font family + font size + color -->
|
||||
<ActionItem icon="font://" class="font-awesome font-size color" tap="navigate"/>
|
||||
|
||||
@@ -227,9 +227,21 @@ export class ActionBar extends ActionBarBase {
|
||||
}
|
||||
}
|
||||
else if (navButton.icon) {
|
||||
let drawableOrId = getDrawableOrResourceId(navButton.icon, appResources);
|
||||
if (drawableOrId) {
|
||||
this.nativeViewProtected.setNavigationIcon(drawableOrId);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user