Skip to content

Commit c7b5e10

Browse files
committed
Adapt hide functionality for Android from PR EddyVerbruggen#176
EddyVerbruggen#176
1 parent fb1f70d commit c7b5e10

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/android/ChromeCustomTabPlugin.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
7373
if(isAvailable()) {
7474
try {
7575
this.show(url, getColor(toolbarColor), showDefaultShareMenuItem, transition);
76+
// if (options.optBoolean("hidden", false)) {
77+
// this.hide();
78+
// }
7679
result.put("event", "loaded");
7780
pluginResult = new PluginResult(PluginResult.Status.OK, result);
7881
pluginResult.setKeepCallback(true);
@@ -88,6 +91,11 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
8891
callbackContext.sendPluginResult(pluginResult);
8992
return true;
9093
}
94+
case "hide": {
95+
this.hide();
96+
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, true));
97+
return true;
98+
}
9199
case "getViewHandlerPackages": {
92100
PluginResult pluginResult;
93101
final JSONObject result = new JSONObject();
@@ -166,6 +174,10 @@ private void show(String url, @ColorInt int toolbarColor, boolean showDefaultSha
166174
startCustomTabActivity(url, customTabsIntent.intent);
167175
}
168176

177+
private void hide() {
178+
cordova.getActivity().startActivity(new Intent(cordova.getActivity(), cordova.getActivity().getClass()));
179+
}
180+
169181
private void addTransition(CustomTabsIntent.Builder builder, String transition) {
170182
final String animType = "anim";
171183
switch (transition){

0 commit comments

Comments
 (0)