From afc6a610da4767e30257221ca9e0e5265dda716e Mon Sep 17 00:00:00 2001 From: Shashank Agrawal Date: Fri, 15 Mar 2019 12:44:27 +0530 Subject: [PATCH] Replacing fade method with hide & show --- src/android/OverAppBrowser.java | 34 +++++---------------------------- src/ios/OverAppBrowser.h | 2 +- src/ios/OverAppBrowser.m | 2 +- www/ios/OverAppBrowser.js | 12 ++++++------ 4 files changed, 13 insertions(+), 37 deletions(-) diff --git a/src/android/OverAppBrowser.java b/src/android/OverAppBrowser.java index 21408f7..474c384 100644 --- a/src/android/OverAppBrowser.java +++ b/src/android/OverAppBrowser.java @@ -218,18 +218,15 @@ else if (SYSTEM.equals(target)) { PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); pluginResult.setKeepCallback(true); this.callbackContext.sendPluginResult(pluginResult); - } else if (action.equals("fade")) { - float to = (float) args.getDouble(0); - int duration = args.getInt(1); - - fadeTo(to, duration); + } else if (action.equals("hide")) { + hide(); PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); pluginResult.setKeepCallback(true); this.callbackContext.sendPluginResult(pluginResult); - } else { return false; } + return true; } @@ -626,32 +623,11 @@ public void run() { }); } - private void fadeTo(float to, int duration) { - final WebView childView = this.inAppWebView; - // The JS protects against multiple calls, so this should happen only when - // closeDialog() is called by other native code. - if (childView == null) { - return; - } - - final float toAlpha = to; - final int animationDuration = duration; + private void hide() { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { - // Window window = childView.getWindow(); - // WindowManager.LayoutParams wlp = window.getAttributes(); - - - // wlp.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND; - // wlp.dimAmount = toAlpha; - // window.setAttributes(wlp); - // ObjectAnimator fade = ObjectAnimator.ofFloat(dialog.getWindow(), "alpha", 0.0f, toAlpha); - // fade.setDuration(animationDuration); - - // final AnimatorSet mAnimationSet = new AnimatorSet(); - - // mAnimationSet.play(fade); + dialog.hide(); } }); } diff --git a/src/ios/OverAppBrowser.h b/src/ios/OverAppBrowser.h index f10fdd2..9f5d858 100755 --- a/src/ios/OverAppBrowser.h +++ b/src/ios/OverAppBrowser.h @@ -25,7 +25,7 @@ - (void)open:(CDVInvokedUrlCommand *)command; -- (void)fade:(CDVInvokedUrlCommand *)command; +- (void)hide:(CDVInvokedUrlCommand *)command; - (void)resize:(CDVInvokedUrlCommand *)command; - (void)injectScriptCode:(CDVInvokedUrlCommand*)command; - (void)close:(CDVInvokedUrlCommand *)command; diff --git a/src/ios/OverAppBrowser.m b/src/ios/OverAppBrowser.m index 069f11c..afc084a 100755 --- a/src/ios/OverAppBrowser.m +++ b/src/ios/OverAppBrowser.m @@ -89,7 +89,7 @@ - (void) open:(CDVInvokedUrlCommand *)command } -- (void)fade:(CDVInvokedUrlCommand *)command { +- (void)hide:(CDVInvokedUrlCommand *)command { NSArray* arguments = [command arguments]; NSUInteger argc = [arguments count]; diff --git a/www/ios/OverAppBrowser.js b/www/ios/OverAppBrowser.js index 8c57545..0c3719d 100755 --- a/www/ios/OverAppBrowser.js +++ b/www/ios/OverAppBrowser.js @@ -27,17 +27,17 @@ OverAppBrowser.prototype = { this.channels[event.type].fire(event); } }, - close: function (eventname) { + close: function () { exec(null, null, "OverAppBrowser", "close", []); }, - show: function (eventname) { + show: function () { exec(null, null, "OverAppBrowser", "show", []); }, - fade: function (toAlpha, duration) { - exec(null, null, "OverAppBrowser", "fade", [toAlpha, duration]); + hide: function (toAlpha, duration) { + exec(null, null, "OverAppBrowser", "hide", [toAlpha, duration]); }, - resize: function (originx, originy, width, height) { - exec(null, null, "OverAppBrowser", "resize", [originx, originy, width, height]); + resize: function (originX, originY, width, height) { + exec(null, null, "OverAppBrowser", "resize", [originX, originY, width, height]); }, addEventListener: function (eventname,f) { if (eventname in this.channels) {