From 0a495b55a29f7f6b96a2cf2b4bc709535064d17a Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Tue, 22 Oct 2019 22:09:17 +0300 Subject: [PATCH] refactor: android.R to const for performance reasons (#8003) --- nativescript-core/ui/core/view/view.android.ts | 3 ++- nativescript-core/ui/frame/fragment.transitions.android.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/nativescript-core/ui/core/view/view.android.ts b/nativescript-core/ui/core/view/view.android.ts index 7d6d6e20a..5b42e0047 100644 --- a/nativescript-core/ui/core/view/view.android.ts +++ b/nativescript-core/ui/core/view/view.android.ts @@ -33,6 +33,7 @@ const androidBackPressedEvent = "androidBackPressed"; const shortAnimTime = 17694720; // android.R.integer.config_shortAnimTime const statePressed = 16842919; // android.R.attr.state_pressed const stateEnabled = 16842910; // android.R.attr.state_enabled +const styleAnimationDialog = 16973826; // android.R.style.Animation_Dialog const sdkVersion = lazy(() => parseInt(device.sdkVersion)); @@ -187,7 +188,7 @@ function initializeDialogFragment() { dialog .getWindow() .setWindowAnimations( - android.R.style.Animation_Dialog + styleAnimationDialog ); } diff --git a/nativescript-core/ui/frame/fragment.transitions.android.ts b/nativescript-core/ui/frame/fragment.transitions.android.ts index 266dea6a7..6b024cd47 100644 --- a/nativescript-core/ui/frame/fragment.transitions.android.ts +++ b/nativescript-core/ui/frame/fragment.transitions.android.ts @@ -17,6 +17,9 @@ interface TransitionListener { const defaultInterpolator = lazy(() => new android.view.animation.AccelerateDecelerateInterpolator()); +const animFadeIn = 17432576; // android.R.anim.fade_in +const animFadeOut = 17432577; // android.R.anim.fade_out + export const waitingQueue = new Map>(); export const completedEntries = new Map(); @@ -105,7 +108,7 @@ export function _setAndroidFragmentTransitions( // Also setup empty/immediate transition to be executed when navigating back to this page. // TODO: Consider removing empty/immediate animator when migrating to official androidx.fragment.app.Fragment:1.2. if (isNestedDefaultTransition) { - fragmentTransaction.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out); + fragmentTransaction.setCustomAnimations(animFadeIn, animFadeOut); setupAllAnimation(newEntry, noTransition); setupNewFragmentCustomTransition({ duration: 0, curve: null }, newEntry, noTransition); } else {