FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(android): add openFile to utils by t3hmrman · Pull Request #6895 · NativeScript/NativeScript · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .json  (1) .ts  (7) .xml  (5) All 3 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
11 changes: 11 additions & 0 deletions apps/app/App_Resources/Android/AndroidManifest.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions apps/app/ui-tests-app/intent/main-page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions apps/app/ui-tests-app/intent/main-page.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions apps/app/ui-tests-app/intent/open-file.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions apps/app/ui-tests-app/intent/open-file.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Page navigatingTo="navigatingTo">
<GridLayout id="root">
<Button text="Open File" tap="openFile" height="40"></Button>
</GridLayout>
</Page>
1 change: 1 addition & 0 deletions apps/app/ui-tests-app/main-page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/AppTheme" >

<activity
android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
Expand Down
2 changes: 1 addition & 1 deletion tests/app/app/mainPage.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let executeTests = true;
trace.enable();
trace.addCategories(trace.categories.Test + "," + trace.categories.Error);

// When debugging
// // When debugging
// trace.setCategories(trace.categories.concat(
// trace.categories.Test,
// trace.categories.Navigation,
Expand Down
Loading

Back | FazBrowse Home | New Git URL