feat(android): androidX support (#7039)

* feat: migrate support library namespaces to androidX

* feat(tns-platform-declarations): update to androidX typings

* chore(tests): migrate test apps to AndroidX

* chore(tns-platform-declarations): update tsconfig to include androidx dts files

* update package.json to androidx

* chore(androidx): migrate forgotten support library namspaces

* feat(tns-core-modules-widgets): migrate to AndroidX namespaces

* chore(utils): update androidx namspace for getPaletteColor method

* chore(apps): update tns-platform-declarations package

* Update package.json
This commit is contained in:
Alexander Djenkov
2019-06-10 09:21:41 +03:00
committed by GitHub
parent 0a4b813430
commit c5db112b8d
60 changed files with 142022 additions and 126742 deletions

View File

@ -29,7 +29,7 @@
<meta-data android:name="debugLayouts" android:value="true" />
<provider
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="org.nativescript.apps.provider"
android:exported="false"
android:grantUriPermissions="true">

View File

@ -14,3 +14,4 @@ android {
additionalParameters "--no-version-vectors"
}
}
project.ext.useAndroidX=true

View File

@ -29,8 +29,8 @@ export function navigatingTo(args) {
application.android.on(application.AndroidApplication.activityRequestPermissionsEvent, handler);
if ((<any>android.support.v4.content.ContextCompat).checkSelfPermission(application.android.currentContext, (<any>android).Manifest.permission.WRITE_EXTERNAL_STORAGE) !== android.content.pm.PackageManager.PERMISSION_GRANTED) {
(<any>android.support.v4.app.ActivityCompat).requestPermissions(application.android.currentContext, [(<any>android).Manifest.permission.WRITE_EXTERNAL_STORAGE], 1234);
if ((<any>androidx.core.content.ContextCompat).checkSelfPermission(application.android.currentContext, (<any>android).Manifest.permission.WRITE_EXTERNAL_STORAGE) !== android.content.pm.PackageManager.PERMISSION_GRANTED) {
(<any>androidx.core.app.ActivityCompat).requestPermissions(application.android.currentContext, [(<any>android).Manifest.permission.WRITE_EXTERNAL_STORAGE], 1234);
}
} else {
console.log("Permission for write to external storage GRANTED!")

View File

@ -21,7 +21,7 @@
"babylon": "6.8.3",
"lazy": "1.0.11",
"nativescript-dev-typescript": "next",
"tns-platform-declarations": "*",
"tns-platform-declarations": "androidx",
"typescript": "^3.1.6"
}
}

View File

@ -13,3 +13,4 @@ android {
additionalParameters "--no-version-vectors"
}
}
project.ext.useAndroidX=true

View File

