This commit is contained in:
Brad Martin
2019-08-21 04:20:25 -07:00
committed by Svetoslav
parent b6ff4d376a
commit f3bd2e9c5b

View File

@@ -44,6 +44,7 @@ let DialogFragment: DialogFragment;
interface DialogOptions { interface DialogOptions {
owner: View; owner: View;
fullscreen: boolean; fullscreen: boolean;
animated: boolean;
stretched: boolean; stretched: boolean;
cancelable: boolean; cancelable: boolean;
shownCallback: () => void; shownCallback: () => void;
@@ -137,6 +138,7 @@ function initializeDialogFragment() {
class DialogFragmentImpl extends androidx.fragment.app.DialogFragment { class DialogFragmentImpl extends androidx.fragment.app.DialogFragment {
public owner: View; public owner: View;
private _fullscreen: boolean; private _fullscreen: boolean;
private _animated: boolean;
private _stretched: boolean; private _stretched: boolean;
private _cancelable: boolean; private _cancelable: boolean;
private _shownCallback: () => void; private _shownCallback: () => void;
@@ -153,6 +155,7 @@ function initializeDialogFragment() {
const options = getModalOptions(ownerId); const options = getModalOptions(ownerId);
this.owner = options.owner; this.owner = options.owner;
this._fullscreen = options.fullscreen; this._fullscreen = options.fullscreen;
this._animated = options.animated;
this._cancelable = options.cancelable; this._cancelable = options.cancelable;
this._stretched = options.stretched; this._stretched = options.stretched;
this._dismissCallback = options.dismissCallback; this._dismissCallback = options.dismissCallback;
@@ -178,6 +181,16 @@ function initializeDialogFragment() {
this.owner.verticalAlignment = "stretch"; this.owner.verticalAlignment = "stretch";
} }
// set the modal window animation
// https://github.com/NativeScript/NativeScript/issues/5989
if (this._animated) {
dialog
.getWindow()
.setWindowAnimations(
android.R.style.Animation_Dialog
);
}
dialog.setCanceledOnTouchOutside(this._cancelable); dialog.setCanceledOnTouchOutside(this._cancelable);
return dialog; return dialog;
@@ -629,6 +642,7 @@ export class View extends ViewCommon {
const dialogOptions: DialogOptions = { const dialogOptions: DialogOptions = {
owner: this, owner: this,
fullscreen: !!options.fullscreen, fullscreen: !!options.fullscreen,
animated: !!options.animated,
stretched: !!options.stretched, stretched: !!options.stretched,
cancelable: options.android ? !!options.android.cancelable : true, cancelable: options.android ? !!options.android.cancelable : true,
shownCallback: () => this._raiseShownModallyEvent(), shownCallback: () => this._raiseShownModallyEvent(),