mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(android): dialogs activity usage (#10246)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
<Button text="box-shadow" tap="{{ viewDemo }}" class="btn btn-primary btn-view-demo" />
|
||||
<Button text="css-playground" tap="{{ viewDemo }}" class="btn btn-primary btn-view-demo" />
|
||||
<Button text="datepicker" tap="{{ viewDemo }}" class="btn btn-primary btn-view-demo" />
|
||||
<Button text="dialogs" tap="{{ viewDemo }}" class="btn btn-primary btn-view-demo" />
|
||||
<Button text="forms" tap="{{ viewDemo }}" class="btn btn-primary btn-view-demo" />
|
||||
<Button text="image-async" tap="{{ viewDemo }}" class="btn btn-primary btn-view-demo" />
|
||||
<Button text="image-handling" tap="{{ viewDemo }}" class="btn btn-primary btn-view-demo" />
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
<TextView testID="testTextView" hint="TextView" text="{{switchCheckedText}}" class="view-item a11y" accessibilityLabel="TestView with a value" accessibilityLiveRegion="{{accessibilityLiveRegions.Polite}}" />
|
||||
<TextField testID="testTextField" hint="TextField" class="view-item a11y" accessibilityLabel="Plain jane TextField" accessibilityHint="Tell us your real name Jane" />
|
||||
<TextView hint="TextView" class="view-item a11y" accessibilityLabel="Nice TextView" accessibilityHint="Tell us about yourself Jane" />
|
||||
<GridLayout testID="testGridLayout1" rows="25" columns="*" class="view-item" accessibilityLabel="No can go GridLayout" accessibilityHint="A grid that will not get bigger when increasing accessible text size">
|
||||
<GridLayout testID="testGridLayout1" rows="35" columns="*" class="view-item" accessibilityLabel="No can go GridLayout" accessibilityHint="A grid that will not get bigger when increasing accessible text size">
|
||||
<Label text="IN-Accessible Grid" class="view-item text-center" />
|
||||
</GridLayout>
|
||||
<GridLayout rows="25,25" columns="*,50" class="view-item a11y" accessibilityLabel="Yes an accessible GridLayout" accessibilityHint="A grid that WILL get bigger dynamically when increasing accessible text size">
|
||||
<GridLayout rows="35,35" columns="*,50" class="view-item a11y" accessibilityLabel="Yes an accessible GridLayout" accessibilityHint="A grid that WILL get bigger dynamically when increasing accessible text size">
|
||||
<Label text="Accessible Grid" class="view-item text-center" />
|
||||
<Label row="1" text="With another item in a row" class="view-item text-center" />
|
||||
<Label rowSpan="2" col="1" text="Hi" />
|
||||
|
||||
37
apps/toolbox/src/pages/dialogs.ts
Normal file
37
apps/toolbox/src/pages/dialogs.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { Page, Observable, EventData, Dialogs } from '@nativescript/core';
|
||||
|
||||
let page: Page;
|
||||
|
||||
export function navigatingTo(args: EventData) {
|
||||
page = <Page>args.object;
|
||||
page.bindingContext = new SampleData();
|
||||
}
|
||||
|
||||
export class SampleData extends Observable {
|
||||
dialogAlert() {
|
||||
Dialogs.alert('Hello');
|
||||
}
|
||||
dialogAlertWithOptions() {
|
||||
Dialogs.alert({
|
||||
title: 'Hello',
|
||||
message: 'Oh hi!',
|
||||
okButtonText: 'Nice',
|
||||
});
|
||||
}
|
||||
dialogConfirm() {
|
||||
Dialogs.confirm('Is it?').then((ok) => {
|
||||
Dialogs.alert('Ok then!');
|
||||
});
|
||||
}
|
||||
|
||||
dialogLogin() {
|
||||
Dialogs.login('Login').then((result) => {
|
||||
console.log(result);
|
||||
});
|
||||
}
|
||||
dialogAction() {
|
||||
Dialogs.action('Actions', 'Cancel', ['Test', 'Testing']).then((result) => {
|
||||
console.log(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
16
apps/toolbox/src/pages/dialogs.xml
Normal file
16
apps/toolbox/src/pages/dialogs.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
|
||||
<Page.actionBar>
|
||||
<ActionBar title="Dialogs" class="action-bar">
|
||||
</ActionBar>
|
||||
</Page.actionBar>
|
||||
<ScrollView>
|
||||
<StackLayout padding="20">
|
||||
<Button tap="{{dialogAlert}}" text="Alert" />
|
||||
<Button tap="{{dialogAlertWithOptions}}" text="Alert with Options" />
|
||||
<Button tap="{{dialogConfirm}}" text="Confirm" />
|
||||
<Button tap="{{dialogLogin}}" text="Login" />
|
||||
<Button tap="{{dialogAction}}" text="Actions" />
|
||||
|
||||
</StackLayout>
|
||||
</ScrollView>
|
||||
</Page>
|
||||
Reference in New Issue
Block a user