Skip to content

Commit

Permalink
Replacing fade method with hide & show
Browse files Browse the repository at this point in the history
  • Loading branch information
sagrawal31 committed Mar 15, 2019
1 parent 86beaa9 commit afc6a61
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 37 deletions.
34 changes: 5 additions & 29 deletions src/android/OverAppBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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();
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/ios/OverAppBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/ios/OverAppBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ - (void) open:(CDVInvokedUrlCommand *)command

}

- (void)fade:(CDVInvokedUrlCommand *)command {
- (void)hide:(CDVInvokedUrlCommand *)command {
NSArray* arguments = [command arguments];
NSUInteger argc = [arguments count];

Expand Down
12 changes: 6 additions & 6 deletions www/ios/OverAppBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit afc6a61

Please sign in to comment.