當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。