This commit is contained in:
Joe Bowser 2012-01-25 11:41:24 -08:00
commit 9206dca741
9 changed files with 88 additions and 39 deletions

View File

@ -19,6 +19,16 @@ Requires
- Apache ANT
- Android SDK [http://developer.android.com](http://developer.android.com)
Building
---
To create your phonegap.jar, run in the framework directory:
android update project -p . -t android-15
ant jar
Cordova Android Developer Tools
---

Binary file not shown.

View File

@ -1,6 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<phonegap>
<access origin="http://127.0.0.1*"/>
<!--
access elements control the Android whitelist.
Domains are assumed blocked unless set otherwise
-->
<access origin="http://127.0.0.1*"/> <!-- allow local pages -->
<!-- <access origin="https://example.com" /> allow any secure requests to example.com -->
<!-- <access origin="https://example.com" subdomains="true" /> such as above, but including subdomains, such as www -->
<!-- <access origin=".*"/> Allow all domains, suggested development use only -->
<log level="DEBUG"/>
<preference name="classicRender" value="true" />
</phonegap>

1
framework/res/xml/plugins.xml Normal file → Executable file
View File

@ -16,5 +16,4 @@
<plugin name="FileTransfer" value="com.phonegap.FileTransfer"/>
<plugin name="Capture" value="com.phonegap.Capture"/>
<plugin name="Battery" value="com.phonegap.BatteryListener"/>
<plugin name="Keyboard" value="com.phonegap.KeyboardHandler" />
</plugins>

22
framework/src/com/phonegap/CordovaChromeClient.java Normal file → Executable file
View File

@ -1,3 +1,21 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package com.phonegap;
import org.json.JSONArray;
import org.json.JSONException;
@ -18,7 +36,9 @@ import android.webkit.WebView;
import android.webkit.GeolocationPermissions.Callback;
import android.widget.EditText;
/**
* This class is the WebChromeClient that implements callbacks for our web view.
*/
public class CordovaChromeClient extends WebChromeClient {

21
framework/src/com/phonegap/CordovaWebViewClient.java Normal file → Executable file
View File

@ -1,3 +1,21 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package com.phonegap;
import com.phonegap.api.LOG;
@ -15,6 +33,9 @@ import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;
/**
* This class is the WebViewClient that implements callbacks for our web view.
*/
public class CordovaWebViewClient extends WebViewClient {
private static final String TAG = "Cordova";

View File

@ -54,7 +54,7 @@ import com.phonegap.api.PluginResult;
public class FileTransfer extends Plugin {
private static final String LOG_TAG = "FileUploader";
private static final String LOG_TAG = "FileTransfer";
private static final String LINE_START = "--";
private static final String LINE_END = "\r\n";
private static final String BOUNDRY = "*****";
@ -386,7 +386,6 @@ public class FileTransfer extends Plugin {
URL url = new URL(source);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.connect();
Log.d(LOG_TAG, "Download file:" + url);

View File

@ -1,33 +0,0 @@
package com.phonegap;
import org.json.JSONArray;
import com.phonegap.api.Plugin;
import com.phonegap.api.PluginResult;
public class KeyboardHandler extends Plugin {
/*
* This will never be called!
* (non-Javadoc)
* @see com.phonegap.api.Plugin#execute(java.lang.String, org.json.JSONArray, java.lang.String)
*/
@Override
public PluginResult execute(String action, JSONArray args, String callbackId) {
// TODO Auto-generated method stub
return null;
}
public void onMessage(String id, Object data)
{
if(id.equals("keyboardHidden"))
{
super.sendJavascript("PhoneGap.fireDocumentEvent('hidekeyboard');");
}
else if(id.equals("keyboardVisible"))
{
super.sendJavascript("PhoneGap.fireDocumentEvent('showkeyboard');");
}
}
}

View File

@ -1,3 +1,21 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package com.phonegap;
import com.phonegap.api.LOG;
@ -5,7 +23,9 @@ import android.content.Context;
import android.view.View.MeasureSpec;
import android.widget.LinearLayout;
/**
* This class is used to detect when the soft keyboard is shown and hidden in the web view.
*/
public class LinearLayoutSoftKeyboardDetect extends LinearLayout {
private static final String TAG = "SoftKeyboardDetect";