mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-26 03:01:51 +08:00
Merge branch 'master' into mdonev/release-to-master-7011
This commit is contained in:
@ -27,6 +27,17 @@
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true" >
|
||||
<meta-data android:name="debugLayouts" android:value="true" />
|
||||
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:authorities="org.nativescript.apps.provider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths"/>
|
||||
</provider>
|
||||
|
||||
<activity
|
||||
android:name="com.tns.NativeScriptActivity"
|
||||
android:label="@string/title_activity_kimera"
|
||||
|
4
apps/app/App_Resources/Android/xml/provider_paths.xml
Normal file
4
apps/app/App_Resources/Android/xml/provider_paths.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<external-path name="external_files" path="."/>
|
||||
</paths>
|
17
apps/app/ui-tests-app/action-bar/icons.ts
Normal file
17
apps/app/ui-tests-app/action-bar/icons.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import * as frame from "tns-core-modules/ui/frame";
|
||||
import { EventData } from "tns-core-modules/ui/frame";
|
||||
import { Button } from "tns-core-modules/ui/button";
|
||||
import { ActionBar } from "tns-core-modules/ui/action-bar";
|
||||
|
||||
const iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
|
||||
|
||||
export function navigate(args) {
|
||||
frame.topmost().navigate("ui-tests-app/action-bar/clean");
|
||||
}
|
||||
|
||||
export function onChangeRenderingMode(args: EventData) {
|
||||
const button = <Button>args.object;
|
||||
const actionBar = <ActionBar>button.page.actionBar
|
||||
actionBar.iosIconRenderingMode = <"automatic" | "alwaysOriginal" | "alwaysTemplate">iconModes[(iconModes.indexOf(actionBar.iosIconRenderingMode) + 1) % iconModes.length];
|
||||
button.text = "" + actionBar.iosIconRenderingMode;
|
||||
}
|
14
apps/app/ui-tests-app/action-bar/icons.xml
Normal file
14
apps/app/ui-tests-app/action-bar/icons.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<Page>
|
||||
<Page.actionBar>
|
||||
<ActionBar>
|
||||
<ActionBar.actionItems>
|
||||
<ActionItem icon="res://icon" tap="navigate"/>
|
||||
<ActionItem icon="res://add_to_fav" tap="navigate"/>
|
||||
</ActionBar.actionItems>
|
||||
</ActionBar>
|
||||
</Page.actionBar>
|
||||
<StackLayout>
|
||||
<Button text="go to cleared page" tap="navigate"/>
|
||||
<Button text="undefined" tap="onChangeRenderingMode"/>
|
||||
</StackLayout>
|
||||
</Page>
|
17
apps/app/ui-tests-app/action-bar/local-icons.ts
Normal file
17
apps/app/ui-tests-app/action-bar/local-icons.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import * as frame from "tns-core-modules/ui/frame";
|
||||
import { EventData } from "tns-core-modules/ui/frame";
|
||||
import { Button } from "tns-core-modules/ui/button";
|
||||
import { ActionBar } from "tns-core-modules/ui/action-bar";
|
||||
|
||||
const iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
|
||||
|
||||
export function navigate(args) {
|
||||
frame.topmost().navigate("ui-tests-app/action-bar/clean");
|
||||
}
|
||||
|
||||
export function onChangeRenderingMode(args: EventData) {
|
||||
const button = <Button>args.object;
|
||||
const actionBar = <ActionBar>button.page.actionBar
|
||||
actionBar.iosIconRenderingMode = <"automatic" | "alwaysOriginal" | "alwaysTemplate">iconModes[(iconModes.indexOf(actionBar.iosIconRenderingMode) + 1) % iconModes.length];
|
||||
button.text = "" + actionBar.iosIconRenderingMode;
|
||||
}
|
14
apps/app/ui-tests-app/action-bar/local-icons.xml
Normal file
14
apps/app/ui-tests-app/action-bar/local-icons.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<Page>
|
||||
<Page.actionBar>
|
||||
<ActionBar>
|
||||
<ActionBar.actionItems>
|
||||
<ActionItem icon="~/ui-tests-app/resources/images/icon.png" tap="navigate"/>
|
||||
<ActionItem icon="~/ui-tests-app/resources/images/add_to_fav@3x.png" tap="navigate"/>
|
||||
</ActionBar.actionItems>
|
||||
</ActionBar>
|
||||
</Page.actionBar>
|
||||
<StackLayout>
|
||||
<Button text="go to cleared page" tap="navigate"/>
|
||||
<Button text="undefined" tap="onChangeRenderingMode"/>
|
||||
</StackLayout>
|
||||
</Page>
|
@ -15,6 +15,8 @@ export function loadExamples() {
|
||||
examples.set("actBG", "action-bar/background");
|
||||
examples.set("actStyle", "action-bar/all");
|
||||
examples.set("actIcons", "action-bar/system-icons");
|
||||
examples.set("actLocalIcons", "action-bar/local-icons");
|
||||
examples.set("actResIcons", "action-bar/icons");
|
||||
examples.set("actView", "action-bar/action-view");
|
||||
examples.set("actionItemPosition", "action-bar/action-item-position");
|
||||
examples.set("actBGCss", "action-bar/background-css");
|
||||
|
17
apps/app/ui-tests-app/intent/main-page.ts
Normal file
17
apps/app/ui-tests-app/intent/main-page.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { EventData } from "tns-core-modules/data/observable";
|
||||
import { SubMainPageViewModel } from "../sub-main-page-view-model";
|
||||
import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
|
||||
export function pageLoaded(args: EventData) {
|
||||
const page = <Page>args.object;
|
||||
const wrapLayout = <WrapLayout>page.getViewById("wrapLayoutWithExamples");
|
||||
page.bindingContext = new SubMainPageViewModel(wrapLayout, loadExamples());
|
||||
}
|
||||
|
||||
export function loadExamples() {
|
||||
const examples = new Map<string, string>();
|
||||
examples.set("open-file", "intent/open-file");
|
||||
|
||||
return examples;
|
||||
}
|
6
apps/app/ui-tests-app/intent/main-page.xml
Normal file
6
apps/app/ui-tests-app/intent/main-page.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<Page loaded="pageLoaded">
|
||||
<ScrollView orientation="vertical" row="1">
|
||||
<WrapLayout id="wrapLayoutWithExamples"/>
|
||||
</ScrollView>
|
||||
</Page>
|
15
apps/app/ui-tests-app/intent/open-file.ts
Normal file
15
apps/app/ui-tests-app/intent/open-file.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { isIOS, isAndroid } from "tns-core-modules/platform";
|
||||
import * as fs from "tns-core-modules/file-system/file-system";
|
||||
import * as utils from "tns-core-modules/utils/utils";
|
||||
|
||||
export function openFile() {
|
||||
let directory;
|
||||
if (isIOS) {
|
||||
directory = fs.knownFolders.ios.downloads();
|
||||
} else if (isAndroid) {
|
||||
directory = android.os.Environment.getExternalStorageDirectory().getAbsolutePath().toString();
|
||||
}
|
||||
|
||||
const filePath = fs.path.join(directory, "Test_File_Open.txt");
|
||||
utils.openFile(filePath);
|
||||
}
|
5
apps/app/ui-tests-app/intent/open-file.xml
Normal file
5
apps/app/ui-tests-app/intent/open-file.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<Page navigatingTo="navigatingTo">
|
||||
<GridLayout id="root">
|
||||
<Button text="Open File" tap="openFile" height="40"></Button>
|
||||
</GridLayout>
|
||||
</Page>
|
@ -36,6 +36,7 @@ export function pageLoaded(args: EventData) {
|
||||
examples.set("progress-bar", "progress-bar/main-page");
|
||||
examples.set("date-picker", "date-picker/date-picker");
|
||||
examples.set("nested-frames", "nested-frames/main-page");
|
||||
examples.set("intent", "intent/main-page");
|
||||
page.bindingContext = new MainPageViewModel(wrapLayout, examples);
|
||||
|
||||
const parent = page.getViewById("parentLayout");
|
||||
|
@ -19,6 +19,7 @@ export function loadExamples() {
|
||||
examples.set("tabmore", "tab-view/tab-view-more");
|
||||
examples.set("tabViewCss", "tab-view/tab-view-css");
|
||||
examples.set("tab-view-icons", "tab-view/tab-view-icon");
|
||||
examples.set("tab-view-icons-local", "tab-view/tab-view-icon-local");
|
||||
examples.set("tab-view-icon-change", "tab-view/tab-view-icon-change");
|
||||
examples.set("text-transform", "tab-view/text-transform");
|
||||
examples.set("tab-view-bottom-position", "tab-view/tab-view-bottom-position");
|
||||
|
21
apps/app/ui-tests-app/tab-view/tab-view-icon-local.ts
Normal file
21
apps/app/ui-tests-app/tab-view/tab-view-icon-local.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { EventData } from "tns-core-modules/data/observable";
|
||||
import { Button } from "tns-core-modules/ui/button";
|
||||
import { TabView } from "tns-core-modules/ui/tab-view";
|
||||
|
||||
let iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
|
||||
|
||||
export const onNavigate = updateButtons;
|
||||
|
||||
export function onChangeRenderingMode(args: EventData) {
|
||||
let tabView = (<Button>args.object).page.getViewById<TabView>("tab-view");
|
||||
tabView.iosIconRenderingMode = <"automatic" | "alwaysOriginal" | "alwaysTemplate">iconModes[(iconModes.indexOf(tabView.iosIconRenderingMode) + 1) % iconModes.length];
|
||||
updateButtons(args);
|
||||
}
|
||||
|
||||
function updateButtons(args) {
|
||||
let button = (<Button>args.object);
|
||||
let tabView = button.page.getViewById<TabView>("tab-view");
|
||||
for (let i = 0, length = tabView.items.length; i < length; i++) {
|
||||
(<Button>tabView.items[i].view).text = "" + tabView.iosIconRenderingMode;
|
||||
}
|
||||
}
|
26
apps/app/ui-tests-app/tab-view/tab-view-icon-local.xml
Normal file
26
apps/app/ui-tests-app/tab-view/tab-view-icon-local.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigate">
|
||||
<TabView id="tab-view" tabTextColor="green" selectedTabTextColor="red" tabBackgroundColor="yellow">
|
||||
<TabView.items>
|
||||
<TabViewItem iconSource="~/ui-tests-app/resources/images/icon.png">
|
||||
<TabViewItem.view>
|
||||
<Button text="undefined" tap="onChangeRenderingMode"/>
|
||||
</TabViewItem.view>
|
||||
</TabViewItem>
|
||||
<TabViewItem iconSource="~/ui-tests-app/resources/images/add_to_fav@3x.png">
|
||||
<TabViewItem.view>
|
||||
<Button text="undefined" tap="onChangeRenderingMode"/>
|
||||
</TabViewItem.view>
|
||||
</TabViewItem>
|
||||
<TabViewItem iconSource="~/ui-tests-app/resources/images/icon.png" title="NativeScript">
|
||||
<TabViewItem.view>
|
||||
<Button text="undefined" tap="onChangeRenderingMode"/>
|
||||
</TabViewItem.view>
|
||||
</TabViewItem>
|
||||
<TabViewItem iconSource="~/ui-tests-app/resources/images/add_to_fav@3x.png" title="Favorites">
|
||||
<TabViewItem.view>
|
||||
<Button text="undefined" tap="onChangeRenderingMode"/>
|
||||
</TabViewItem.view>
|
||||
</TabViewItem>
|
||||
</TabView.items>
|
||||
</TabView>
|
||||
</Page>
|
Reference in New Issue
Block a user