Java Code Examples for com.tencent.smtt.sdk.ValueCallback#onReceiveValue()

The following examples show how to use com.tencent.smtt.sdk.ValueCallback#onReceiveValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AgentWebX5Config.java    From AgentWebX5 with Apache License 2.0 6 votes vote down vote up
public static void removeSessionCookies(ValueCallback<Boolean> callback) {

        if (callback == null)
            callback = getDefaultIgnoreCallback();
        if (CookieManager.getInstance() == null) {
            callback.onReceiveValue(new Boolean(false));
            return;
        }
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            CookieManager.getInstance().removeSessionCookie();
            toSyncCookies();
            callback.onReceiveValue(new Boolean(true));
            return;
        }
        CookieManager.getInstance().removeSessionCookies(callback);
        toSyncCookies();

    }
 
Example 2
Source File: DefaultChromeClient.java    From AgentWebX5 with Apache License 2.0 6 votes vote down vote up
private void openFileChooserAboveL(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) {


        Activity mActivity = this.mActivityWeakReference.get();
        if (mActivity == null||mActivity.isFinishing()){
            filePathCallback.onReceiveValue(new Uri[]{});
            return;
        }
        IFileUploadChooser mIFileUploadChooser = this.mIFileUploadChooser;
        this.mIFileUploadChooser = mIFileUploadChooser = new FileUpLoadChooserImpl.Builder()
                .setWebView(webView)
                .setActivity(mActivity)
                .setUriValueCallbacks(filePathCallback)
                .setFileChooserParams(fileChooserParams)
                .setFileUploadMsgConfig(mChromeClientMsgCfg.getFileUploadMsgConfig())
                .setPermissionInterceptor(this.mPermissionInterceptor)
                .build();
        mIFileUploadChooser.openFileChooser();

    }
 
Example 3
Source File: DefaultChromeClient.java    From AgentWebX5 with Apache License 2.0 6 votes vote down vote up
private void createAndOpenCommonFileLoader(ValueCallback valueCallback) {
    Activity mActivity = this.mActivityWeakReference.get();
    if (mActivity == null||mActivity.isFinishing()){
        valueCallback.onReceiveValue(new Object());
        return;
    }
    this.mIFileUploadChooser = new FileUpLoadChooserImpl.Builder()
            .setWebView(this.mWebView)
            .setActivity(mActivity)
            .setUriValueCallback(valueCallback)
            .setFileUploadMsgConfig(mChromeClientMsgCfg.getFileUploadMsgConfig())
            .setPermissionInterceptor(this.mPermissionInterceptor)
            .build();
    this.mIFileUploadChooser.openFileChooser();

}
 
Example 4
Source File: AgentWebX5Config.java    From AgentWebX5 with Apache License 2.0 5 votes vote down vote up
public static void removeAllCookies(@Nullable ValueCallback<Boolean> callback) {

        if (callback == null)
            callback = getDefaultIgnoreCallback();
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            CookieManager.getInstance().removeAllCookie();
            toSyncCookies();
            callback.onReceiveValue(!CookieManager.getInstance().hasCookies());
            return;
        }
        CookieManager.getInstance().removeAllCookies(callback);
        toSyncCookies();
    }
 
Example 5
Source File: CBrowserMainFrame.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
public WebViewSdkCompat.ValueCallback<Uri> getCompatCallback(final ValueCallback<Uri> uploadMsg){
    return new WebViewSdkCompat.ValueCallback<Uri>() {
        @Override
        public void onReceiveValue(Uri uri) {
            uploadMsg.onReceiveValue(uri);
        }
    };
}