| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 1 | + import * as frame from "tns-core-modules/ui/frame"; | ||
| 2 | + import { EventData } from "tns-core-modules/ui/frame"; | ||
| 3 | + import { Button } from "tns-core-modules/ui/button"; | ||
| 4 | + import { ActionBar } from "tns-core-modules/ui/action-bar"; | ||
| 5 | + | ||
| 6 | + const iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined]; | ||
| 7 | + | ||
| 8 | + export function navigate(args) { | ||
| 9 | + frame.topmost().navigate("ui-tests-app/action-bar/clean"); | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + export function onChangeRenderingMode(args: EventData) { | ||
| 13 | + const button = <Button>args.object; | ||
| 14 | + const actionBar = <ActionBar>button.page.actionBar | ||
| 15 | + actionBar.iosIconRenderingMode = <"automatic" | "alwaysOriginal" | "alwaysTemplate">iconModes[(iconModes.indexOf(actionBar.iosIconRenderingMode) + 1) % iconModes.length]; | ||
| 16 | + button.text = "" + actionBar.iosIconRenderingMode; | ||
| 17 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,14 @@ | |||
| 1 | + <Page> | ||
| 2 | + <Page.actionBar> | ||
| 3 | + <ActionBar> | ||
| 4 | + <ActionBar.actionItems> | ||
| 5 | + <ActionItem icon="res://icon" tap="navigate"/> | ||
| 6 | + <ActionItem icon="res://add_to_fav" tap="navigate"/> | ||
| 7 | + </ActionBar.actionItems> | ||
| 8 | + </ActionBar> | ||
| 9 | + </Page.actionBar> | ||
| 10 | + <StackLayout> | ||
| 11 | + <Button text="go to cleared page" tap="navigate"/> | ||
| 12 | + <Button text="undefined" tap="onChangeRenderingMode"/> | ||
| 13 | + </StackLayout> | ||
| 14 | + </Page> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 1 | + import * as frame from "tns-core-modules/ui/frame"; | ||
| 2 | + import { EventData } from "tns-core-modules/ui/frame"; | ||
| 3 | + import { Button } from "tns-core-modules/ui/button"; | ||
| 4 | + import { ActionBar } from "tns-core-modules/ui/action-bar"; | ||
| 5 | + | ||
| 6 | + const iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined]; | ||
| 7 | + | ||
| 8 | + export function navigate(args) { | ||
| 9 | + frame.topmost().navigate("ui-tests-app/action-bar/clean"); | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + export function onChangeRenderingMode(args: EventData) { | ||
| 13 | + const button = <Button>args.object; | ||
| 14 | + const actionBar = <ActionBar>button.page.actionBar | ||
| 15 | + actionBar.iosIconRenderingMode = <"automatic" | "alwaysOriginal" | "alwaysTemplate">iconModes[(iconModes.indexOf(actionBar.iosIconRenderingMode) + 1) % iconModes.length]; | ||
| 16 | + button.text = "" + actionBar.iosIconRenderingMode; | ||
| 17 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,14 @@ | |||
| 1 | + <Page> | ||
| 2 | + <Page.actionBar> | ||
| 3 | + <ActionBar> | ||
| 4 | + <ActionBar.actionItems> | ||
| 5 | + <ActionItem icon="~/ui-tests-app/resources/images/icon.png" tap="navigate"/> | ||
| 6 | + <ActionItem icon="~/ui-tests-app/resources/images/add_to_fav@3x.png" tap="navigate"/> | ||
| 7 | + </ActionBar.actionItems> | ||
| 8 | + </ActionBar> | ||
| 9 | + </Page.actionBar> | ||
| 10 | + <StackLayout> | ||
| 11 | + <Button text="go to cleared page" tap="navigate"/> | ||
| 12 | + <Button text="undefined" tap="onChangeRenderingMode"/> | ||
| 13 | + </StackLayout> | ||
| 14 | + </Page> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,8 @@ export function loadExamples() { | |||
| 15 | 15 | examples.set("actBG", "action-bar/background"); | |
| 16 | 16 | examples.set("actStyle", "action-bar/all"); | |
| 17 | 17 | examples.set("actIcons", "action-bar/system-icons"); | |
| 18 | + examples.set("actLocalIcons", "action-bar/local-icons"); | ||
| 19 | + examples.set("actResIcons", "action-bar/icons"); | ||
| 18 | 20 | examples.set("actView", "action-bar/action-view"); | |
| 19 | 21 | examples.set("actionItemPosition", "action-bar/action-item-position"); | |
| 20 | 22 | examples.set("actBGCss", "action-bar/background-css"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,7 @@ export function loadExamples() { | |||
| 19 | 19 | examples.set("tabmore", "tab-view/tab-view-more"); | |
| 20 | 20 | examples.set("tabViewCss", "tab-view/tab-view-css"); | |
| 21 | 21 | examples.set("tab-view-icons", "tab-view/tab-view-icon"); | |
| 22 | + examples.set("tab-view-icons-local", "tab-view/tab-view-icon-local"); | ||
| 22 | 23 | examples.set("tab-view-icon-change", "tab-view/tab-view-icon-change"); | |
| 23 | 24 | examples.set("text-transform", "tab-view/text-transform"); | |
| 24 | 25 | examples.set("tab-view-bottom-position", "tab-view/tab-view-bottom-position"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,21 @@ | |||
| 1 | + import { EventData } from "tns-core-modules/data/observable"; | ||
| 2 | + import { Button } from "tns-core-modules/ui/button"; | ||
| 3 | + import { TabView } from "tns-core-modules/ui/tab-view"; | ||
| 4 | + | ||
| 5 | + let iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined]; | ||
| 6 | + | ||
| 7 | + export const onNavigate = updateButtons; | ||
| 8 | + | ||
| 9 | + export function onChangeRenderingMode(args: EventData) { | ||
| 10 | + let tabView = (<Button>args.object).page.getViewById<TabView>("tab-view"); | ||
| 11 | + tabView.iosIconRenderingMode = <"automatic" | "alwaysOriginal" | "alwaysTemplate">iconModes[(iconModes.indexOf(tabView.iosIconRenderingMode) + 1) % iconModes.length]; | ||
| 12 | + updateButtons(args); | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + function updateButtons(args) { | ||
| 16 | + let button = (<Button>args.object); | ||
| 17 | + let tabView = button.page.getViewById<TabView>("tab-view"); | ||
| 18 | + for (let i = 0, length = tabView.items.length; i < length; i++) { | ||
| 19 | + (<Button>tabView.items[i].view).text = "" + tabView.iosIconRenderingMode; | ||
| 20 | + } | ||
| 21 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,26 @@ | |||
| 1 | + <Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigate"> | ||
| 2 | + <TabView id="tab-view" tabTextColor="green" selectedTabTextColor="red" tabBackgroundColor="yellow"> | ||
| 3 | + <TabView.items> | ||
| 4 | + <TabViewItem iconSource="~/ui-tests-app/resources/images/icon.png"> | ||
| 5 | + <TabViewItem.view> | ||
| 6 | + <Button text="undefined" tap="onChangeRenderingMode"/> | ||
| 7 | + </TabViewItem.view> | ||
| 8 | + </TabViewItem> | ||
| 9 | + <TabViewItem iconSource="~/ui-tests-app/resources/images/add_to_fav@3x.png"> | ||
| 10 | + <TabViewItem.view> | ||
| 11 | + <Button text="undefined" tap="onChangeRenderingMode"/> | ||
| 12 | + </TabViewItem.view> | ||
| 13 | + </TabViewItem> | ||
| 14 | + <TabViewItem iconSource="~/ui-tests-app/resources/images/icon.png" title="NativeScript"> | ||
| 15 | + <TabViewItem.view> | ||
| 16 | + <Button text="undefined" tap="onChangeRenderingMode"/> | ||
| 17 | + </TabViewItem.view> | ||
| 18 | + </TabViewItem> | ||
| 19 | + <TabViewItem iconSource="~/ui-tests-app/resources/images/add_to_fav@3x.png" title="Favorites"> | ||
| 20 | + <TabViewItem.view> | ||
| 21 | + <Button text="undefined" tap="onChangeRenderingMode"/> | ||
| 22 | + </TabViewItem.view> | ||
| 23 | + </TabViewItem> | ||
| 24 | + </TabView.items> | ||
| 25 | + </TabView> | ||
| 26 | + </Page> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,7 @@ export class ActionBarBase extends View implements ActionBarDefinition { | |||
| 29 | 29 | ||
| 30 | 30 | public title: string; | |
| 31 | 31 | public flat: boolean; | |
| 32 | + public iosIconRenderingMode: "automatic" | "alwaysOriginal" | "alwaysTemplate"; | ||
| 32 | 33 | ||
| 33 | 34 | get navigationButton(): NavigationButton { | |
| 34 | 35 | return this._navigationButton; | |
@@ -88,6 +89,10 @@ export class ActionBarBase extends View implements ActionBarDefinition { | |||
| 88 | 89 | this.update(); | |
| 89 | 90 | } | |
| 90 | 91 | } | |
| 92 | + | ||
| 93 | + get ios(): any { | ||
| 94 | + return undefined; | ||
| 95 | + } | ||
| 91 | 96 | ||
| 92 | 97 | get android(): AndroidActionBarSettings { | |
| 93 | 98 | return undefined; | |
@@ -346,6 +351,9 @@ export function traceMissingIcon(icon: string) { | |||
| 346 | 351 | traceMessageType.error); | |
| 347 | 352 | } | |
| 348 | 353 | ||
| 354 | + export const iosIconRenderingModeProperty = new Property<ActionBarBase, "automatic" | "alwaysOriginal" | "alwaysTemplate">({ name: "iosIconRenderingMode", defaultValue: "alwaysOriginal" }); | ||
| 355 | + iosIconRenderingModeProperty.register(ActionBarBase); | ||
| 356 | + | ||
| 349 | 357 | export const textProperty = new Property<ActionItemBase, string>({ name: "text", defaultValue: "", valueChanged: onItemChanged }); | |
| 350 | 358 | textProperty.register(ActionItemBase); | |
| 351 | 359 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -437,7 +437,7 @@ function getDrawableOrResourceId(icon: string, resources: android.content.res.Re | |||
| 437 | 437 | ||
| 438 | 438 | let is = fromFileOrResource(icon); | |
| 439 | 439 | if (is) { | |
| 440 | - drawable = new android.graphics.drawable.BitmapDrawable(is.android); | ||
| 440 | + drawable = new android.graphics.drawable.BitmapDrawable(appResources, is.android); | ||
| 441 | 441 | } | |
| 442 | 442 | ||
| 443 | 443 | result = drawable; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments