Fixed Android default context menu over custom context menu on API Level 31+
This commit is contained in:
parent
2d31a2f58b
commit
f511e4d1f5
|
@ -1,3 +1,7 @@
|
|||
## 5.4.1+1
|
||||
|
||||
- Fixed Android default context menu over custom context menu on API Level 31+
|
||||
|
||||
## 5.4.1
|
||||
|
||||
- Managed iOS native `detachFromEngine` flutter plugin event and updated `dispose` methods
|
||||
|
|
|
@ -41,7 +41,6 @@ import android.webkit.URLUtil;
|
|||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebBackForwardList;
|
||||
import android.webkit.WebHistoryItem;
|
||||
import android.webkit.WebMessage;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebStorage;
|
||||
import android.widget.HorizontalScrollView;
|
||||
|
@ -55,8 +54,6 @@ import androidx.webkit.WebViewCompat;
|
|||
import androidx.webkit.WebViewFeature;
|
||||
|
||||
import com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.DownloadStartRequest;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.InAppWebViewInterface;
|
||||
import com.pichillilorenzo.flutter_inappwebview.JavaScriptBridgeInterface;
|
||||
import com.pichillilorenzo.flutter_inappwebview.R;
|
||||
import com.pichillilorenzo.flutter_inappwebview.Util;
|
||||
|
@ -77,6 +74,8 @@ import com.pichillilorenzo.flutter_inappwebview.plugin_scripts_js.PrintJS;
|
|||
import com.pichillilorenzo.flutter_inappwebview.plugin_scripts_js.PromisePolyfillJS;
|
||||
import com.pichillilorenzo.flutter_inappwebview.pull_to_refresh.PullToRefreshLayout;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.ContentWorld;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.DownloadStartRequest;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.InAppWebViewInterface;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.PluginScript;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.PreferredContentModeOptionType;
|
||||
import com.pichillilorenzo.flutter_inappwebview.types.URLRequest;
|
||||
|
@ -1357,8 +1356,16 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie
|
|||
}
|
||||
|
||||
Menu actionMenu = actionMode.getMenu();
|
||||
if (options.disableContextMenu) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
actionMode.hide(3000);
|
||||
}
|
||||
List<MenuItem> defaultMenuItems = new ArrayList<>();
|
||||
for (int i = 0; i < actionMenu.size(); i++) {
|
||||
defaultMenuItems.add(actionMenu.getItem(i));
|
||||
}
|
||||
actionMenu.clear();
|
||||
actionMode.finish();
|
||||
if (options.disableContextMenu) {
|
||||
return actionMode;
|
||||
}
|
||||
|
||||
|
@ -1379,8 +1386,7 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie
|
|||
customMenuItems = customMenuItems == null ? new ArrayList<Map<String, Object>>() : customMenuItems;
|
||||
|
||||
if (contextMenuOptions.hideDefaultSystemContextMenuItems == null || !contextMenuOptions.hideDefaultSystemContextMenuItems) {
|
||||
for (int i = 0; i < actionMenu.size(); i++) {
|
||||
final MenuItem menuItem = actionMenu.getItem(i);
|
||||
for (final MenuItem menuItem : defaultMenuItems) {
|
||||
final int itemId = menuItem.getItemId();
|
||||
final String itemTitle = menuItem.getTitle().toString();
|
||||
|
||||
|
@ -1457,7 +1463,6 @@ final public class InAppWebView extends InputAwareWebView implements InAppWebVie
|
|||
checkContextMenuShouldBeClosedTask.run();
|
||||
}
|
||||
}
|
||||
actionMenu.clear();
|
||||
|
||||
return actionMode;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_inappwebview
|
||||
description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window.
|
||||
version: 5.4.1
|
||||
version: 5.4.1+1
|
||||
homepage: https://github.com/pichillilorenzo/flutter_inappwebview
|
||||
|
||||
environment:
|
||||
|
|
Loading…
Reference in New Issue