当前位置: 首页>>代码示例>>Java>>正文


Java WebChromeClient.FileChooserParams方法代码示例

本文整理汇总了Java中android.webkit.WebChromeClient.FileChooserParams方法的典型用法代码示例。如果您正苦于以下问题:Java WebChromeClient.FileChooserParams方法的具体用法?Java WebChromeClient.FileChooserParams怎么用?Java WebChromeClient.FileChooserParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.webkit.WebChromeClient的用法示例。


在下文中一共展示了WebChromeClient.FileChooserParams方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onShowFileChooser

import android.webkit.WebChromeClient; //导入方法依赖的package包/类
public boolean onShowFileChooser(WebView view, ValueCallback<Uri[]> filePath, WebChromeClient.FileChooserParams fileChooserParams) {
    // Double check that we don't have any existing callbacks
    if (mFilePathCallback != null) {
        mFilePathCallback.onReceiveValue(null);
    }
    mFilePathCallback = filePath;

    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
        // Create the File where the photo should go
        File photoFile = null;
        try {
            photoFile = createImageFile();
            takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
        } catch (IOException ex) {
            // Error occurred while creating the File
            Log.e(TAG, "Unable to create Image File", ex);
        }

        // Continue only if the File was successfully created
        if (photoFile != null) {
            mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
            takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
                    Uri.fromFile(photoFile));
        } else {
            takePictureIntent = null;
        }
    }

    Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
    contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
    contentSelectionIntent.setType("*/*");

    Intent[] intentArray;
    if (takePictureIntent != null) {
        intentArray = new Intent[]{takePictureIntent};
    } else {
        intentArray = new Intent[0];
    }

    Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
    chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
    chooserIntent.putExtra(Intent.EXTRA_TITLE, "File Chooser");
    chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);

    startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE);

    return true;

}
 
开发者ID:ashutoshbsathe,项目名称:COEP-Moodle-via-Webview,代码行数:51,代码来源:Moodle.java

示例2: onShowFileChooser

import android.webkit.WebChromeClient; //导入方法依赖的package包/类
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
		WebChromeClient.FileChooserParams fileChooserParams) {
	mBrowserController.showFileChooser(filePathCallback);
	return true;
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:6,代码来源:LightningView.java

示例3: showFileChooser

import android.webkit.WebChromeClient; //导入方法依赖的package包/类
@Override
public void showFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
    setFilePathCallbacks(filePathCallback);
    String[] acceptTypes = new String[0];
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        acceptTypes = fileChooserParams.getAcceptTypes();
    }
    dealOpenFileChooser(acceptTypes.length > 0 ? acceptTypes[0] : "");
}
 
开发者ID:quickhybrid,项目名称:quickhybrid-android,代码行数:10,代码来源:FileChooser.java

示例4: onShowFileChooser

import android.webkit.WebChromeClient; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public boolean onShowFileChooser(WebView webView,
                                 ValueCallback<Uri[]> filePathCallback,
                                 WebChromeClient.FileChooserParams fileChooserParams) {
    openFileChooser(value -> {
        if (value == null) {
            filePathCallback.onReceiveValue(null);
        } else {
            filePathCallback.onReceiveValue(new Uri[]{value});
        }
    }, fileChooserParams.getAcceptTypes());
    return true;
}
 
开发者ID:hyb1996,项目名称:Auto.js,代码行数:15,代码来源:EWebView.java

示例5: onShowFileChooser

import android.webkit.WebChromeClient; //导入方法依赖的package包/类
@Override
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
                                 WebChromeClient.FileChooserParams fileChooserParams) {
    mUIController.showFileChooser(filePathCallback);
    return true;
}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:7,代码来源:LightningChromeClient.java

示例6: setFileChooserParams

import android.webkit.WebChromeClient; //导入方法依赖的package包/类
public Builder setFileChooserParams(WebChromeClient.FileChooserParams fileChooserParams) {
    mFileChooserParams = fileChooserParams;
    return this;
}
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:5,代码来源:FileUpLoadChooserImpl.java

示例7: openFileInput

import android.webkit.WebChromeClient; //导入方法依赖的package包/类
private boolean openFileInput(ValueCallback<Uri> uriCallback, ValueCallback<Uri[]> arrayCallback, WebChromeClient.FileChooserParams fileChooserParams, boolean allowMultiple) {
    if ((activity==null)&&(fragment==null))
        throw new NullPointerException("Must set an activity or a fragment!");
    assert activity != null;
    if (ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE)!=PackageManager.PERMISSION_GRANTED) {
        if (activity!=null) {
            ActivityCompat.requestPermissions(activity, new String[] {
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
                    Manifest.permission.READ_EXTERNAL_STORAGE
            }, PERMISSION_REQUEST);
        } else {
            fragment.requestPermissions(new String[] {
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
                    Manifest.permission.READ_EXTERNAL_STORAGE
            }, PERMISSION_REQUEST);
        }
        return false;
    }
    if (filePathCallback!=null) {
        filePathCallback.onReceiveValue(new Uri[]{});
        filePathCallback = null;
    }
    if (this.uriCallback!=null) {
        this.uriCallback.onReceiveValue(null);
        this.uriCallback = null;
    }
    Intent intent= new Intent();
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.setType("*/*");
    if (Build.VERSION.SDK_INT>=21) {
        if (fileChooserParams.getAcceptTypes()!=null)
            intent.putExtra(Intent.EXTRA_MIME_TYPES, fileChooserParams.getAcceptTypes());
    }
    if (allowMultiple) {
        if (Build.VERSION.SDK_INT >= 18) {
            intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
        }
    }
    if ((arrayCallback!=null) && (fileChooserParams!=null)) {
        this.filePathCallback = arrayCallback;
        this.uriCallback = null;
    } else if (uriCallback!=null) {
        this.filePathCallback = null;
        this.uriCallback = uriCallback;
    }
    String title = getResources().getString(R.string.file_picker);
    if (Build.VERSION.SDK_INT>=21) {
        try {
            title = fileChooserParams.getTitle().toString();
        } catch (Exception e) {
            Log.e(TAG, e.getMessage());
        }
    }
    if (activity!=null)
        activity.startActivityForResult(Intent.createChooser(intent, title), REQUEST_FILE);
    else if (fragment!=null)
        fragment.startActivityForResult(Intent.createChooser(intent, title), REQUEST_FILE);
    return true;
}
 
开发者ID:vic797,项目名称:prowebview,代码行数:62,代码来源:ProWebView.java

示例8: onShowFileChooser

import android.webkit.WebChromeClient; //导入方法依赖的package包/类
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
    mUploadCallbackAboveL = filePathCallback;
    openImageChooserActivity();
    return true;
}
 
开发者ID:JunGeges,项目名称:AliZhiBoHao,代码行数:6,代码来源:WebActivity.java

示例9: showFileChooser

import android.webkit.WebChromeClient; //导入方法依赖的package包/类
void showFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams); 
开发者ID:quickhybrid,项目名称:quickhybrid-android,代码行数:2,代码来源:IFileChooser.java


注:本文中的android.webkit.WebChromeClient.FileChooserParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。