Skip to content

Commit

Permalink
Adapt hide functionality for Android from PR EddyVerbruggen#176
Browse files Browse the repository at this point in the history
  • Loading branch information
BendingBender committed Jul 26, 2021
1 parent fb1f70d commit c7b5e10
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/android/ChromeCustomTabPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
if(isAvailable()) {
try {
this.show(url, getColor(toolbarColor), showDefaultShareMenuItem, transition);
// if (options.optBoolean("hidden", false)) {
// this.hide();
// }
result.put("event", "loaded");
pluginResult = new PluginResult(PluginResult.Status.OK, result);
pluginResult.setKeepCallback(true);
Expand All @@ -88,6 +91,11 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
callbackContext.sendPluginResult(pluginResult);
return true;
}
case "hide": {
this.hide();
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, true));
return true;
}
case "getViewHandlerPackages": {
PluginResult pluginResult;
final JSONObject result = new JSONObject();
Expand Down Expand Up @@ -166,6 +174,10 @@ private void show(String url, @ColorInt int toolbarColor, boolean showDefaultSha
startCustomTabActivity(url, customTabsIntent.intent);
}

private void hide() {
cordova.getActivity().startActivity(new Intent(cordova.getActivity(), cordova.getActivity().getClass()));
}

private void addTransition(CustomTabsIntent.Builder builder, String transition) {
final String animType = "anim";
switch (transition){
Expand Down

0 comments on commit c7b5e10

Please sign in to comment.