Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
/pluginsPublic archive

Implement Android WebView api with pigeon (Java portion)#4441

Merged
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
java portion
  • Loading branch information
@bparrishMines
bparrishMines committedOct 21, 2021
commita9b6fa2db8ca3fff8c547c29d2c07077ed921dfd
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,10 @@ android {
testImplementation 'androidx.test:core:1.3.0'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

testOptions {
unitTests.includeAndroidResources = true
Expand Down
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package io.flutter.plugins.webviewflutter;

import android.webkit.DownloadListener;
import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.DownloadListenerFlutterApi;

class DownloadListenerHostApiImpl implements GeneratedAndroidWebView.DownloadListenerHostApi {
private final InstanceManager instanceManager;
private final DownloadListenerCreator downloadListenerCreator;
private final GeneratedAndroidWebView.DownloadListenerFlutterApi downloadListenerFlutterApi;

static class DownloadListenerCreator {
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Creator inner classes are used to make it easier to test constructors

DownloadListener createDownloadListener(
Long instanceId, DownloadListenerFlutterApi downloadListenerFlutterApi) {
return (url, userAgent, contentDisposition, mimetype, contentLength) ->
downloadListenerFlutterApi.onDownloadStart(
instanceId, url, userAgent, contentDisposition, mimetype, contentLength, reply -> {});
}
}

DownloadListenerHostApiImpl(
InstanceManager instanceManager,
DownloadListenerCreator downloadListenerCreator,
DownloadListenerFlutterApi downloadListenerFlutterApi) {
this.instanceManager = instanceManager;
this.downloadListenerCreator = downloadListenerCreator;
this.downloadListenerFlutterApi = downloadListenerFlutterApi;
}

@Override
public void create(Long instanceId) {
final DownloadListener downloadListener =
downloadListenerCreator.createDownloadListener(instanceId, downloadListenerFlutterApi);
instanceManager.addInstance(downloadListener, instanceId);
}

@Override
public void dispose(Long instanceId) {
instanceManager.removeInstanceId(instanceId);
}
}
Original file line numberDiff line numberDiff line change
Expand Up@@ -104,7 +104,7 @@ boolean shouldOverrideUrlLoading(WebView view, String url) {
return false;
}
// This version of shouldOverrideUrlLoading is only invoked by the webview on devices with
// webview versionsearlier than 67(it is also invoked when hasNavigationDelegate is false).
// webview versions earlier than 67(it is also invoked when hasNavigationDelegate is false).
// On these devices we cannot tell whether the navigation is targeted to the main frame or not.
// We proceed assuming that the navigation is targeted to the main frame. If the page had any
// frames they will be loaded in the main frame instead.
Expand Down
Loading

[8]ページ先頭

©2009-2026 Movatter.jp