Skip to content

Instantly share code, notes, and snippets.

/modules.diff Secret

Created April 11, 2016 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/fa490f821d3a86c36bf6cb7fd2b536b5 to your computer and use it in GitHub Desktop.
Save anonymous/fa490f821d3a86c36bf6cb7fd2b536b5 to your computer and use it in GitHub Desktop.
diff --git a/platforms/android/src/main/assets/app/tns_modules/application/application.js b/platforms/android/src/main/assets/app/tns_modules/application/application.js
index 4d58c2f..da9dbec 100644
--- a/platforms/android/src/main/assets/app/tns_modules/application/application.js
+++ b/platforms/android/src/main/assets/app/tns_modules/application/application.js
@@ -3,32 +3,36 @@ var frame = require("ui/frame");
var observable = require("data/observable");
global.moduleMerge(appModule, exports);
var typedExports = exports;
-var NativeScriptApplication = (function (_super) {
- __extends(NativeScriptApplication, _super);
- function NativeScriptApplication() {
- _super.call(this);
- return global.__native(this);
- }
- NativeScriptApplication.prototype.onCreate = function () {
- androidApp.init(this);
- setupOrientationListener(androidApp);
- };
- NativeScriptApplication.prototype.onLowMemory = function () {
- gc();
- java.lang.System.gc();
- _super.prototype.onLowMemory.call(this);
- typedExports.notify({ eventName: typedExports.lowMemoryEvent, object: this, android: this });
- };
- NativeScriptApplication.prototype.onTrimMemory = function (level) {
- gc();
- java.lang.System.gc();
- _super.prototype.onTrimMemory.call(this, level);
- };
- NativeScriptApplication = __decorate([
- JavaProxy("com.tns.NativeScriptApplication")
- ], NativeScriptApplication);
- return NativeScriptApplication;
-}(android.app.Application));
+
+var NativeScriptApplication;
+exports.evalLazy = function() {
+ NativeScriptApplication = (function (_super) {
+ __extends(NativeScriptApplication, _super);
+ function NativeScriptApplication() {
+ _super.call(this);
+ return global.__native(this);
+ }
+ NativeScriptApplication.prototype.onCreate = function () {
+ androidApp.init(this);
+ setupOrientationListener(androidApp);
+ };
+ NativeScriptApplication.prototype.onLowMemory = function () {
+ gc();
+ java.lang.System.gc();
+ _super.prototype.onLowMemory.call(this);
+ typedExports.notify({ eventName: typedExports.lowMemoryEvent, object: this, android: this });
+ };
+ NativeScriptApplication.prototype.onTrimMemory = function (level) {
+ gc();
+ java.lang.System.gc();
+ _super.prototype.onTrimMemory.call(this, level);
+ };
+ NativeScriptApplication = __decorate([
+ JavaProxy("com.tns.NativeScriptApplication")
+ ], NativeScriptApplication);
+ return NativeScriptApplication;
+ }(android.app.Application));
+}
function initEvents() {
var lifecycleCallbacks = new android.app.Application.ActivityLifecycleCallbacks({
onActivityCreated: function (activity, bundle) {
diff --git a/platforms/android/src/main/assets/app/tns_modules/ui/animation/animation.js b/platforms/android/src/main/assets/app/tns_modules/ui/animation/animation.js
index 81e4987..dc71800 100644
--- a/platforms/android/src/main/assets/app/tns_modules/ui/animation/animation.js
+++ b/platforms/android/src/main/assets/app/tns_modules/ui/animation/animation.js
@@ -242,11 +242,11 @@ var Animation = (function (_super) {
return Animation;
}(common.Animation));
exports.Animation = Animation;
-var easeIn = new android.view.animation.AccelerateInterpolator(1);
-var easeOut = new android.view.animation.DecelerateInterpolator(1);
-var easeInOut = new android.view.animation.AccelerateDecelerateInterpolator();
-var linear = new android.view.animation.LinearInterpolator();
-var bounce = new android.view.animation.BounceInterpolator();
+var easeIn; // new android.view.animation.AccelerateInterpolator(1);
+var easeOut; // new android.view.animation.DecelerateInterpolator(1);
+var easeInOut; // new android.view.animation.AccelerateDecelerateInterpolator();
+var linear; // new android.view.animation.LinearInterpolator();
+var bounce; // new android.view.animation.BounceInterpolator();
function _resolveAnimationCurve(curve) {
switch (curve) {
case enums.AnimationCurve.easeIn:
diff --git a/platforms/android/src/main/assets/app/tns_modules/ui/frame/frame.js b/platforms/android/src/main/assets/app/tns_modules/ui/frame/frame.js
index 6769bd3..4d8a33c 100644
--- a/platforms/android/src/main/assets/app/tns_modules/ui/frame/frame.js
+++ b/platforms/android/src/main/assets/app/tns_modules/ui/frame/frame.js
@@ -485,203 +485,208 @@ function ensureAnimationFixed() {
animationFixed = android.os.Build.VERSION.SDK_INT >= 19 ? 1 : -1;
}
}
-var FragmentClass = (function (_super) {
- __extends(FragmentClass, _super);
- function FragmentClass() {
- _super.call(this);
- return global.__native(this);
- }
- FragmentClass.prototype.onHiddenChanged = function (hidden) {
- trace.write(this.getTag() + ".onHiddenChanged(" + hidden + ")", trace.categories.NativeLifecycle);
- _super.prototype.onHiddenChanged.call(this, hidden);
- if (hidden) {
- onFragmentHidden(this);
- }
- else {
- onFragmentShown(this);
- }
- };
- FragmentClass.prototype.onCreateAnimator = function (transit, enter, nextAnim) {
- var animator = transitionModule._onFragmentCreateAnimator(this, nextAnim);
- if (!animator) {
- animator = _super.prototype.onCreateAnimator.call(this, transit, enter, nextAnim);
- }
- trace.write(this.getTag() + ".onCreateAnimator(" + transit + ", " + enter + ", " + nextAnim + "): " + animator, trace.categories.NativeLifecycle);
- return animator;
- };
- FragmentClass.prototype.onCreate = function (savedInstanceState) {
- trace.write(this.getTag() + ".onCreate(" + savedInstanceState + ")", trace.categories.NativeLifecycle);
- _super.prototype.onCreate.call(this, savedInstanceState);
- _super.prototype.setHasOptionsMenu.call(this, true);
- if (!this.entry) {
- var frameId = this.getArguments().getInt(FRAMEID);
- var frame = getFrameById(frameId);
- if (frame) {
- this.frame = frame;
+
+var FragmentClass;
+var NativeScriptActivity;
+exports.evalLazy = function() {
+ FragmentClass = (function (_super) {
+ __extends(FragmentClass, _super);
+ function FragmentClass() {
+ _super.call(this);
+ return global.__native(this);
+ }
+ FragmentClass.prototype.onHiddenChanged = function (hidden) {
+ trace.write(this.getTag() + ".onHiddenChanged(" + hidden + ")", trace.categories.NativeLifecycle);
+ _super.prototype.onHiddenChanged.call(this, hidden);
+ if (hidden) {
+ onFragmentHidden(this);
}
else {
- throw new Error("Cannot find Frame for " + this);
+ onFragmentShown(this);
}
- findPageForFragment(this, this.frame);
- }
- };
- FragmentClass.prototype.onCreateView = function (inflater, container, savedInstanceState) {
- trace.write(this.getTag() + ".onCreateView(inflater, container, " + savedInstanceState + ")", trace.categories.NativeLifecycle);
- var entry = this.entry;
- var page = entry.resolvedPage;
- if (savedInstanceState && savedInstanceState.getBoolean(HIDDEN, false)) {
- this.getFragmentManager().beginTransaction().hide(this).commit();
- page._onAttached(this.getActivity());
- }
- else {
- onFragmentShown(this);
- }
- return page._nativeView;
- };
- FragmentClass.prototype.onSaveInstanceState = function (outState) {
- trace.write(this.getTag() + ".onSaveInstanceState(" + outState + ")", trace.categories.NativeLifecycle);
- _super.prototype.onSaveInstanceState.call(this, outState);
- if (this.isHidden()) {
- outState.putBoolean(HIDDEN, true);
- }
- };
- FragmentClass.prototype.onDestroyView = function () {
- trace.write(this.getTag() + ".onDestroyView()", trace.categories.NativeLifecycle);
- _super.prototype.onDestroyView.call(this);
- onFragmentHidden(this);
- var entry = this.entry;
- var page = entry.resolvedPage;
- if (page._context) {
- page._onDetached(true);
- }
- };
- FragmentClass.prototype.onDestroy = function () {
- trace.write(this.getTag() + ".onDestroy()", trace.categories.NativeLifecycle);
- _super.prototype.onDestroy.call(this);
- utils.GC();
- };
- FragmentClass = __decorate([
- JavaProxy("com.tns.FragmentClass")
- ], FragmentClass);
- return FragmentClass;
-}(android.app.Fragment));
-var NativeScriptActivity = (function (_super) {
- __extends(NativeScriptActivity, _super);
- function NativeScriptActivity() {
- _super.call(this);
- return global.__native(this);
- }
- NativeScriptActivity.prototype.onCreate = function (savedInstanceState) {
- trace.write("NativeScriptActivity.onCreate(" + savedInstanceState + ")", trace.categories.NativeLifecycle);
- var app = application.android;
- var intent = this.getIntent();
- if (application.onLaunch) {
- application.onLaunch(intent);
- }
- var args = { eventName: application.launchEvent, object: app, android: intent };
- application.notify(args);
- var frameId = -1;
- var rootView = args.root;
- var extras = intent.getExtras();
- if (extras) {
- frameId = extras.getInt(INTENT_EXTRA, -1);
- }
- else if (savedInstanceState) {
- frameId = savedInstanceState.getInt(INTENT_EXTRA, -1);
- }
- var frame;
- var navParam;
- if (frameId >= 0) {
- rootView = getFrameById(frameId);
- }
- if (!rootView) {
- navParam = application.mainEntry;
- if (!navParam) {
- navParam = application.mainModule;
+ };
+ FragmentClass.prototype.onCreateAnimator = function (transit, enter, nextAnim) {
+ var animator = transitionModule._onFragmentCreateAnimator(this, nextAnim);
+ if (!animator) {
+ animator = _super.prototype.onCreateAnimator.call(this, transit, enter, nextAnim);
}
- if (navParam) {
- frame = new Frame();
+ trace.write(this.getTag() + ".onCreateAnimator(" + transit + ", " + enter + ", " + nextAnim + "): " + animator, trace.categories.NativeLifecycle);
+ return animator;
+ };
+ FragmentClass.prototype.onCreate = function (savedInstanceState) {
+ trace.write(this.getTag() + ".onCreate(" + savedInstanceState + ")", trace.categories.NativeLifecycle);
+ _super.prototype.onCreate.call(this, savedInstanceState);
+ _super.prototype.setHasOptionsMenu.call(this, true);
+ if (!this.entry) {
+ var frameId = this.getArguments().getInt(FRAMEID);
+ var frame = getFrameById(frameId);
+ if (frame) {
+ this.frame = frame;
+ }
+ else {
+ throw new Error("Cannot find Frame for " + this);
+ }
+ findPageForFragment(this, this.frame);
+ }
+ };
+ FragmentClass.prototype.onCreateView = function (inflater, container, savedInstanceState) {
+ trace.write(this.getTag() + ".onCreateView(inflater, container, " + savedInstanceState + ")", trace.categories.NativeLifecycle);
+ var entry = this.entry;
+ var page = entry.resolvedPage;
+ if (savedInstanceState && savedInstanceState.getBoolean(HIDDEN, false)) {
+ this.getFragmentManager().beginTransaction().hide(this).commit();
+ page._onAttached(this.getActivity());
}
else {
- throw new Error("A Frame must be used to navigate to a Page.");
+ onFragmentShown(this);
}
- rootView = frame;
- }
- var isRestart = !!savedInstanceState && activityInitialized;
- _super.prototype.onCreate.call(this, isRestart ? savedInstanceState : null);
- this.rootView = rootView;
- rootView._onAttached(this);
- this.setContentView(rootView._nativeView, new org.nativescript.widgets.CommonLayoutParams());
- if (frame) {
- frame.navigate(navParam);
- }
- activityInitialized = true;
- };
- NativeScriptActivity.prototype.onSaveInstanceState = function (outState) {
- _super.prototype.onSaveInstanceState.call(this, outState);
- var view = this.rootView;
- if (view instanceof Frame) {
- outState.putInt(INTENT_EXTRA, view.android.frameId);
- }
- };
- NativeScriptActivity.prototype.onStart = function () {
- _super.prototype.onStart.call(this);
- trace.write("NativeScriptActivity.onStart();", trace.categories.NativeLifecycle);
- var rootView = this.rootView;
- if (rootView && !rootView.isLoaded) {
- rootView.onLoaded();
- }
- };
- NativeScriptActivity.prototype.onStop = function () {
- _super.prototype.onStop.call(this);
- trace.write("NativeScriptActivity.onStop();", trace.categories.NativeLifecycle);
- var rootView = this.rootView;
- if (rootView && rootView.isLoaded) {
- rootView.onUnloaded();
- }
- };
- NativeScriptActivity.prototype.onDestroy = function () {
- var rootView = this.rootView;
- if (rootView && rootView._context) {
- rootView._onDetached(true);
- }
- _super.prototype.onDestroy.call(this);
- trace.write("NativeScriptActivity.onDestroy();", trace.categories.NativeLifecycle);
- };
- NativeScriptActivity.prototype.onBackPressed = function () {
- trace.write("NativeScriptActivity.onBackPressed;", trace.categories.NativeLifecycle);
- var args = {
- eventName: "activityBackPressed",
- object: application.android,
- activity: this,
- cancel: false,
+ return page._nativeView;
};
- application.android.notify(args);
- if (args.cancel) {
- return;
- }
- if (!frameCommon.goBack()) {
- _super.prototype.onBackPressed.call(this);
- }
- };
- NativeScriptActivity.prototype.onActivityResult = function (requestCode, resultCode, data) {
- _super.prototype.onActivityResult.call(this, requestCode, resultCode, data);
- trace.write("NativeScriptActivity.onActivityResult(" + requestCode + ", " + resultCode + ", " + data + ")", trace.categories.NativeLifecycle);
- var result = application.android.onActivityResult;
- if (result) {
- result(requestCode, resultCode, data);
- }
- application.android.notify({
- eventName: "activityResult",
- object: application.android,
- activity: this,
- requestCode: requestCode,
- resultCode: resultCode,
- intent: data
- });
- };
- NativeScriptActivity = __decorate([
- JavaProxy("com.tns.NativeScriptActivity")
- ], NativeScriptActivity);
- return NativeScriptActivity;
-}(android.app.Activity));
+ FragmentClass.prototype.onSaveInstanceState = function (outState) {
+ trace.write(this.getTag() + ".onSaveInstanceState(" + outState + ")", trace.categories.NativeLifecycle);
+ _super.prototype.onSaveInstanceState.call(this, outState);
+ if (this.isHidden()) {
+ outState.putBoolean(HIDDEN, true);
+ }
+ };
+ FragmentClass.prototype.onDestroyView = function () {
+ trace.write(this.getTag() + ".onDestroyView()", trace.categories.NativeLifecycle);
+ _super.prototype.onDestroyView.call(this);
+ onFragmentHidden(this);
+ var entry = this.entry;
+ var page = entry.resolvedPage;
+ if (page._context) {
+ page._onDetached(true);
+ }
+ };
+ FragmentClass.prototype.onDestroy = function () {
+ trace.write(this.getTag() + ".onDestroy()", trace.categories.NativeLifecycle);
+ _super.prototype.onDestroy.call(this);
+ utils.GC();
+ };
+ FragmentClass = __decorate([
+ JavaProxy("com.tns.FragmentClass")
+ ], FragmentClass);
+ return FragmentClass;
+ }(android.app.Fragment));
+ var NativeScriptActivity = (function (_super) {
+ __extends(NativeScriptActivity, _super);
+ function NativeScriptActivity() {
+ _super.call(this);
+ return global.__native(this);
+ }
+ NativeScriptActivity.prototype.onCreate = function (savedInstanceState) {
+ trace.write("NativeScriptActivity.onCreate(" + savedInstanceState + ")", trace.categories.NativeLifecycle);
+ var app = application.android;
+ var intent = this.getIntent();
+ if (application.onLaunch) {
+ application.onLaunch(intent);
+ }
+ var args = { eventName: application.launchEvent, object: app, android: intent };
+ application.notify(args);
+ var frameId = -1;
+ var rootView = args.root;
+ var extras = intent.getExtras();
+ if (extras) {
+ frameId = extras.getInt(INTENT_EXTRA, -1);
+ }
+ else if (savedInstanceState) {
+ frameId = savedInstanceState.getInt(INTENT_EXTRA, -1);
+ }
+ var frame;
+ var navParam;
+ if (frameId >= 0) {
+ rootView = getFrameById(frameId);
+ }
+ if (!rootView) {
+ navParam = application.mainEntry;
+ if (!navParam) {
+ navParam = application.mainModule;
+ }
+ if (navParam) {
+ frame = new Frame();
+ }
+ else {
+ throw new Error("A Frame must be used to navigate to a Page.");
+ }
+ rootView = frame;
+ }
+ var isRestart = !!savedInstanceState && activityInitialized;
+ _super.prototype.onCreate.call(this, isRestart ? savedInstanceState : null);
+ this.rootView = rootView;
+ rootView._onAttached(this);
+ this.setContentView(rootView._nativeView, new org.nativescript.widgets.CommonLayoutParams());
+ if (frame) {
+ frame.navigate(navParam);
+ }
+ activityInitialized = true;
+ };
+ NativeScriptActivity.prototype.onSaveInstanceState = function (outState) {
+ _super.prototype.onSaveInstanceState.call(this, outState);
+ var view = this.rootView;
+ if (view instanceof Frame) {
+ outState.putInt(INTENT_EXTRA, view.android.frameId);
+ }
+ };
+ NativeScriptActivity.prototype.onStart = function () {
+ _super.prototype.onStart.call(this);
+ trace.write("NativeScriptActivity.onStart();", trace.categories.NativeLifecycle);
+ var rootView = this.rootView;
+ if (rootView && !rootView.isLoaded) {
+ rootView.onLoaded();
+ }
+ };
+ NativeScriptActivity.prototype.onStop = function () {
+ _super.prototype.onStop.call(this);
+ trace.write("NativeScriptActivity.onStop();", trace.categories.NativeLifecycle);
+ var rootView = this.rootView;
+ if (rootView && rootView.isLoaded) {
+ rootView.onUnloaded();
+ }
+ };
+ NativeScriptActivity.prototype.onDestroy = function () {
+ var rootView = this.rootView;
+ if (rootView && rootView._context) {
+ rootView._onDetached(true);
+ }
+ _super.prototype.onDestroy.call(this);
+ trace.write("NativeScriptActivity.onDestroy();", trace.categories.NativeLifecycle);
+ };
+ NativeScriptActivity.prototype.onBackPressed = function () {
+ trace.write("NativeScriptActivity.onBackPressed;", trace.categories.NativeLifecycle);
+ var args = {
+ eventName: "activityBackPressed",
+ object: application.android,
+ activity: this,
+ cancel: false,
+ };
+ application.android.notify(args);
+ if (args.cancel) {
+ return;
+ }
+ if (!frameCommon.goBack()) {
+ _super.prototype.onBackPressed.call(this);
+ }
+ };
+ NativeScriptActivity.prototype.onActivityResult = function (requestCode, resultCode, data) {
+ _super.prototype.onActivityResult.call(this, requestCode, resultCode, data);
+ trace.write("NativeScriptActivity.onActivityResult(" + requestCode + ", " + resultCode + ", " + data + ")", trace.categories.NativeLifecycle);
+ var result = application.android.onActivityResult;
+ if (result) {
+ result(requestCode, resultCode, data);
+ }
+ application.android.notify({
+ eventName: "activityResult",
+ object: application.android,
+ activity: this,
+ requestCode: requestCode,
+ resultCode: resultCode,
+ intent: data
+ });
+ };
+ NativeScriptActivity = __decorate([
+ JavaProxy("com.tns.NativeScriptActivity")
+ ], NativeScriptActivity);
+ return NativeScriptActivity;
+ }(android.app.Activity));
+}
\ No newline at end of file
diff --git a/platforms/android/src/main/assets/app/tns_modules/ui/transition/slide-transition.js b/platforms/android/src/main/assets/app/tns_modules/ui/transition/slide-transition.js
index 5bb3ea7..927ea9d 100644
--- a/platforms/android/src/main/assets/app/tns_modules/ui/transition/slide-transition.js
+++ b/platforms/android/src/main/assets/app/tns_modules/ui/transition/slide-transition.js
@@ -1,7 +1,7 @@
var transition = require("ui/transition");
var platform = require("platform");
-var screenWidth = platform.screen.mainScreen.widthPixels;
-var screenHeight = platform.screen.mainScreen.heightPixels;
+var screenWidth; // platform.screen.mainScreen.widthPixels;
+var screenHeight; // platform.screen.mainScreen.heightPixels;
var SlideTransition = (function (_super) {
__extends(SlideTransition, _super);
function SlideTransition(direction, duration, curve) {
diff --git a/platforms/android/src/main/assets/app/tns_modules/ui/transition/transition.js b/platforms/android/src/main/assets/app/tns_modules/ui/transition/transition.js
index 15aac4e..a0b19dd 100644
--- a/platforms/android/src/main/assets/app/tns_modules/ui/transition/transition.js
+++ b/platforms/android/src/main/assets/app/tns_modules/ui/transition/transition.js
@@ -1,8 +1,8 @@
var platform = require("platform");
var types = require("utils/types");
var trace = require("trace");
-var _sdkVersion = parseInt(platform.device.sdkVersion);
-var _defaultInterpolator = new android.view.animation.AccelerateDecelerateInterpolator();
+var _sdkVersion; // = parseInt(platform.device.sdkVersion);
+var _defaultInterpolator; // = new android.view.animation.AccelerateDecelerateInterpolator();
var ENTER_POPEXIT_TRANSITION = "ENTER_POPEXIT_TRANSITION";
var EXIT_POPENTER_TRANSITION = "EXIT_POPENTER_TRANSITION";
var COMPLETE_PAGE_ADDITION_WHEN_TRANSITION_ENDS = "COMPLETE_PAGE_ADDITION_WHEN_TRANSITION_ENDS";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment