| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5db3e67 commit cf034dd
21 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,8 +5,9 @@ export class CustomTransition extends transition.Transition { | |||
| 5 | 5 | super(duration, curve); | |
| 6 | 6 | } | |
| 7 | 7 | ||
| 8 | - public createAndroidAnimator(transitionType: string): android.animation.Animator { | ||
| 9 | - var scaleValues = Array.create("float", 2); | ||
| 8 | + public createAndroidAnimation(transitionType: string): android.view.animation.Animation { | ||
| 9 | + const scaleValues = []; | ||
| 10 | + | ||
| 10 | 11 | switch (transitionType) { | |
| 11 | 12 | case transition.AndroidTransitionType.enter: | |
| 12 | 13 | case transition.AndroidTransitionType.popEnter: | |
@@ -19,18 +20,22 @@ export class CustomTransition extends transition.Transition { | |||
| 19 | 20 | scaleValues[1] = 0; | |
| 20 | 21 | break; | |
| 21 | 22 | } | |
| 22 | - var objectAnimators = Array.create(android.animation.Animator, 2); | ||
| 23 | - objectAnimators[0] = android.animation.ObjectAnimator.ofFloat(null, "scaleX", scaleValues); | ||
| 24 | - objectAnimators[1] = android.animation.ObjectAnimator.ofFloat(null, "scaleY", scaleValues); | ||
| 25 | - var animatorSet = new android.animation.AnimatorSet(); | ||
| 26 | - animatorSet.playTogether(objectAnimators); | ||
| 27 | - | ||
| 28 | - var duration = this.getDuration(); | ||
| 23 | + | ||
| 24 | + const animationSet = new android.view.animation.AnimationSet(false); | ||
| 25 | + const duration = this.getDuration(); | ||
| 29 | 26 | if (duration !== undefined) { | |
| 30 | - animatorSet.setDuration(duration); | ||
| 27 | + animationSet.setDuration(duration); | ||
| 31 | 28 | } | |
| 32 | - animatorSet.setInterpolator(this.getCurve()); | ||
| 33 | 29 | ||
| 34 | - return animatorSet; | ||
| 30 | + animationSet.setInterpolator(this.getCurve()); | ||
| 31 | + animationSet.addAnimation( | ||
| 32 | + new android.view.animation.ScaleAnimation( | ||
| 33 | + scaleValues[0], | ||
| 34 | + scaleValues[1], | ||
| 35 | + scaleValues[0], | ||
| 36 | + scaleValues[1] | ||
| 37 | + )); | ||
| 38 | + | ||
| 39 | + return animationSet; | ||
| 35 | 40 | } | |
| 36 | 41 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,8 +42,8 @@ export class AndroidApplication extends Observable implements AndroidApplication | |||
| 42 | 42 | public paused: boolean; | |
| 43 | 43 | public nativeApp: android.app.Application; | |
| 44 | 44 | public context: android.content.Context; | |
| 45 | - public foregroundActivity: android.app.Activity; | ||
| 46 | - public startActivity: android.app.Activity; | ||
| 45 | + public foregroundActivity: android.support.v7.app.AppCompatActivity; | ||
| 46 | + public startActivity: android.support.v7.app.AppCompatActivity; | ||
| 47 | 47 | public packageName: string; | |
| 48 | 48 | // we are using these property to store the callbacks to avoid early GC collection which would trigger MarkReachableObjects | |
| 49 | 49 | private callbacks: any = {}; | |
@@ -221,7 +221,7 @@ global.__onLiveSync = function () { | |||
| 221 | 221 | }; | |
| 222 | 222 | ||
| 223 | 223 | function initLifecycleCallbacks() { | |
| 224 | - const setThemeOnLaunch = profile("setThemeOnLaunch", (activity: android.app.Activity) => { | ||
| 224 | + const setThemeOnLaunch = profile("setThemeOnLaunch", (activity: android.support.v7.app.AppCompatActivity) => { | ||
| 225 | 225 | // Set app theme after launch screen was used during startup | |
| 226 | 226 | const activityInfo = activity.getPackageManager().getActivityInfo(activity.getComponentName(), android.content.pm.PackageManager.GET_META_DATA); | |
| 227 | 227 | if (activityInfo.metaData) { | |
@@ -232,11 +232,11 @@ function initLifecycleCallbacks() { | |||
| 232 | 232 | } | |
| 233 | 233 | }); | |
| 234 | 234 | ||
| 235 | - const notifyActivityCreated = profile("notifyActivityCreated", function (activity: android.app.Activity, savedInstanceState: android.os.Bundle) { | ||
| 235 | + const notifyActivityCreated = profile("notifyActivityCreated", function (activity: android.support.v7.app.AppCompatActivity, savedInstanceState: android.os.Bundle) { | ||
| 236 | 236 | androidApp.notify(<AndroidActivityBundleEventData>{ eventName: ActivityCreated, object: androidApp, activity, bundle: savedInstanceState }); | |
| 237 | 237 | }); | |
| 238 | 238 | ||
| 239 | - const subscribeForGlobalLayout = profile("subscribeForGlobalLayout", function (activity: android.app.Activity) { | ||
| 239 | + const subscribeForGlobalLayout = profile("subscribeForGlobalLayout", function (activity: android.support.v7.app.AppCompatActivity) { | ||
| 240 | 240 | const rootView = activity.getWindow().getDecorView().getRootView(); | |
| 241 | 241 | // store the listener not to trigger GC collection before collecting the method | |
| 242 | 242 | this.onGlobalLayoutListener = new android.view.ViewTreeObserver.OnGlobalLayoutListener({ | |
@@ -250,7 +250,7 @@ function initLifecycleCallbacks() { | |||
| 250 | 250 | }); | |
| 251 | 251 | ||
| 252 | 252 | const lifecycleCallbacks = new android.app.Application.ActivityLifecycleCallbacks({ | |
| 253 | - onActivityCreated: profile("onActivityCreated", function (activity: android.app.Activity, savedInstanceState: android.os.Bundle) { | ||
| 253 | + onActivityCreated: profile("onActivityCreated", function (activity: android.support.v7.app.AppCompatActivity, savedInstanceState: android.os.Bundle) { | ||
| 254 | 254 | setThemeOnLaunch(activity); | |
| 255 | 255 | ||
| 256 | 256 | if (!androidApp.startActivity) { | |
@@ -264,7 +264,7 @@ function initLifecycleCallbacks() { | |||
| 264 | 264 | } | |
| 265 | 265 | }), | |
| 266 | 266 | ||
| 267 | - onActivityDestroyed: profile("onActivityDestroyed", function (activity: android.app.Activity) { | ||
| 267 | + onActivityDestroyed: profile("onActivityDestroyed", function (activity: android.support.v7.app.AppCompatActivity) { | ||
| 268 | 268 | if (activity === androidApp.foregroundActivity) { | |
| 269 | 269 | androidApp.foregroundActivity = undefined; | |
| 270 | 270 | } | |
@@ -278,7 +278,7 @@ function initLifecycleCallbacks() { | |||
| 278 | 278 | gc(); | |
| 279 | 279 | }), | |
| 280 | 280 | ||
| 281 | - onActivityPaused: profile("onActivityPaused", function (activity: android.app.Activity) { | ||
| 281 | + onActivityPaused: profile("onActivityPaused", function (activity: android.support.v7.app.AppCompatActivity) { | ||
| 282 | 282 | if ((<any>activity).isNativeScriptActivity) { | |
| 283 | 283 | androidApp.paused = true; | |
| 284 | 284 | notify(<ApplicationEventData>{ eventName: suspendEvent, object: androidApp, android: activity }); | |
@@ -287,7 +287,7 @@ function initLifecycleCallbacks() { | |||
| 287 | 287 | androidApp.notify(<AndroidActivityEventData>{ eventName: ActivityPaused, object: androidApp, activity: activity }); | |
| 288 | 288 | }), | |
| 289 | 289 | ||
| 290 | - onActivityResumed: profile("onActivityResumed", function (activity: android.app.Activity) { | ||
| 290 | + onActivityResumed: profile("onActivityResumed", function (activity: android.support.v7.app.AppCompatActivity) { | ||
| 291 | 291 | androidApp.foregroundActivity = activity; | |
| 292 | 292 | ||
| 293 | 293 | if ((<any>activity).isNativeScriptActivity) { | |
@@ -298,15 +298,15 @@ function initLifecycleCallbacks() { | |||
| 298 | 298 | androidApp.notify(<AndroidActivityEventData>{ eventName: ActivityResumed, object: androidApp, activity: activity }); | |
| 299 | 299 | }), | |
| 300 | 300 | ||
| 301 | - onActivitySaveInstanceState: profile("onActivityResumed", function (activity: android.app.Activity, outState: android.os.Bundle) { | ||
| 301 | + onActivitySaveInstanceState: profile("onActivityResumed", function (activity: android.support.v7.app.AppCompatActivity, outState: android.os.Bundle) { | ||
| 302 | 302 | androidApp.notify(<AndroidActivityBundleEventData>{ eventName: SaveActivityState, object: androidApp, activity: activity, bundle: outState }); | |
| 303 | 303 | }), | |
| 304 | 304 | ||
| 305 | - onActivityStarted: profile("onActivityStarted", function (activity: android.app.Activity) { | ||
| 305 | + onActivityStarted: profile("onActivityStarted", function (activity: android.support.v7.app.AppCompatActivity) { | ||
| 306 | 306 | androidApp.notify(<AndroidActivityEventData>{ eventName: ActivityStarted, object: androidApp, activity: activity }); | |
| 307 | 307 | }), | |
| 308 | 308 | ||
| 309 | - onActivityStopped: profile("onActivityStopped", function (activity: android.app.Activity) { | ||
| 309 | + onActivityStopped: profile("onActivityStopped", function (activity: android.support.v7.app.AppCompatActivity) { | ||
| 310 | 310 | androidApp.notify(<AndroidActivityEventData>{ eventName: ActivityStopped, object: androidApp, activity: activity }); | |
| 311 | 311 | }) | |
| 312 | 312 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -288,7 +288,7 @@ export interface AndroidActivityEventData { | |||
| 288 | 288 | /** | |
| 289 | 289 | * The activity. | |
| 290 | 290 | */ | |
| 291 | - activity: any /* android.app.Activity */; | ||
| 291 | + activity: any /* android.support.v7.app.AppCompatActivity */; | ||
| 292 | 292 | ||
| 293 | 293 | /** | |
| 294 | 294 | * The name of the event. | |
@@ -378,7 +378,7 @@ export class AndroidApplication extends Observable { | |||
| 378 | 378 | /** | |
| 379 | 379 | * The currently active (loaded) [android Activity](http://developer.android.com/reference/android/app/Activity.html). This property is automatically updated upon Activity events. | |
| 380 | 380 | */ | |
| 381 | - foregroundActivity: any /* android.app.Activity */; | ||
| 381 | + foregroundActivity: any /* android.support.v7.app.AppCompatActivity */; | ||
| 382 | 382 | ||
| 383 | 383 | /** | |
| 384 | 384 | * Deprecated. Please use startActivity, foregroundActivity or context property. | |
@@ -388,7 +388,7 @@ export class AndroidApplication extends Observable { | |||
| 388 | 388 | /** | |
| 389 | 389 | * The main (start) Activity for the application. | |
| 390 | 390 | */ | |
| 391 | - startActivity: any /* android.app.Activity */; | ||
| 391 | + startActivity: any /* android.support.v7.app.AppCompatActivity */; | ||
| 392 | 392 | ||
| 393 | 393 | /** | |
| 394 | 394 | * The name of the application package. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,7 +47,7 @@ interface TouchListener { | |||
| 47 | 47 | } | |
| 48 | 48 | ||
| 49 | 49 | interface DialogFragment { | |
| 50 | - new(): android.app.DialogFragment; | ||
| 50 | + new(): android.support.v4.app.DialogFragment; | ||
| 51 | 51 | } | |
| 52 | 52 | ||
| 53 | 53 | function initializeDisabledListener(): void { | |
@@ -120,7 +120,7 @@ function initializeDialogFragment() { | |||
| 120 | 120 | } | |
| 121 | 121 | } | |
| 122 | 122 | ||
| 123 | - class DialogFragmentImpl extends android.app.DialogFragment { | ||
| 123 | + class DialogFragmentImpl extends android.support.v4.app.DialogFragment { | ||
| 124 | 124 | public owner: View; | |
| 125 | 125 | private _fullscreen: boolean; | |
| 126 | 126 | private _stretched: boolean; | |
@@ -141,7 +141,7 @@ function initializeDialogFragment() { | |||
| 141 | 141 | this._dismissCallback = options.dismissCallback; | |
| 142 | 142 | this._shownCallback = options.shownCallback; | |
| 143 | 143 | this.owner._dialogFragment = this; | |
| 144 | - this.setStyle(android.app.DialogFragment.STYLE_NO_TITLE, 0); | ||
| 144 | + this.setStyle(android.support.v4.app.DialogFragment.STYLE_NO_TITLE, 0); | ||
| 145 | 145 | ||
| 146 | 146 | const dialog = new DialogImpl(this, this.getActivity(), this.getTheme()); | |
| 147 | 147 | ||
@@ -225,13 +225,13 @@ function getModalOptions(domId: number): DialogOptions { | |||
| 225 | 225 | export class View extends ViewCommon { | |
| 226 | 226 | public static androidBackPressedEvent = androidBackPressedEvent; | |
| 227 | 227 | ||
| 228 | - public _dialogFragment: android.app.DialogFragment; | ||
| 228 | + public _dialogFragment: android.support.v4.app.DialogFragment; | ||
| 229 | 229 | private _isClickable: boolean; | |
| 230 | 230 | private touchListenerIsSet: boolean; | |
| 231 | 231 | private touchListener: android.view.View.OnTouchListener; | |
| 232 | 232 | private layoutChangeListenerIsSet: boolean; | |
| 233 | 233 | private layoutChangeListener: android.view.View.OnLayoutChangeListener; | |
| 234 | - private _manager: android.app.FragmentManager; | ||
| 234 | + private _manager: android.support.v4.app.FragmentManager; | ||
| 235 | 235 | ||
| 236 | 236 | nativeViewProtected: android.view.View; | |
| 237 | 237 | ||
@@ -263,7 +263,7 @@ export class View extends ViewCommon { | |||
| 263 | 263 | } | |
| 264 | 264 | } | |
| 265 | 265 | ||
| 266 | - public _getFragmentManager(): android.app.FragmentManager { | ||
| 266 | + public _getFragmentManager(): android.support.v4.app.FragmentManager { | ||
| 267 | 267 | let manager = this._manager; | |
| 268 | 268 | if (!manager) { | |
| 269 | 269 | let view: View = this; | |
@@ -280,7 +280,7 @@ export class View extends ViewCommon { | |||
| 280 | 280 | } | |
| 281 | 281 | ||
| 282 | 282 | if (!manager && this._context) { | |
| 283 | - manager = (<android.app.Activity>this._context).getFragmentManager(); | ||
| 283 | + manager = (<android.support.v7.app.AppCompatActivity>this._context).getSupportFragmentManager(); | ||
| 284 | 284 | } | |
| 285 | 285 | ||
| 286 | 286 | this._manager = manager; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -659,7 +659,7 @@ export abstract class View extends ViewBase { | |||
| 659 | 659 | /** | |
| 660 | 660 | * @private | |
| 661 | 661 | */ | |
| 662 | - _getFragmentManager(): any; /* android.app.FragmentManager */ | ||
| 662 | + _getFragmentManager(): any; /* android.support.v4.app.FragmentManager */ | ||
| 663 | 663 | ||
| 664 | 664 | /** | |
| 665 | 665 | * Updates styleScope or create new styleScope. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ function dismissSoftInput(owner: EditableTextBase): void { | |||
| 36 | 36 | if (!dismissKeyboardTimeoutId) { | |
| 37 | 37 | dismissKeyboardTimeoutId = setTimeout(() => { | |
| 38 | 38 | const owner = dismissKeyboardOwner && dismissKeyboardOwner.get(); | |
| 39 | - const activity = (owner && owner._context) as android.app.Activity; | ||
| 39 | + const activity = (owner && owner._context) as android.support.v7.app.AppCompatActivity; | ||
| 40 | 40 | const nativeView = owner && owner.nativeViewProtected; | |
| 41 | 41 | dismissKeyboardTimeoutId = null; | |
| 42 | 42 | dismissKeyboardOwner = null; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ if ((<any>global).__snapshot || (<any>global).__snapshotEnabled) { | |||
| 8 | 8 | ||
| 9 | 9 | //@ts-ignore | |
| 10 | 10 | @JavaProxy("com.tns.NativeScriptActivity") | |
| 11 | - class NativeScriptActivity extends android.app.Activity { | ||
| 11 | + class NativeScriptActivity extends android.support.v7.app.AppCompatActivity { | ||
| 12 | 12 | private _callbacks: AndroidActivityCallbacks; | |
| 13 | 13 | public isNativeScriptActivity; | |
| 14 | 14 | constructor() { | |
@@ -54,7 +54,7 @@ class NativeScriptActivity extends android.app.Activity { | |||
| 54 | 54 | this._callbacks.onBackPressed(this, super.onBackPressed); | |
| 55 | 55 | } | |
| 56 | 56 | ||
| 57 | - public onRequestPermissionsResult(requestCode: number, permissions: Array<String>, grantResults: Array<number>): void { | ||
| 57 | + public onRequestPermissionsResult(requestCode: number, permissions: Array<string>, grantResults: Array<number>): void { | ||
| 58 | 58 | this._callbacks.onRequestPermissionsResult(this, requestCode, permissions, grantResults, undefined /*TODO: Enable if needed*/); | |
| 59 | 59 | } | |
| 60 | 60 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | import { AndroidFragmentCallbacks, setFragmentCallbacks, setFragmentClass } from "./frame"; | |
| 2 | 2 | ||
| 3 | 3 | @JavaProxy("com.tns.FragmentClass") | |
| 4 | - class FragmentClass extends android.app.Fragment { | ||
| 4 | + class FragmentClass extends android.support.v4.app.Fragment { | ||
| 5 | 5 | // This field is updated in the frame module upon `new` (although hacky this eases the Fragment->callbacks association a lot) | |
| 6 | 6 | private _callbacks: AndroidFragmentCallbacks; | |
| 7 | 7 | ||
@@ -14,9 +14,8 @@ class FragmentClass extends android.app.Fragment { | |||
| 14 | 14 | this._callbacks.onHiddenChanged(this, hidden, super.onHiddenChanged); | |
| 15 | 15 | } | |
| 16 | 16 | ||
| 17 | - public onCreateAnimator(transit: number, enter: boolean, nextAnim: number): android.animation.Animator { | ||
| 18 | - let result = this._callbacks.onCreateAnimator(this, transit, enter, nextAnim, super.onCreateAnimator); | ||
| 19 | - return result; | ||
| 17 | + public onCreateAnimation(transit: number, enter: boolean, nextAnim: number): android.view.animation.Animation { | ||
| 18 | + return this._callbacks.onCreateAnimation(this, transit, enter, nextAnim, super.onCreateAnimation); | ||
| 20 | 19 | } | |
| 21 | 20 | ||
| 22 | 21 | public onStop(): void { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments