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>
|
||||||
<Page.actionBar>
|
<Page.actionBar>
|
||||||
<ActionBar automationText="actionBar">
|
<ActionBar automationText="actionBar">
|
||||||
|
<NavigationButton icon="font://" class="font-awesome font-size color"/>
|
||||||
<ActionBar.actionItems>
|
<ActionBar.actionItems>
|
||||||
<!-- font family + font size + color -->
|
<!-- font family + font size + color -->
|
||||||
<ActionItem icon="font://" class="font-awesome font-size color" tap="navigate"/>
|
<ActionItem icon="font://" class="font-awesome font-size color" tap="navigate"/>
|
||||||
|
|||||||
@@ -227,11 +227,23 @@ export class ActionBar extends ActionBarBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (navButton.icon) {
|
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);
|
let drawableOrId = getDrawableOrResourceId(navButton.icon, appResources);
|
||||||
if (drawableOrId) {
|
if (drawableOrId) {
|
||||||
this.nativeViewProtected.setNavigationIcon(drawableOrId);
|
this.nativeViewProtected.setNavigationIcon(drawableOrId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set navigation content descripion, used by screen readers for the vision-impaired users
|
// Set navigation content descripion, used by screen readers for the vision-impaired users
|
||||||
this.nativeViewProtected.setNavigationContentDescription(navButton.text || null);
|
this.nativeViewProtected.setNavigationContentDescription(navButton.text || null);
|
||||||
|
|||||||
Reference in New Issue
Block a user