diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..70fac823 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: lorenzo_pichilli # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: ['https://www.paypal.me/LorenzoPichilli'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md new file mode 100644 index 00000000..c3f6d96c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Something is crashing or not working as intended + +--- + +## Environment + +**App version:** +**Android version:** +**Device information:** + +## Description + +**Expected behavior:** + +**Current behavior:** + +## Steps to reproduce + +1. This +2. Than that +3. Then + +## Images + +## Stacktrace/Logcat diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md new file mode 100644 index 00000000..21c98627 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + +## Environment + +**App version:** +**Android version:** +**Device information:** + +## Description + +**What you'd like to happen:** + +**Alternatives you've considered:** + +**Images:** diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..1c48f84c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,25 @@ +## Connection with issue(s) + +Resolve issue #??? + + + +Connected to #??? + + + +## Testing and Review Notes + + + + +## Screenshots or Videos + + + +## To Do + + +- [ ] double check the original issue to confirm it is fully satisfied +- [ ] add testing notes and screenshots in PR description to help guide reviewers +- [ ] request the "UX" team perform a design review (if/when applicable) diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java index a2ae78bf..9092ff08 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java @@ -229,4 +229,11 @@ public class FlutterWebView implements PlatformView, MethodCallHandler { webView.loadUrl("about:blank"); } } + + @Override + public void onInputConnectionLocked() {} + + @Override + public void onInputConnectionUnlocked() {} + } \ No newline at end of file diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java index 1d81944a..d5b9129d 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java @@ -298,19 +298,27 @@ public class InAppWebView extends WebView { } public byte[] takeScreenshot() { - Picture picture = capturePicture(); + float scale = getScale(); + int height = (int) (getContentHeight() * scale + 0.5); + Bitmap b = Bitmap.createBitmap( getWidth(), - getHeight(), Bitmap.Config.ARGB_8888); + height, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); - picture.draw(c); + draw(c); + int scrollOffset = (getScrollY() + getMeasuredHeight() > b.getHeight()) + ? b.getHeight() : getScrollY(); + Bitmap resized = Bitmap.createBitmap( + b, 0, scrollOffset, b.getWidth(), getMeasuredHeight()); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - b.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); + resized.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); try { byteArrayOutputStream.close(); } catch (IOException e) { e.printStackTrace(); } + resized.recycle(); return byteArrayOutputStream.toByteArray(); } diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/JavaScriptBridgeInterface.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/JavaScriptBridgeInterface.java index 9f404803..415fb134 100644 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/JavaScriptBridgeInterface.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/JavaScriptBridgeInterface.java @@ -51,6 +51,10 @@ public class JavaScriptBridgeInterface { getChannel().invokeMethod("onCallJsHandler", obj, new MethodChannel.Result() { @Override public void success(Object json) { + if (flutterWebView.webView == null) { + // The webview has already been disposed, ignore. + return; + } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { flutterWebView.webView.evaluateJavascript("window." + name + "[" + _callHandlerID + "](" + json + "); delete window." + name + "[" + _callHandlerID + "];", null); } diff --git a/android/src/main/res/menu/menu_main.xml b/android/src/main/res/menu/menu_main.xml index 798214bc..88f44d66 100644 --- a/android/src/main/res/menu/menu_main.xml +++ b/android/src/main/res/menu/menu_main.xml @@ -1,7 +1,7 @@