@ -11,7 +11,7 @@ export function test_actionItem_visibility() {
actionItem.text = "Test";
const page = actionTestsCommon.createPageAndNavigate();
page.actionBar.actionItems.addItem(actionItem);
const toolbar = <android.support.v7.widget.Toolbar>page.actionBar.nativeViewProtected;
const toolbar = <androidx.appcompat.widget.Toolbar>page.actionBar.nativeViewProtected;
const menu = toolbar.getMenu();
TKUnit.assertTrue(menu.hasVisibleItems(), "Visibility does not work");
@ -25,7 +25,7 @@ export function test_navigationButton_visibility() {
const page = actionTestsCommon.createPageAndNavigate();
page.actionBar.navigationButton = actionItem;
const toolbar = <android.support.v7.widget.Toolbar>page.actionBar.nativeViewProtected;
const toolbar = <androidx.appcompat.widget.Toolbar>page.actionBar.nativeViewProtected;
TKUnit.assertNotNull(toolbar.getNavigationIcon(), "Visibility does not work");
actionItem.visibility = Visibility.collapse;
@ -40,7 +40,7 @@ export function test_navigationButton_contentDecription() {
const page = actionTestsCommon.createPageAndNavigate();
page.actionBar.navigationButton = actionItem;
const toolbar = <android.support.v7.widget.Toolbar>page.actionBar.nativeViewProtected;
const toolbar = <androidx.appcompat.widget.Toolbar>page.actionBar.nativeViewProtected;
TKUnit.assertEqual(toolbar.getNavigationContentDescription(), actionItemText, "Navigation Button should have an content decription");
}

View File

@ -191,7 +191,7 @@ function tabViewIsFullyLoaded(tabView: TabView): boolean {
}
if (tabView.android) {
var viewPager: android.support.v4.view.ViewPager = (<any>tabView)._viewPager;
var viewPager: androidx.viewpager.widget.ViewPager = (<any>tabView)._viewPager;
if (viewPager.getChildCount() === 0) {
return false;
}
@ -265,7 +265,7 @@ export function testLoadedAndUnloadedAreFired_WhenNavigatingAwayAndBack() {
function _clickTheFirstButtonInTheListViewNatively(tabView: TabView) {
if (tabView.android) {
var viewPager: android.support.v4.view.ViewPager = (<any>tabView)._viewPager;
var viewPager: androidx.viewpager.widget.ViewPager = (<any>tabView)._viewPager;
var androidListView = <android.widget.ListView>viewPager.getChildAt(0);
var stackLayout = <org.nativescript.widgets.StackLayout>androidListView.getChildAt(0);
var button = <android.widget.Button>stackLayout.getChildAt(0);

View File

@ -1,19 +1,19 @@
import { TabView } from "tns-core-modules/ui/tab-view";
export function getNativeTabCount(tabView: TabView): number {
const pagerAdapter: android.support.v4.view.PagerAdapter = (<any>tabView)._pagerAdapter;
const pagerAdapter: androidx.viewpager.widget.PagerAdapter = (<any>tabView)._pagerAdapter;
return pagerAdapter ? pagerAdapter.getCount() : 0;
}
export function selectNativeTab(tabView: TabView, index: number): void {
const viewPager: android.support.v4.view.ViewPager = (<any>tabView)._viewPager;
const viewPager: androidx.viewpager.widget.ViewPager = (<any>tabView)._viewPager;
if (viewPager) {
viewPager.setCurrentItem(index);
}
}
export function getNativeSelectedIndex(tabView: TabView): number {
const viewPager: android.support.v4.view.ViewPager = (<any>tabView)._viewPager;
const viewPager: androidx.viewpager.widget.ViewPager = (<any>tabView)._viewPager;
return viewPager ? viewPager.getCurrentItem() : -1;
}

View File

@ -59,7 +59,7 @@ export class TabViewTest extends UITest<tabViewModule.TabView> {
}
if (tabView.android) {
var viewPager: android.support.v4.view.ViewPager = (<any>tabView)._viewPager;
var viewPager: androidx.viewpager.widget.ViewPager = (<any>tabView)._viewPager;
if (viewPager.getChildCount() === 0) {
return false;
}

View File

@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
@ -23,3 +23,5 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}
project.ext.useAndroidX=true

View File

@ -24,6 +24,15 @@ def computeBuildToolsVersion() {
}
}
def computeAndroidXVersion() {
if(project.hasProperty("androidxVersion")) {
return androidxVersion
}
else {
return "1.0.0"
}
}
def computeSupportVersion() {
if(project.hasProperty("supportVersion")) {
return supportVersion
@ -62,8 +71,17 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
if(project.hasProperty("useAndroidX")) {
println 'Using androix'
def androidxVersion = computeAndroidXVersion()
implementation 'androidx.viewpager:viewpager:' + androidxVersion
implementation 'androidx.fragment:fragment:' + androidxVersion
} else {
println 'Using support library'
implementation 'com.android.support:support-v4:' + computeSupportVersion()
}
}
task cleanBuildDir (type: Delete) {
delete "../build/"

View File

@ -17,7 +17,7 @@ import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.Shader;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import org.nativescript.widgets.image.BitmapOwner;
import org.nativescript.widgets.image.Fetcher;

View File

@ -20,9 +20,9 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.v4.view.ViewCompat;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.core.view.ViewCompat;
import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.view.View;

View File

@ -1,7 +1,7 @@
package org.nativescript.widgets;
import android.animation.Animator;
import android.support.v4.app.Fragment;
import androidx.fragment.app.Fragment;
public abstract class FragmentBase extends Fragment {

View File

@ -26,7 +26,7 @@ import android.graphics.BitmapFactory;
import android.os.Build.VERSION_CODES;
import android.os.Environment;
import android.os.StatFs;
import android.support.v4.util.LruCache;
import android.util.LruCache;
import android.util.Log;
import java.io.File;

View File

@ -2,7 +2,7 @@ package org.nativescript.widgets;
import android.graphics.Paint;
import android.graphics.drawable.ColorDrawable;
import android.support.annotation.ColorInt;
import androidx.annotation.ColorInt;
/**
* Created by hhristov on 2/23/17.

View File

@ -18,8 +18,8 @@ package org.nativescript.widgets;
import android.content.Context;
import android.graphics.Typeface;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.SparseArray;

View File

@ -4,7 +4,7 @@
package org.nativescript.widgets;
import android.content.Context;
import android.support.v4.view.ViewPager;
import androidx.viewpager.widget.ViewPager;
import android.util.AttributeSet;
import android.view.View;
import android.view.MotionEvent;

View File

@ -44,8 +44,8 @@ export class AndroidApplication extends Observable implements AndroidApplication
public paused: boolean;
public nativeApp: android.app.Application;
public context: android.content.Context;
public foregroundActivity: android.support.v7.app.AppCompatActivity;
public startActivity: android.support.v7.app.AppCompatActivity;
public foregroundActivity: androidx.appcompat.app.AppCompatActivity;
public startActivity: androidx.appcompat.app.AppCompatActivity;
public packageName: string;
// we are using these property to store the callbacks to avoid early GC collection which would trigger MarkReachableObjects
private callbacks: any = {};
@ -235,7 +235,7 @@ global.__onLiveSync = function __onLiveSync(context?: ModuleContext) {
};
function initLifecycleCallbacks() {
const setThemeOnLaunch = profile("setThemeOnLaunch", (activity: android.support.v7.app.AppCompatActivity) => {
const setThemeOnLaunch = profile("setThemeOnLaunch", (activity: androidx.appcompat.app.AppCompatActivity) => {
// Set app theme after launch screen was used during startup
const activityInfo = activity.getPackageManager().getActivityInfo(activity.getComponentName(), android.content.pm.PackageManager.GET_META_DATA);
if (activityInfo.metaData) {
@ -246,11 +246,11 @@ function initLifecycleCallbacks() {
}
});
const notifyActivityCreated = profile("notifyActivityCreated", function (activity: android.support.v7.app.AppCompatActivity, savedInstanceState: android.os.Bundle) {
const notifyActivityCreated = profile("notifyActivityCreated", function (activity: androidx.appcompat.app.AppCompatActivity, savedInstanceState: android.os.Bundle) {
androidApp.notify(<AndroidActivityBundleEventData>{ eventName: ActivityCreated, object: androidApp, activity, bundle: savedInstanceState });
});
const subscribeForGlobalLayout = profile("subscribeForGlobalLayout", function (activity: android.support.v7.app.AppCompatActivity) {
const subscribeForGlobalLayout = profile("subscribeForGlobalLayout", function (activity: androidx.appcompat.app.AppCompatActivity) {
const rootView = activity.getWindow().getDecorView().getRootView();
// store the listener not to trigger GC collection before collecting the method
this.onGlobalLayoutListener = new android.view.ViewTreeObserver.OnGlobalLayoutListener({
@ -264,7 +264,7 @@ function initLifecycleCallbacks() {
});
const lifecycleCallbacks = new android.app.Application.ActivityLifecycleCallbacks({
onActivityCreated: profile("onActivityCreated", function (activity: android.support.v7.app.AppCompatActivity, savedInstanceState: android.os.Bundle) {
onActivityCreated: profile("onActivityCreated", function (activity: androidx.appcompat.app.AppCompatActivity, savedInstanceState: android.os.Bundle) {
setThemeOnLaunch(activity);
if (!androidApp.startActivity) {
@ -278,7 +278,7 @@ function initLifecycleCallbacks() {
}
}),
onActivityDestroyed: profile("onActivityDestroyed", function (activity: android.support.v7.app.AppCompatActivity) {
onActivityDestroyed: profile("onActivityDestroyed", function (activity: androidx.appcompat.app.AppCompatActivity) {
if (activity === androidApp.foregroundActivity) {
androidApp.foregroundActivity = undefined;
}
@ -292,7 +292,7 @@ function initLifecycleCallbacks() {
gc();
}),
onActivityPaused: profile("onActivityPaused", function (activity: android.support.v7.app.AppCompatActivity) {
onActivityPaused: profile("onActivityPaused", function (activity: androidx.appcompat.app.AppCompatActivity) {
if ((<any>activity).isNativeScriptActivity) {
androidApp.paused = true;
notify(<ApplicationEventData>{ eventName: suspendEvent, object: androidApp, android: activity });
@ -301,21 +301,21 @@ function initLifecycleCallbacks() {
androidApp.notify(<AndroidActivityEventData>{ eventName: ActivityPaused, object: androidApp, activity: activity });
}),
onActivityResumed: profile("onActivityResumed", function (activity: android.support.v7.app.AppCompatActivity) {
onActivityResumed: profile("onActivityResumed", function (activity: androidx.appcompat.app.AppCompatActivity) {
androidApp.foregroundActivity = activity;
androidApp.notify(<AndroidActivityEventData>{ eventName: ActivityResumed, object: androidApp, activity: activity });
}),
onActivitySaveInstanceState: profile("onActivitySaveInstanceState", function (activity: android.support.v7.app.AppCompatActivity, outState: android.os.Bundle) {
onActivitySaveInstanceState: profile("onActivitySaveInstanceState", function (activity: androidx.appcompat.app.AppCompatActivity, outState: android.os.Bundle) {
androidApp.notify(<AndroidActivityBundleEventData>{ eventName: SaveActivityState, object: androidApp, activity: activity, bundle: outState });
}),
onActivityStarted: profile("onActivityStarted", function (activity: android.support.v7.app.AppCompatActivity) {
onActivityStarted: profile("onActivityStarted", function (activity: androidx.appcompat.app.AppCompatActivity) {
androidApp.notify(<AndroidActivityEventData>{ eventName: ActivityStarted, object: androidApp, activity: activity });
}),
onActivityStopped: profile("onActivityStopped", function (activity: android.support.v7.app.AppCompatActivity) {
onActivityStopped: profile("onActivityStopped", function (activity: androidx.appcompat.app.AppCompatActivity) {
androidApp.notify(<AndroidActivityEventData>{ eventName: ActivityStopped, object: androidApp, activity: activity });
})
});

View File

@ -308,7 +308,7 @@ export interface AndroidActivityEventData {
/**
* The activity.
*/
activity: any /* android.support.v7.app.AppCompatActivity */;
activity: any /* androidx.appcompat.app.AppCompatActivity */;
/**
* The name of the event.
@ -408,7 +408,7 @@ export class AndroidApplication extends Observable {
/**
* The currently active (loaded) [android Activity](http://developer.android.com/reference/android/app/Activity.html). This property is automatically updated upon Activity events.
*/
foregroundActivity: any /* android.support.v7.app.AppCompatActivity */;
foregroundActivity: any /* androidx.appcompat.app.AppCompatActivity */;
/**
* @deprecated use startActivity, foregroundActivity or context instead
@ -418,7 +418,7 @@ export class AndroidApplication extends Observable {
/**
* The main (start) Activity for the application.
*/
startActivity: any /* android.support.v7.app.AppCompatActivity */;
startActivity: any /* androidx.appcompat.app.AppCompatActivity */;
/**
* The name of the application package.

View File

@ -26,12 +26,12 @@
"license": "Apache-2.0",
"typings": "tns-core-modules.d.ts",
"dependencies": {
"tns-core-modules-widgets": "next",
"tns-core-modules-widgets": "androidx",
"tslib": "^1.9.3"
},
"devDependencies": {
"@types/node": "~7.0.5",
"tns-platform-declarations": "*"
"tns-platform-declarations": "androidx"
},
"scripts": {
"version": "conventional-changelog -p angular -i ../CHANGELOG.md -s && git add ../CHANGELOG.md"

View File

@ -22,7 +22,7 @@ function generateItemId(): number {
}
interface MenuItemClickListener {
new(owner: ActionBar): android.support.v7.widget.Toolbar.OnMenuItemClickListener;
new(owner: ActionBar): androidx.appcompat.widget.Toolbar.OnMenuItemClickListener;
}
let appResources: android.content.res.Resources;
@ -33,10 +33,10 @@ function initializeMenuItemClickListener(): void {
return;
}
AppCompatTextView = (<any>android).support.v7.widget.AppCompatTextView;
AppCompatTextView = androidx.appcompat.widget.AppCompatTextView;
@Interfaces([android.support.v7.widget.Toolbar.OnMenuItemClickListener])
class MenuItemClickListenerImpl extends java.lang.Object implements android.support.v7.widget.Toolbar.OnMenuItemClickListener {
@Interfaces([androidx.appcompat.widget.Toolbar.OnMenuItemClickListener])
class MenuItemClickListenerImpl extends java.lang.Object implements androidx.appcompat.widget.Toolbar.OnMenuItemClickListener {
constructor(public owner: ActionBar) {
super();
return global.__native(this);
@ -111,7 +111,7 @@ export class NavigationButton extends ActionItem {
export class ActionBar extends ActionBarBase {
private _android: AndroidActionBarSettings;
public nativeViewProtected: android.support.v7.widget.Toolbar;
public nativeViewProtected: androidx.appcompat.widget.Toolbar;
constructor() {
super();
@ -135,7 +135,7 @@ export class ActionBar extends ActionBarBase {
}
public createNativeView() {
return new android.support.v7.widget.Toolbar(this._context);
return new androidx.appcompat.widget.Toolbar(this._context);
}
public initNativeView(): void {
@ -393,7 +393,7 @@ export class ActionBar extends ActionBarBase {
}
[flatProperty.setNative](value: boolean) {
const compat = <any>android.support.v4.view.ViewCompat;
const compat = <any>androidx.core.view.ViewCompat;
if (compat.setElevation) {
if (value) {
compat.setElevation(this.nativeViewProtected, 0);
@ -405,7 +405,7 @@ export class ActionBar extends ActionBarBase {
}
}
function getAppCompatTextView(toolbar: android.support.v7.widget.Toolbar): typeof AppCompatTextView {
function getAppCompatTextView(toolbar: androidx.appcompat.widget.Toolbar): typeof AppCompatTextView {
for (let i = 0, count = toolbar.getChildCount(); i < count; i++) {
const child = toolbar.getChildAt(i);
if (child instanceof AppCompatTextView) {

View File

@ -69,13 +69,13 @@ export function _resolveAnimationCurve(curve: string | CubicBezierAnimationCurve
}
return bounce();
case "ease":
return (<any>android).support.v4.view.animation.PathInterpolatorCompat.create(0.25, 0.1, 0.25, 1.0);
return (<any>androidx).core.view.animation.PathInterpolatorCompat.create(0.25, 0.1, 0.25, 1.0);
default:
if (traceEnabled()) {
traceWrite("Animation curve resolved to original: " + curve, traceCategories.Animation);
}
if (curve instanceof CubicBezierAnimationCurve) {
return (<any>android).support.v4.view.animation.PathInterpolatorCompat.create(curve.x1, curve.y1, curve.x2, curve.y2);
return (<any>androidx).core.view.animation.PathInterpolatorCompat.create(curve.x1, curve.y1, curve.x2, curve.y2);
} else if (curve && (<any>curve).getInterpolation) {
return <android.view.animation.Interpolator>curve;
} else if ((<any>curve) instanceof android.view.animation.LinearInterpolator) {

View File

@ -55,7 +55,7 @@ interface TouchListener {
}
interface DialogFragment {
new(): android.support.v4.app.DialogFragment;
new(): androidx.fragment.app.DialogFragment;
}
function initializeTouchListener(): void {
@ -133,7 +133,7 @@ function initializeDialogFragment() {
}
}
class DialogFragmentImpl extends android.support.v4.app.DialogFragment {
class DialogFragmentImpl extends androidx.fragment.app.DialogFragment {
public owner: View;
private _fullscreen: boolean;
private _stretched: boolean;
@ -155,7 +155,7 @@ function initializeDialogFragment() {
this._stretched = options.stretched;
this._dismissCallback = options.dismissCallback;
this._shownCallback = options.shownCallback;
this.setStyle(android.support.v4.app.DialogFragment.STYLE_NO_TITLE, 0);
this.setStyle(androidx.fragment.app.DialogFragment.STYLE_NO_TITLE, 0);
let theme = this.getTheme();
if (this._fullscreen) {
@ -255,14 +255,14 @@ function getModalOptions(domId: number): DialogOptions {
export class View extends ViewCommon {
public static androidBackPressedEvent = androidBackPressedEvent;
public _dialogFragment: android.support.v4.app.DialogFragment;
public _dialogFragment: androidx.fragment.app.DialogFragment;
private _isClickable: boolean;
private touchListenerIsSet: boolean;
private touchListener: android.view.View.OnTouchListener;
private layoutChangeListenerIsSet: boolean;
private layoutChangeListener: android.view.View.OnLayoutChangeListener;
private _manager: android.support.v4.app.FragmentManager;
private _rootManager: android.support.v4.app.FragmentManager;
private _manager: androidx.fragment.app.FragmentManager;
private _rootManager: androidx.fragment.app.FragmentManager;
private _originalElevation: number;
private _originalStateListAnimator: any; /* android.animation.StateListAnimator; */
@ -296,19 +296,19 @@ export class View extends ViewCommon {
}
}
public _getChildFragmentManager(): android.support.v4.app.FragmentManager {
public _getChildFragmentManager(): androidx.fragment.app.FragmentManager {
return null;
}
public _getRootFragmentManager(): android.support.v4.app.FragmentManager {
public _getRootFragmentManager(): androidx.fragment.app.FragmentManager {
if (!this._rootManager && this._context) {
this._rootManager = (<android.support.v4.app.FragmentActivity>this._context).getSupportFragmentManager();
this._rootManager = (<androidx.fragment.app.FragmentActivity>this._context).getSupportFragmentManager();
}
return this._rootManager;
}
public _getFragmentManager(): android.support.v4.app.FragmentManager {
public _getFragmentManager(): androidx.fragment.app.FragmentManager {
let manager = this._manager;
if (!manager) {
let view: View = this;

View File

@ -707,11 +707,8 @@ export abstract class View extends ViewBase {
/**
* @private
*/
_getFragmentManager(): any; /* androidx.fragment.app.FragmentManager */
_handleLivesync(context?: { type: string, path: string }): boolean;
/**
* @private
*/
_getFragmentManager(): any; /* android.support.v4.app.FragmentManager */
/**
* Updates styleScope or create new styleScope.

View File

@ -36,7 +36,7 @@ function dismissSoftInput(owner: EditableTextBase): void {
if (!dismissKeyboardTimeoutId) {
dismissKeyboardTimeoutId = setTimeout(() => {
const owner = dismissKeyboardOwner && dismissKeyboardOwner.get();
const activity = (owner && owner._context) as android.support.v7.app.AppCompatActivity;
const activity = (owner && owner._context) as androidx.appcompat.app.AppCompatActivity;
const nativeView = owner && owner.nativeViewProtected;
dismissKeyboardTimeoutId = null;
dismissKeyboardOwner = null;

View File

@ -8,7 +8,7 @@ if ((<any>global).__snapshot || (<any>global).__snapshotEnabled) {
//@ts-ignore
@JavaProxy("com.tns.NativeScriptActivity")
class NativeScriptActivity extends android.support.v7.app.AppCompatActivity {
class NativeScriptActivity extends androidx.appcompat.app.AppCompatActivity {
private _callbacks: AndroidActivityCallbacks;
public isNativeScriptActivity;
constructor() {

View File

@ -64,11 +64,11 @@ export function _setAndroidFragmentTransitions(
navigationTransition: NavigationTransition,
currentEntry: ExpandedEntry,
newEntry: ExpandedEntry,
fragmentTransaction: android.support.v4.app.FragmentTransaction,
fragmentTransaction: androidx.fragment.app.FragmentTransaction,
frameId: number): void {
const currentFragment: android.support.v4.app.Fragment = currentEntry ? currentEntry.fragment : null;
const newFragment: android.support.v4.app.Fragment = newEntry.fragment;
const currentFragment: androidx.fragment.app.Fragment = currentEntry ? currentEntry.fragment : null;
const newFragment: androidx.fragment.app.Fragment = newEntry.fragment;
const entries = waitingQueue.get(frameId);
if (entries && entries.size > 0) {
throw new Error("Calling navigation before previous navigation finish.");
@ -193,7 +193,7 @@ export function _setAndroidFragmentTransitions(
printTransitions(newEntry);
}
export function _onFragmentCreateAnimator(entry: ExpandedEntry, fragment: android.support.v4.app.Fragment, nextAnim: number, enter: boolean): android.animation.Animator {
export function _onFragmentCreateAnimator(entry: ExpandedEntry, fragment: androidx.fragment.app.Fragment, nextAnim: number, enter: boolean): android.animation.Animator {
let animator: android.animation.Animator;
switch (nextAnim) {
case AnimationType.enterFakeResourceId:
@ -406,7 +406,7 @@ function clearAnimationListener(animator: ExpandedAnimator, listener: android.an
function clearExitAndReenterTransitions(entry: ExpandedEntry, removeListener: boolean): void {
if (sdkVersion() >= 21) {
const fragment: android.support.v4.app.Fragment = entry.fragment;
const fragment: androidx.fragment.app.Fragment = entry.fragment;
const exitListener = entry.exitTransitionListener;
if (exitListener) {
const exitTransition = fragment.getExitTransition();
@ -459,7 +459,7 @@ function clearEntry(entry: ExpandedEntry, removeListener: boolean): void {
clearExitAndReenterTransitions(entry, removeListener);
if (sdkVersion() >= 21) {
const fragment: android.support.v4.app.Fragment = entry.fragment;
const fragment: androidx.fragment.app.Fragment = entry.fragment;
const enterListener = entry.enterTransitionListener;
if (enterListener) {
const enterTransition = fragment.getEnterTransition();
@ -510,7 +510,7 @@ function clearEntry(entry: ExpandedEntry, removeListener: boolean): void {
}
}
function allowTransitionOverlap(fragment: android.support.v4.app.Fragment): void {
function allowTransitionOverlap(fragment: androidx.fragment.app.Fragment): void {
if (fragment) {
fragment.setAllowEnterTransitionOverlap(true);
fragment.setAllowReturnTransitionOverlap(true);
@ -523,7 +523,7 @@ function setEnterTransition(navigationTransition: NavigationTransition, entry: E
// attach listener to JS object so that it will be alive as long as entry.
entry.enterTransitionListener = listener;
const fragment: android.support.v4.app.Fragment = entry.fragment;
const fragment: androidx.fragment.app.Fragment = entry.fragment;
fragment.setEnterTransition(transition);
}
@ -533,7 +533,7 @@ function setExitTransition(navigationTransition: NavigationTransition, entry: Ex
// attach listener to JS object so that it will be alive as long as entry.
entry.exitTransitionListener = listener;
const fragment: android.support.v4.app.Fragment = entry.fragment;
const fragment: androidx.fragment.app.Fragment = entry.fragment;
fragment.setExitTransition(transition);
}
@ -543,7 +543,7 @@ function setReenterTransition(navigationTransition: NavigationTransition, entry:
// attach listener to JS object so that it will be alive as long as entry.
entry.reenterTransitionListener = listener;
const fragment: android.support.v4.app.Fragment = entry.fragment;
const fragment: androidx.fragment.app.Fragment = entry.fragment;
fragment.setReenterTransition(transition);
}
@ -553,7 +553,7 @@ function setReturnTransition(navigationTransition: NavigationTransition, entry:
// attach listener to JS object so that it will be alive as long as entry.
entry.returnTransitionListener = listener;
const fragment: android.support.v4.app.Fragment = entry.fragment;
const fragment: androidx.fragment.app.Fragment = entry.fragment;
fragment.setReturnTransition(transition);
}

View File

@ -239,13 +239,13 @@ export class Frame extends FrameBase {
return;
}
const manager: android.support.v4.app.FragmentManager = this._getFragmentManager();
const manager: androidx.fragment.app.FragmentManager = this._getFragmentManager();
const transaction = manager.beginTransaction();
transaction.remove(this._currentEntry.fragment);
transaction.commitNowAllowingStateLoss();
}
private createFragment(backstackEntry: BackstackEntry, fragmentTag: string): android.support.v4.app.Fragment {
private createFragment(backstackEntry: BackstackEntry, fragmentTag: string): androidx.fragment.app.Fragment {
ensureFragmentClass();
const newFragment = new fragmentClass();
const args = new android.os.Bundle();
@ -364,7 +364,7 @@ export class Frame extends FrameBase {
return;
}
const manager: android.support.v4.app.FragmentManager = this._getFragmentManager();
const manager: androidx.fragment.app.FragmentManager = this._getFragmentManager();
const clearHistory = newEntry.entry.clearHistory;
const currentEntry = this._currentEntry;
@ -400,7 +400,7 @@ export class Frame extends FrameBase {
_setAndroidFragmentTransitions(animated, navigationTransition, currentEntry, newEntry, transaction, this._android.frameId);
if (currentEntry && animated && !navigationTransition) {
transaction.setTransition(android.support.v4.app.FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.setTransition(androidx.fragment.app.FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
}
transaction.replace(this.containerViewId, newFragment, newFragmentTag);
@ -411,7 +411,7 @@ export class Frame extends FrameBase {
super._goBackCore(backstackEntry);
navDepth = backstackEntry.navDepth;
const manager: android.support.v4.app.FragmentManager = this._getFragmentManager();
const manager: androidx.fragment.app.FragmentManager = this._getFragmentManager();
const transaction = manager.beginTransaction();
if (!backstackEntry.fragment) {
@ -618,8 +618,8 @@ class AndroidFrame extends Observable implements AndroidFrameDefinition {
}
}
public get activity(): android.support.v7.app.AppCompatActivity {
let activity: android.support.v7.app.AppCompatActivity = this.owner._context;
public get activity(): androidx.appcompat.app.AppCompatActivity {
let activity: androidx.appcompat.app.AppCompatActivity = this.owner._context;
if (activity) {
return activity;
}
@ -651,7 +651,7 @@ class AndroidFrame extends Observable implements AndroidFrameDefinition {
return bar;
}
public get currentActivity(): android.support.v7.app.AppCompatActivity {
public get currentActivity(): androidx.appcompat.app.AppCompatActivity {
let activity = this.activity;
if (activity) {
return activity;
@ -691,7 +691,7 @@ class AndroidFrame extends Observable implements AndroidFrameDefinition {
}
}
function findPageForFragment(fragment: android.support.v4.app.Fragment, frame: Frame) {
function findPageForFragment(fragment: androidx.fragment.app.Fragment, frame: Frame) {
const fragmentTag = fragment.getTag();
if (traceEnabled()) {
traceWrite(`Finding page for ${fragmentTag}.`, traceCategories.NativeLifecycle);
@ -724,7 +724,7 @@ function findPageForFragment(fragment: android.support.v4.app.Fragment, frame: F
}
}
function startActivity(activity: android.support.v7.app.AppCompatActivity, frameId: number) {
function startActivity(activity: androidx.appcompat.app.AppCompatActivity, frameId: number) {
// TODO: Implicitly, we will open the same activity type as the current one
const intent = new android.content.Intent(activity, activity.getClass());
intent.setAction(android.content.Intent.ACTION_DEFAULT);
@ -755,7 +755,7 @@ function ensureFragmentClass() {
require("ui/frame/fragment");
if (!fragmentClass) {
throw new Error("Failed to initialize the extended android.support.v4.app.Fragment class");
throw new Error("Failed to initialize the extended androidx.fragment.app.Fragment class");
}
}
@ -773,7 +773,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
public entry: BackstackEntry;
@profile
public onHiddenChanged(fragment: android.support.v4.app.Fragment, hidden: boolean, superFunc: Function): void {
public onHiddenChanged(fragment: androidx.fragment.app.Fragment, hidden: boolean, superFunc: Function): void {
if (traceEnabled()) {
traceWrite(`${fragment}.onHiddenChanged(${hidden})`, traceCategories.NativeLifecycle);
}
@ -809,7 +809,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
}
@profile
public onCreate(fragment: android.support.v4.app.Fragment, savedInstanceState: android.os.Bundle, superFunc: Function): void {
public onCreate(fragment: androidx.fragment.app.Fragment, savedInstanceState: android.os.Bundle, superFunc: Function): void {
if (traceEnabled()) {
traceWrite(`${fragment}.onCreate(${savedInstanceState})`, traceCategories.NativeLifecycle);
}
@ -830,7 +830,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
}
@profile
public onCreateView(fragment: android.support.v4.app.Fragment, inflater: android.view.LayoutInflater, container: android.view.ViewGroup, savedInstanceState: android.os.Bundle, superFunc: Function): android.view.View {
public onCreateView(fragment: androidx.fragment.app.Fragment, inflater: android.view.LayoutInflater, container: android.view.ViewGroup, savedInstanceState: android.os.Bundle, superFunc: Function): android.view.View {
if (traceEnabled()) {
traceWrite(`${fragment}.onCreateView(inflater, container, ${savedInstanceState})`, traceCategories.NativeLifecycle);
}
@ -901,7 +901,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
}
@profile
public onSaveInstanceState(fragment: android.support.v4.app.Fragment, outState: android.os.Bundle, superFunc: Function): void {
public onSaveInstanceState(fragment: androidx.fragment.app.Fragment, outState: android.os.Bundle, superFunc: Function): void {
if (traceEnabled()) {
traceWrite(`${fragment}.onSaveInstanceState(${outState})`, traceCategories.NativeLifecycle);
}
@ -909,7 +909,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
}
@profile
public onDestroyView(fragment: android.support.v4.app.Fragment, superFunc: Function): void {
public onDestroyView(fragment: androidx.fragment.app.Fragment, superFunc: Function): void {
if (traceEnabled()) {
traceWrite(`${fragment}.onDestroyView()`, traceCategories.NativeLifecycle);
}
@ -918,7 +918,7 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
}
@profile
public onDestroy(fragment: android.support.v4.app.Fragment, superFunc: Function): void {
public onDestroy(fragment: androidx.fragment.app.Fragment, superFunc: Function): void {
if (traceEnabled()) {
traceWrite(`${fragment}.onDestroy()`, traceCategories.NativeLifecycle);
}
@ -945,12 +945,12 @@ class FragmentCallbacksImplementation implements AndroidFragmentCallbacks {
}
@profile
public onStop(fragment: android.support.v4.app.Fragment, superFunc: Function): void {
public onStop(fragment: androidx.fragment.app.Fragment, superFunc: Function): void {
superFunc.call(fragment);
}
@profile
public toStringOverride(fragment: android.support.v4.app.Fragment, superFunc: Function): string {
public toStringOverride(fragment: androidx.fragment.app.Fragment, superFunc: Function): string {
const entry = this.entry;
if (entry) {
return `${entry.fragmentTag}<${entry.resolvedPage}>`;
@ -968,7 +968,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
}
@profile
public onCreate(activity: android.support.v7.app.AppCompatActivity, savedInstanceState: android.os.Bundle, intentOrSuperFunc: android.content.Intent | Function, superFunc?: Function): void {
public onCreate(activity: androidx.appcompat.app.AppCompatActivity, savedInstanceState: android.os.Bundle, intentOrSuperFunc: android.content.Intent | Function, superFunc?: Function): void {
if (traceEnabled()) {
traceWrite(`Activity.onCreate(${savedInstanceState})`, traceCategories.NativeLifecycle);
}
@ -1012,7 +1012,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
}
@profile
public onSaveInstanceState(activity: android.support.v7.app.AppCompatActivity, outState: android.os.Bundle, superFunc: Function): void {
public onSaveInstanceState(activity: androidx.appcompat.app.AppCompatActivity, outState: android.os.Bundle, superFunc: Function): void {
superFunc.call(activity, outState);
const rootView = this._rootView;
if (rootView instanceof Frame) {
@ -1024,7 +1024,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
}
@profile
public onNewIntent(activity: android.support.v7.app.AppCompatActivity, intent: android.content.Intent, superSetIntentFunc: Function, superFunc: Function): void {
public onNewIntent(activity: androidx.appcompat.app.AppCompatActivity, intent: android.content.Intent, superSetIntentFunc: Function, superFunc: Function): void {
superFunc.call(activity, intent);
superSetIntentFunc.call(activity, intent);
@ -1190,7 +1190,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
});
}
public resetActivityContent(activity: android.support.v7.app.AppCompatActivity): void {
public resetActivityContent(activity: androidx.appcompat.app.AppCompatActivity): void {
if (this._rootView) {
const manager = this._rootView._getFragmentManager();
manager.executePendingTransactions();
@ -1209,7 +1209,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
// 3. Livesync if rootView has no custom _onLivesync. this._rootView should have been cleared upfront. Launch event should not fired
// 4. _resetRootView method. this._rootView should have been cleared upfront. Launch event should not fired
private setActivityContent(
activity: android.support.v7.app.AppCompatActivity,
activity: androidx.appcompat.app.AppCompatActivity,
savedInstanceState: android.os.Bundle,
fireLaunchEvent: boolean
): void {
@ -1300,10 +1300,10 @@ const notifyLaunch = profile("notifyLaunch", function notifyLaunch(intent: andro
return launchArgs.root;
});
export function setActivityCallbacks(activity: android.support.v7.app.AppCompatActivity): void {
export function setActivityCallbacks(activity: androidx.appcompat.app.AppCompatActivity): void {
activity[CALLBACKS] = new ActivityCallbacksImplementation();
}
export function setFragmentCallbacks(fragment: android.support.v4.app.Fragment): void {
export function setFragmentCallbacks(fragment: androidx.fragment.app.Fragment): void {
fragment[CALLBACKS] = new FragmentCallbacksImplementation();
}

View File

@ -198,7 +198,7 @@ export class Frame extends View {
}
/**
* Sets the extended android.support.v4.app.Fragment class to the Frame and navigation routine. An instance of this class will be created to represent the Page currently visible on the srceen. This method is available only for the Android platform.
* Sets the extended androidx.fragment.app.Fragment class to the Frame and navigation routine. An instance of this class will be created to represent the Page currently visible on the srceen. This method is available only for the Android platform.
*/
export function setFragmentClass(clazz: any): void;
@ -398,12 +398,12 @@ export interface AndroidFrame extends Observable {
/**
* Gets the native [android Activity](http://developer.android.com/reference/android/app/Activity.html) instance associated with this Frame. In case of nested Frame objects, this property points to the activity of the root Frame.
*/
activity: any /* android.support.v7.app.AppCompatActivity */;
activity: any /* androidx.appcompat.app.AppCompatActivity */;
/**
* Gets the current (foreground) activity for the application. This property will recursively traverse all existing Frame objects and check for own Activity property.
*/
currentActivity: any /* android.support.v7.app.AppCompatActivity */;
currentActivity: any /* androidx.appcompat.app.AppCompatActivity */;
/**
* Gets the actionBar property of the currentActivity.
@ -423,7 +423,7 @@ export interface AndroidFrame extends Observable {
cachePagesOnNavigate: boolean;
/**
* Finds the native android.support.v4.app.Fragment instance created for the specified Page.
* Finds the native androidx.fragment.app.Fragment instance created for the specified Page.
* @param page The Page instance to search for.
*/
fragmentForPage(entry: BackstackEntry): any;
@ -487,7 +487,7 @@ export interface iOSFrame {
//@endprivate
}
export function setActivityCallbacks(activity: any /*android.support.v7.app.AppCompatActivity*/): void;
export function setActivityCallbacks(activity: any /*androidx.appcompat.app.AppCompatActivity*/): void;
//@private
/**
* @private
@ -496,5 +496,5 @@ export function reloadPage(): void;
/**
* @private
*/
export function setFragmentCallbacks(fragment: any /*android.support.v4.app.Fragment*/): void;
export function setFragmentCallbacks(fragment: any /*androidx.fragment.app.Fragment*/): void;
//@endprivate

View File

@ -294,7 +294,7 @@ export class GesturesObserver extends GesturesObserverBase {
if (type & GestureTypes.tap || type & GestureTypes.doubleTap || type & GestureTypes.longPress) {
initializeTapAndDoubleTapGestureListener();
this._simpleGestureDetector = new android.support.v4.view.GestureDetectorCompat(target._context, new TapAndDoubleTapGestureListener(this, this.target, type));
this._simpleGestureDetector = new androidx.core.view.GestureDetectorCompat(target._context, new TapAndDoubleTapGestureListener(this, this.target, type));
}
if (type & GestureTypes.pinch) {
@ -304,7 +304,7 @@ export class GesturesObserver extends GesturesObserverBase {
if (type & GestureTypes.swipe) {
initializeSwipeGestureListener();
this._swipeGestureDetector = new android.support.v4.view.GestureDetectorCompat(target._context, new SwipeGestureListener(this, this.target));
this._swipeGestureDetector = new androidx.core.view.GestureDetectorCompat(target._context, new SwipeGestureListener(this, this.target));
}
if (type & GestureTypes.pan) {

View File

@ -59,7 +59,7 @@ export class Page extends PageBase {
[statusBarStyleProperty.getDefault](): { color: number, systemUiVisibility: number } {
if (device.sdkVersion >= "21") {
const window = (<android.support.v7.app.AppCompatActivity>this._context).getWindow();
const window = (<androidx.appcompat.app.AppCompatActivity>this._context).getWindow();
const decorView = window.getDecorView();
return {
@ -72,7 +72,7 @@ export class Page extends PageBase {
}
[statusBarStyleProperty.setNative](value: "dark" | "light" | { color: number, systemUiVisibility: number }) {
if (device.sdkVersion >= "21") {
const window = (<android.support.v7.app.AppCompatActivity>this._context).getWindow();
const window = (<androidx.appcompat.app.AppCompatActivity>this._context).getWindow();
const decorView = window.getDecorView();
if (value === "light") {
@ -91,7 +91,7 @@ export class Page extends PageBase {
[androidStatusBarBackgroundProperty.getDefault](): number {
if (device.sdkVersion >= "21") {
const window = (<android.support.v7.app.AppCompatActivity>this._context).getWindow();
const window = (<androidx.appcompat.app.AppCompatActivity>this._context).getWindow();
return (<any>window).getStatusBarColor();
}
@ -99,7 +99,7 @@ export class Page extends PageBase {
}
[androidStatusBarBackgroundProperty.setNative](value: number | Color) {
if (device.sdkVersion >= "21") {
const window = (<android.support.v7.app.AppCompatActivity>this._context).getWindow();
const window = (<androidx.appcompat.app.AppCompatActivity>this._context).getWindow();
const color = value instanceof Color ? value.android : value;
(<any>window).setStatusBarColor(color);
}

View File

@ -12,11 +12,11 @@ const SEARCHTEXT = Symbol("searchText");
const QUERY = Symbol("query");
interface QueryTextListener {
new (owner: SearchBar): android.support.v7.widget.SearchView.OnQueryTextListener;
new (owner: SearchBar): androidx.appcompat.widget.SearchView.OnQueryTextListener;
}
interface CloseListener {
new (owner: SearchBar): android.support.v7.widget.SearchView.OnCloseListener;
new (owner: SearchBar): androidx.appcompat.widget.SearchView.OnCloseListener;
}
let QueryTextListener: QueryTextListener;
@ -27,8 +27,8 @@ function initializeNativeClasses(): void {
return;
}
@Interfaces([android.support.v7.widget.SearchView.OnQueryTextListener])
class CompatQueryTextListenerImpl extends java.lang.Object implements android.support.v7.widget.SearchView.OnQueryTextListener {
@Interfaces([androidx.appcompat.widget.SearchView.OnQueryTextListener])
class CompatQueryTextListenerImpl extends java.lang.Object implements androidx.appcompat.widget.SearchView.OnQueryTextListener {
constructor(private owner: SearchBar) {
super();
return global.__native(this);
@ -60,8 +60,8 @@ function initializeNativeClasses(): void {
}
}
@Interfaces([android.support.v7.widget.SearchView.OnCloseListener])
class CompatCloseListenerImpl extends java.lang.Object implements android.support.v7.widget.SearchView.OnCloseListener {
@Interfaces([androidx.appcompat.widget.SearchView.OnCloseListener])
class CompatCloseListenerImpl extends java.lang.Object implements androidx.appcompat.widget.SearchView.OnCloseListener {
constructor(private owner: SearchBar) {
super();
return global.__native(this);
@ -105,7 +105,7 @@ function enableUserInteractionSearchView(nativeView: any, value: boolean) {
}
export class SearchBar extends SearchBarBase {
nativeViewProtected: android.support.v7.widget.SearchView;
nativeViewProtected: androidx.appcompat.widget.SearchView;
private _searchTextView: android.widget.TextView;
private _searchPlate: android.widget.LinearLayout;
@ -123,7 +123,7 @@ export class SearchBar extends SearchBarBase {
}
public createNativeView() {
const nativeView = new android.support.v7.widget.SearchView(this._context)
const nativeView = new androidx.appcompat.widget.SearchView(this._context)
nativeView.setIconified(false);
return nativeView;
}

View File

@ -27,7 +27,7 @@ export module ad {
function isSetColorFilterOnlyWidget(nativeView: android.view.View): boolean {
return (
nativeView instanceof android.widget.Button ||
(nativeView instanceof android.support.v7.widget.Toolbar
(nativeView instanceof androidx.appcompat.widget.Toolbar
&& getSDK() >= 21 // There is an issue with the DrawableContainer which was fixed for API version 21 and above: https://code.google.com/p/android/issues/detail?id=60183
)
);

View File

@ -21,7 +21,7 @@ const PRIMARY_COLOR = "colorPrimary";
const DEFAULT_ELEVATION = 4;
interface PagerAdapter {
new(owner: TabView): android.support.v4.view.PagerAdapter;
new(owner: TabView): androidx.viewpager.widget.PagerAdapter;
}
const TABID = "_tabId";
@ -84,10 +84,10 @@ function initializeNativeClasses() {
const POSITION_UNCHANGED = -1;
const POSITION_NONE = -2;
class FragmentPagerAdapter extends android.support.v4.view.PagerAdapter {
class FragmentPagerAdapter extends androidx.viewpager.widget.PagerAdapter {
public items: Array<TabViewItemDefinition>;
private mCurTransaction: android.support.v4.app.FragmentTransaction;
private mCurrentPrimaryItem: android.support.v4.app.Fragment;
private mCurTransaction: androidx.fragment.app.FragmentTransaction;
private mCurrentPrimaryItem: androidx.fragment.app.Fragment;
constructor(public owner: TabView) {
super();
@ -123,7 +123,7 @@ function initializeNativeClasses() {
const itemId = this.getItemId(position);
const name = makeFragmentName(container.getId(), itemId);
let fragment: android.support.v4.app.Fragment = fragmentManager.findFragmentByTag(name);
let fragment: androidx.fragment.app.Fragment = fragmentManager.findFragmentByTag(name);
if (fragment != null) {
this.mCurTransaction.attach(fragment);
} else {
@ -155,7 +155,7 @@ function initializeNativeClasses() {
this.mCurTransaction = fragmentManager.beginTransaction();
}
const fragment: android.support.v4.app.Fragment = <android.support.v4.app.Fragment>object;
const fragment: androidx.fragment.app.Fragment = <androidx.fragment.app.Fragment>object;
this.mCurTransaction.detach(fragment);
if (this.mCurrentPrimaryItem === fragment) {
@ -170,7 +170,7 @@ function initializeNativeClasses() {
}
setPrimaryItem(container: android.view.ViewGroup, position: number, object: java.lang.Object): void {
const fragment = <android.support.v4.app.Fragment>object;
const fragment = <androidx.fragment.app.Fragment>object;
if (fragment !== this.mCurrentPrimaryItem) {
if (this.mCurrentPrimaryItem != null) {
this.mCurrentPrimaryItem.setMenuVisibility(false);
@ -200,7 +200,7 @@ function initializeNativeClasses() {
}
isViewFromObject(view: android.view.View, object: java.lang.Object): boolean {
return (<android.support.v4.app.Fragment>object).getView() === view;
return (<androidx.fragment.app.Fragment>object).getView() === view;
}
saveState(): android.os.Parcelable {
@ -309,7 +309,7 @@ export class TabViewItem extends TabViewItemBase {
}
}
public _getChildFragmentManager(): android.support.v4.app.FragmentManager {
public _getChildFragmentManager(): androidx.fragment.app.FragmentManager {
const tabView = this.parent as TabView;
let tabFragment = null;
const fragmentManager = tabView._getFragmentManager();
@ -367,7 +367,7 @@ export class TabViewItem extends TabViewItemBase {
}
function setElevation(grid: org.nativescript.widgets.GridLayout, tabLayout: org.nativescript.widgets.TabLayout) {
const compat = <any>android.support.v4.view.ViewCompat;
const compat = <any>androidx.core.view.ViewCompat;
if (compat.setElevation) {
const val = DEFAULT_ELEVATION * layout.getDisplayDensity();
compat.setElevation(grid, val);
@ -387,8 +387,8 @@ function iterateIndexRange(index: number, eps: number, lastIndex: number, callba
export class TabView extends TabViewBase {
private _tabLayout: org.nativescript.widgets.TabLayout;
private _viewPager: android.support.v4.view.ViewPager;
private _pagerAdapter: android.support.v4.view.PagerAdapter;
private _viewPager: androidx.viewpager.widget.ViewPager;
private _pagerAdapter: androidx.viewpager.widget.PagerAdapter;
private _androidViewId: number = -1;
constructor() {

View File

@ -92,7 +92,7 @@ export class TabView extends View {
/**
* Gets the native [android widget](http://developer.android.com/reference/android/support/v4/view/ViewPager.html) that represents the user interface for this component. Valid only when running on Android OS.
*/
android: any /* android.view.View */; //android.support.v4.view.ViewPager;
android: any /* android.view.View */; //androidx.core.view.ViewPager;
/**
* Gets the native iOS [UITabBarController](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITabBarController_Class/) that represents the user interface for this component. Valid only when running on iOS.

View File

@ -119,7 +119,7 @@ export module ad {
if (nativeView instanceof android.view.View) {
windowToken = nativeView.getWindowToken()
} else if (androidApp.foregroundActivity instanceof android.support.v7.app.AppCompatActivity) {
} else if (androidApp.foregroundActivity instanceof androidx.appcompat.app.AppCompatActivity) {
const decorView = androidApp.foregroundActivity.getWindow().getDecorView();
windowToken = decorView ? decorView.getWindowToken() : null;
}
@ -183,7 +183,7 @@ export module ad {
let result = 0;
try {
if (!attr) {
attr = java.lang.Class.forName("android.support.v7.appcompat.R$attr")
attr = java.lang.Class.forName("androidx.appcompat.R$attr")
}
let colorID = 0;
@ -335,7 +335,7 @@ Applications cannot access internal storage of other application on Android (see
const providerName = `${context.getPackageName()}.provider`;
traceWrite(`fully-qualified provider name [${providerName}]`, traceCategories.Debug);
const apkURI = android.support.v4.content.FileProvider.getUriForFile(
const apkURI = androidx.core.content.FileProvider.getUriForFile(
context,
providerName,
new java.io.File(filePath),

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-17.d.ts" />
/// <reference path="./android/android-support-17.d.ts" />
/// <reference path="./android/androidx-17.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-18.d.ts" />
/// <reference path="./android/android-support-17.d.ts" />
/// <reference path="./android/androidx-17.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-19.d.ts" />
/// <reference path="./android/android-support-17.d.ts" />
/// <reference path="./android/androidx-17.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-20.d.ts" />
/// <reference path="./android/android-support-17.d.ts" />
/// <reference path="./android/androidx-17.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-21.d.ts" />
/// <reference path="./android/android-support-17.d.ts" />
/// <reference path="./android/androidx-17.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-22.d.ts" />
/// <reference path="./android/android-support-17.d.ts" />
/// <reference path="./android/androidx-17.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-23.d.ts" />
/// <reference path="./android/android-support-23.d.ts" />
/// <reference path="./android/androidx-23.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-24.d.ts" />
/// <reference path="./android/android-support-23.d.ts" />
/// <reference path="./android/androidx-23.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-25.d.ts" />
/// <reference path="./android/android-support-23.d.ts" />
/// <reference path="./android/androidx-23.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-26.d.ts" />
/// <reference path="./android/android-support-26.d.ts" />
/// <reference path="./android/androidx-26.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-27.d.ts" />
/// <reference path="./android/android-support-26.d.ts" />
/// <reference path="./android/androidx-26.d.ts" />
/// <reference path="./android/common.d.ts" />

View File

@ -1,3 +1,3 @@
/// <reference path="./android/android-platform-28.d.ts" />
/// <reference path="./android/android-support-28.d.ts" />
/// <reference path="./android/androidx-28.d.ts" />
/// <reference path="./android/common.d.ts" />

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -166,10 +166,10 @@
public verticalAlignment: VerticalAlignment;
}
export class FragmentBase extends android.support.v4.app.Fragment {
export class FragmentBase extends androidx.fragment.app.Fragment {
constructor();
public getRemovingParentFragment(): android.support.v4.app.Fragment;
public getRemovingParentFragment(): androidx.fragment.app.Fragment;
}
export enum Stretch {
@ -390,7 +390,7 @@
setTabTextFontSize(fontSize: number): void;
getTabTextFontSize(): number;
setItems(items: Array<TabItemSpec>, viewPager: android.support.v4.view.ViewPager): void;
setItems(items: Array<TabItemSpec>, viewPager: androidx.viewpager.widget.ViewPager): void;
updateItemAt(position: number, itemSpec: TabItemSpec): void;
getTextViewForItemAt(index: number): android.widget.TextView;
@ -398,7 +398,7 @@
getItemCount(): number;
}
export class TabViewPager extends android.support.v4.view.ViewPager {
export class TabViewPager extends androidx.viewpager.widget.ViewPager {
constructor(context: android.content.Context);
constructor(context: android.content.Context, attrs: android.util.AttributeSet);

View File

@ -3,6 +3,7 @@
"exclude": [
"android-*.d.ts",
"android/android-*.d.ts",
"android/androidx-*.d.ts",
"ios/objc-x86_64",
"node_modules",
"package"

View File

@ -10,6 +10,7 @@
"tns-platform-declarations/references.d.ts",
"tns-platform-declarations/android-*.d.ts",
"tns-platform-declarations/android/android-*.d.ts",
"tns-platform-declarations/android/androidx-*.d.ts",
"tests/node_modules",
"tests/package/",
"tests/platforms",