Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
403 changed files
with
34,415 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1 +1,8 @@ | ||
# ns-androidWidget-App-Demo | ||
# How to run | ||
|
||
* Run command in your terminal | ||
```Shell | ||
tns run android | ||
``` | ||
* Add the widget from the application WidgetDemo to your home screen. | ||
* Clicking on the button on the right will increase the tap counter, while clicking on the image will open the application with which the widget is associated. |
This file contains 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,50 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="__PACKAGE__" | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
|
||
<supports-screens | ||
android:smallScreens="true" | ||
android:normalScreens="true" | ||
android:largeScreens="true" | ||
android:xlargeScreens="true"/> | ||
|
||
<uses-sdk | ||
android:minSdkVersion="17" | ||
android:targetSdkVersion="__APILEVEL__"/> | ||
|
||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
|
||
<application | ||
android:name="com.tns.NativeScriptApplication" | ||
android:allowBackup="true" | ||
android:icon="@drawable/icon" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" > | ||
<activity | ||
android:name="com.tns.NativeScriptActivity" | ||
android:label="@string/title_activity_kimera" | ||
android:configChanges="keyboardHidden|orientation|screenSize"> | ||
|
||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name="com.tns.ErrorReportActivity"/> | ||
|
||
<receiver android:name="com.tns.MyWidget"> | ||
<intent-filter> | ||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.appwidget.provider" | ||
android:resource="@xml/my_widget_info" /> | ||
</receiver> | ||
</application> | ||
</manifest> |
This file contains 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 @@ | ||
// Add your native dependencies here: | ||
|
||
// Uncomment to add recyclerview-v7 dependency | ||
//dependencies { | ||
// compile 'com.android.support:recyclerview-v7:+' | ||
//} | ||
|
||
android { | ||
defaultConfig { | ||
generatedDensities = [] | ||
} | ||
aaptOptions { | ||
additionalParameters "--no-version-vectors" | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,45 @@ | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="horizontal" | ||
android:background="#33000000" | ||
android:padding="8dp"> | ||
|
||
<ImageView | ||
android:id="@+id/taps_image" | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:layout_weight="1" | ||
android:src="@drawable/ns"/> | ||
|
||
<TextView | ||
android:id="@+id/taps_text" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_centerHorizontal="true" | ||
android:layout_centerVertical="true" | ||
android:layout_margin="8dp" | ||
android:text="0" | ||
android:textColor="#ffffff" | ||
android:textSize="30sp" | ||
android:textStyle="bold" /> | ||
|
||
<TextView | ||
android:id="@+id/appwidget_text" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_centerHorizontal="true" | ||
android:layout_centerVertical="true" | ||
android:layout_margin="8dp" | ||
android:text="TAPS" | ||
android:textColor="#ffffff" | ||
android:textSize="24sp" /> | ||
|
||
<Button | ||
android:id="@+id/tap_button" | ||
android:layout_width="0dp" | ||
android:layout_height="match_parent" | ||
android:layout_weight="1" | ||
android:text="TOUCH ME!"/> | ||
|
||
</LinearLayout> |
This file contains 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,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- 110x250dp defines minimal area of 2x4 tiles --> | ||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:initialKeyguardLayout="@layout/my_widget" | ||
android:initialLayout="@layout/my_widget" | ||
android:minHeight="110dp" | ||
android:minWidth="250dp" | ||
android:resizeMode="horizontal|vertical" | ||
android:updatePeriodMillis="18000000" | ||
android:widgetCategory="home_screen"></appwidget-provider> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIconFile</key> | ||
<string>icon.png</string> | ||
<key>CFBundleIcons</key> | ||
<dict> | ||
<key>CFBundlePrimaryIcon</key> | ||
<dict> | ||
<key>CFBundleIconFiles</key> | ||
<array> | ||
<string>icon-40</string> | ||
<string>icon-60</string> | ||
<string>icon-72</string> | ||
<string>icon-76</string> | ||
<string>Icon-Small</string> | ||
<string>Icon-Small-50</string> | ||
</array> | ||
<key>UIPrerenderedIcon</key> | ||
<false/> | ||
</dict> | ||
</dict> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UILaunchStoryboardName</key> | ||
<string>LaunchScreen</string> | ||
<key>UIRequiresFullScreen</key> | ||
<true/> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>armv7</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
</dict> | ||
</plist> |
This file contains 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 @@ | ||
// You can add custom settings here | ||
// for example you can uncomment the following line to force distribution code signing | ||
// CODE_SIGN_IDENTITY = iPhone Distribution | ||
// ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
// ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Brand Assets; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains 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,18 @@ | ||
.title { | ||
font-size: 30; | ||
horizontal-align: center; | ||
margin: 20; | ||
} | ||
|
||
button { | ||
font-size: 42; | ||
horizontal-align: center; | ||
} | ||
|
||
.message { | ||
font-size: 20; | ||
color: #284848; | ||
horizontal-align: center; | ||
margin: 0 20; | ||
text-align: center; | ||
} |
This file contains 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,2 @@ | ||
var application = require("application"); | ||
application.start({ moduleName: "main-page" }); |
This file contains 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,7 @@ | ||
var createViewModel = require("./main-view-model").createViewModel; | ||
|
||
function onNavigatingTo(args) { | ||
var page = args.object; | ||
page.bindingContext = createViewModel(); | ||
} | ||
exports.onNavigatingTo = onNavigatingTo; |
This file contains 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,7 @@ | ||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo"> | ||
<StackLayout> | ||
<Label text="Tap the button" class="title"/> | ||
<Button text="TAP" tap="{{ onTap }}" /> | ||
<Label text="{{ message }}" class="message" textWrap="true"/> | ||
</StackLayout> | ||
</Page> |
This file contains 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,24 @@ | ||
var Observable = require("data/observable").Observable; | ||
|
||
function getMessage(counter) { | ||
if (counter <= 0) { | ||
return "Hoorraaay! You unlocked the NativeScript clicker achievement!"; | ||
} else { | ||
return counter + " taps left"; | ||
} | ||
} | ||
|
||
function createViewModel() { | ||
var viewModel = new Observable(); | ||
viewModel.counter = 42; | ||
viewModel.message = getMessage(viewModel.counter); | ||
|
||
viewModel.onTap = function() { | ||
this.counter--; | ||
this.set("message", getMessage(this.counter)); | ||
} | ||
|
||
return viewModel; | ||
} | ||
|
||
exports.createViewModel = createViewModel; |
This file contains 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,46 @@ | ||
(function () { | ||
// yay for JavaScript closures! | ||
var taps = -1; | ||
var R = org.nativescript.widgetDemo.R; // reduces syntax noise, stands for 'android resources' | ||
var rng = new java.util.Random(); | ||
|
||
android.appwidget.AppWidgetProvider.extend("com.tns.MyWidget", { | ||
// is called each time the widget is added to the homescreen, or update ticks | ||
onUpdate: function (context, appWidgetManager, appWidgetIds) { | ||
console.log("Update called!"); | ||
// gets the number of instances of the same widget on the homescreen | ||
var appWidgetsLen = appWidgetIds.length; | ||
|
||
taps += 1; | ||
|
||
// for each widget - update - we want them to be consistent | ||
for (i = 0; i < appWidgetsLen; i++) { | ||
updateWidget(context, appWidgetManager, appWidgetIds, appWidgetIds[i]); | ||
} | ||
} | ||
}); | ||
|
||
function updateWidget(context, appWidgetManager, appWidgetIds, widgetId) { | ||
var text = taps.toString(); | ||
|
||
// retrieve our layout and all its views | ||
var views = new android.widget.RemoteViews(context.getPackageName(), R.layout.my_widget); | ||
|
||
views.setTextViewText(R.id.taps_text, text); | ||
|
||
var intent = new android.content.Intent(context, com.tns.MyWidget.class); | ||
intent.setAction(android.appwidget.AppWidgetManager.ACTION_APPWIDGET_UPDATE); | ||
intent.putExtra(android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds); | ||
|
||
var startAppIntent = new android.content.Intent(context, com.tns.NativeScriptActivity.class); // the activity defined in AndroidManifest | ||
startAppIntent.putExtra(android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId); | ||
|
||
var pI = android.app.PendingIntent.getBroadcast(context, 0, intent, android.app.PendingIntent.FLAG_UPDATE_CURRENT); | ||
var pI2 = android.app.PendingIntent.getActivity(context, 0, startAppIntent, android.app.PendingIntent.FLAG_UPDATE_CURRENT); | ||
|
||
views.setOnClickPendingIntent(R.id.tap_button, pI); | ||
views.setOnClickPendingIntent(R.id.taps_image, pI2); | ||
|
||
appWidgetManager.updateAppWidget(widgetId, views); | ||
} | ||
})(); |
This file contains 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 @@ | ||
{"name":"tns-template-hello-world","main":"app.js","version":"2.0.0","author":{"name":"Telerik","email":"support@telerik.com"},"description":"Nativescript hello-world project template","license":"Apache-2.0","keywords":["telerik","mobile","nativescript","{N}","tns","appbuilder","template"],"repository":{"type":"git","url":"git://github.com/NativeScript/template-hello-world.git"},"bugs":{"url":"https://github.com/NativeScript/template-hello-world/issues"},"homepage":"https://github.com/NativeScript/template-hello-world","android":{"v8Flags":"--expose_gc"},"readme":"ERROR: No README data found!","_id":"tns-template-hello-world@2.0.0","_from":"tns-template-hello-world@2.0.0"} |
This file contains 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 @@ | ||
/// <reference path="../node_modules/tns-core-modules/tns-core-modules.d.ts" /> Enable smart suggestions and completions in Visual Studio Code JavaScript projects. |
This file contains 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,20 @@ | ||
{ | ||
"description": "NativeScript Application", | ||
"readme": "NativeScript Application", | ||
"nativescript": { | ||
"id": "org.nativescript.widgetDemo", | ||
"tns-android": { | ||
"version": "2.0.0" | ||
} | ||
}, | ||
"dependencies": { | ||
"tns-core-modules": "2.0.0-2016-04-18-2684" | ||
}, | ||
"devDependencies": { | ||
"babel-traverse": "6.8.0", | ||
"babel-types": "6.8.1", | ||
"babylon": "6.7.0", | ||
"filewalker": "0.1.2", | ||
"lazy": "1.0.11" | ||
} | ||
} |
This file contains 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 @@ | ||
#Tue May 03 10:44:18 EEST 2016 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
38 changes: 38 additions & 0 deletions
38
...s/android/build-tools/android-static-binding-generator/ast-parser/helpers/file_helpers.js
This file contains 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,38 @@ | ||
var fs = require("fs"), | ||
path = require("path"); | ||
module.exports = function Helpers(config) { | ||
|
||
function cleanOutFile(filePath) { | ||
fs.truncateSync(filePath, 0); | ||
if(config && config.logger) { | ||
config.logger.info("+cleared out file: " + filePath); | ||
} | ||
} | ||
|
||
function createFile(filePath) { | ||
if(ensureDirectories(filePath)) { | ||
fs.writeFileSync(filePath, ""); | ||
if(config && config.logger) { | ||
config.logger.info("+created ast output file: "); | ||
} | ||
} | ||
cleanOutFile(filePath) | ||
} | ||
|
||
function ensureDirectories(filePath) { | ||
var parentDir = path.dirname(filePath); | ||
if(fs.existsSync(parentDir)) { | ||
return true; | ||
} | ||
|
||
ensureDirectories(parentDir); | ||
fs.mkdirSync(parentDir); | ||
return true; | ||
} | ||
|
||
return { | ||
cleanOutFile: cleanOutFile, | ||
createFile: createFile, | ||
ensureDirectories: ensureDirectories | ||
} | ||
}; |
Oops, something went wrong.