cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-9148) Add support for file picker in InAppBrowser
Date Tue, 03 Jan 2017 18:09:59 GMT

    [ https://issues.apache.org/jira/browse/CB-9148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15795693#comment-15795693
] 

ASF GitHub Bot commented on CB-9148:
------------------------------------

Github user infil00p commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-inappbrowser/pull/205#discussion_r94452072
  
    --- Diff: src/android/InAppBrowser.java ---
    @@ -722,7 +729,57 @@ public void onClick(View v) {
                     inAppWebView = new WebView(cordova.getActivity());
                     inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
                     inAppWebView.setId(Integer.valueOf(6));
    -                inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
    +                // File Chooser Implemented ChromeClient
    +                inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
    +                    // For Android 5.0+
    +                    public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]>
filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
    +                    {
    +                        Log.d(LOG_TAG, "File Chooser 5.0+");
    +                        // If callback exists, finish it.
    +                        if(mUploadCallbackLollipop != null) {
    +                            mUploadCallbackLollipop.onReceiveValue(null);
    +                        }
    +                        mUploadCallbackLollipop = filePathCallback;
    +
    +                        // Create File Chooser Intent
    +                        Intent content = new Intent(Intent.ACTION_GET_CONTENT);
    +                        content.addCategory(Intent.CATEGORY_OPENABLE);
    +                        content.setType("*/*");
    +
    +                        // [important] Register ActvityResultCallback on Cordova
    +                        cordova.setActivityResultCallback(InAppBrowser.this);
    +                        cordova.getActivity().startActivityForResult(content, FILECHOOSER_REQUESTCODE_LOLLIPOP);
    +                        return true;
    +                    }
    +
    +                    // For Android 4.1+
    +                    public void openFileChooser(ValueCallback<Uri> uploadMsg, String
acceptType, String capture)
    +                    {
    +                        Log.d(LOG_TAG, "File Chooser 4.1+");
    +                        // Call file chooser for Android 3.0+
    +                        openFileChooser(uploadMsg, acceptType);
    +                    }
    +
    +                    // For Android 3.0+
    +                    public void openFileChooser(ValueCallback<Uri> uploadMsg, String
acceptType)
    +                    {
    +                        Log.d(LOG_TAG, "File Chooser 3.0+");
    +                        mUploadCallback = uploadMsg;
    +                        Intent i = new Intent(Intent.ACTION_GET_CONTENT);
    +                        i.addCategory(Intent.CATEGORY_OPENABLE);
    +
    +                        cordova.setActivityResultCallback(InAppBrowser.this);
    +                        cordova.getActivity().startActivityForResult( Intent.createChooser(i,
"File Chooser"), FILECHOOSER_REQUESTCODE);
    +                    }
    +
    +                    // For Android < 3.0
    +                    public void openFileChooser(ValueCallback<Uri> uploadMsg) {
    +                        Log.d(LOG_TAG, "File Chooser 3.0 <");
    +                        // Call file chooser for Android 3.0+
    +                        openFileChooser(uploadMsg, "");
    +                    }
    +
    --- End diff --
    
    Why does this need to be here? We do not support any versions of Android below Android
4.1, so this would never be called.


> Add support for file picker in InAppBrowser
> -------------------------------------------
>
>                 Key: CB-9148
>                 URL: https://issues.apache.org/jira/browse/CB-9148
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Plugin InAppBrowser
>    Affects Versions: 3.5.0, 3.6.0
>         Environment: problem in Android, the camera roll never opens  (iOS working OK)
>            Reporter: Tomas Rawski
>              Labels: Android, camera, file, input, roll, triaged
>
> reproduce : 
> open the inAppBrowser: http://www.plupload.com/examples
> click in Add files.
> This works ok when I call it from the _system or _self. But not for _blank.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message