package com.howeyc.spiped;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebChromeClient;

import go.Go;
import go.spipedmobile.Spipedmobile;


public class MyActivity extends Activity {

    WebView browser;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.web_view);

        //Magic
        Go.init(getApplicationContext());

        Spipedmobile.Start();

        browser = (WebView)findViewById(R.id.browser);
        browser.getSettings().setJavaScriptEnabled(true);
        browser.setWebViewClient(new WebViewClient());
        browser.setWebChromeClient(new WebChromeClient());
        browser.loadUrl("http://localhost:56056");
    }
}

@@ -184,16 +184,109 @@
 lient;%0A%0A
+import android.webkit.ValueCallback;%0Aimport android.net.Uri;%0Aimport android.content.Intent;%0A%0A
 import g
@@ -404,477 +404,2451 @@
     
-@Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView(R.layout.web_view);%0A%0A        //Magic%0A        Go.init(getApplicationContext());%0A%0A        Spipedmobile.Start();%0A%0A        browser = (WebView)findViewById(R.id.browser);%0A        browser.getSettings().setJavaScriptEnabled(true);%0A        browser.setWebViewClient(new WebViewClient());%0A        browser.setWebChromeClient(new WebChromeClient()
+private ValueCallback%3CUri%3E mUploadMessage;  %0A    private final static int FILECHOOSER_RESULTCODE=1;%0A%0A    @Override  %0A    protected void onActivityResult(int requestCode, int resultCode, Intent intent) %7B  %0A        if(requestCode==FILECHOOSER_RESULTCODE)%0A        %7B  %0A            if (null == mUploadMessage) return;  %0A            Uri result = intent == null %7C%7C resultCode != RESULT_OK ? null : intent.getData();  %0A            mUploadMessage.onReceiveValue(result);  %0A            mUploadMessage = null;  %0A        %7D%0A    %7D%0A%0A    @Override%0A    protected void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView(R.layout.web_view);%0A%0A        //Magic%0A        Go.init(getApplicationContext());%0A%0A        Spipedmobile.Start();%0A%0A        browser = (WebView)findViewById(R.id.browser);%0A        browser.getSettings().setJavaScriptEnabled(true);%0A        browser.setWebViewClient(new WebViewClient());%0A        browser.setWebChromeClient(new WebChromeClient()%0A        %7B%0A        //The undocumented magic method override  %0A        //Eclipse will swear at you if you try to put @Override here  %0A        // For Android 3.0+%0A        public void openFileChooser(ValueCallback%3CUri%3E uploadMsg) %7B  %0A            mUploadMessage = uploadMsg;  %0A            Intent i = new Intent(Intent.ACTION_GET_CONTENT);  %0A            i.addCategory(Intent.CATEGORY_OPENABLE);  %0A            i.setType(%22*/*%22);  %0A            MyActivity.this.startActivityForResult(Intent.createChooser(i,%22File Chooser%22), FILECHOOSER_RESULTCODE);  %0A        %7D%0A%0A        // For Android 3.0+%0A        public void openFileChooser(ValueCallback uploadMsg, String acceptType) %7B%0A            mUploadMessage = uploadMsg;%0A            Intent i = new Intent(Intent.ACTION_GET_CONTENT);%0A            i.addCategory(Intent.CATEGORY_OPENABLE);%0A            i.setType(%22*/*%22);%0A            MyActivity.this.startActivityForResult(Intent.createChooser(i, %22File Browser%22), FILECHOOSER_RESULTCODE);%0A        %7D%0A%0A        //For Android 4.1%0A        public void openFileChooser(ValueCallback%3CUri%3E uploadMsg, String acceptType, String capture)%7B%0A            mUploadMessage = uploadMsg;  %0A            Intent i = new Intent(Intent.ACTION_GET_CONTENT);  %0A            i.addCategory(Intent.CATEGORY_OPENABLE);  %0A            i.setType(%22image/*%22);  %0A            MyActivity.this.startActivityForResult( Intent.createChooser( i, %22File Chooser%22 ), MyActivity.FILECHOOSER_RESULTCODE );%0A        %7D%0A        %7D
 );%0A 

Fix file select in web view.