You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/06/20 19:24:06 UTC

[2/2] git commit: Switch to using cordova-android 4.0.x branch

Switch to using cordova-android 4.0.x branch


Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/4eedf4d1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/4eedf4d1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/4eedf4d1

Branch: refs/heads/master
Commit: 4eedf4d1ddcad774fa6514148ba3ef982d13123d
Parents: 48ac896
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 20 13:18:15 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 20 13:23:59 2014 -0400

----------------------------------------------------------------------
 AppHarnessUI/AppHarnessUI.java | 17 +++++++----------
 createproject.sh               |  8 +++++++-
 2 files changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/4eedf4d1/AppHarnessUI/AppHarnessUI.java
----------------------------------------------------------------------
diff --git a/AppHarnessUI/AppHarnessUI.java b/AppHarnessUI/AppHarnessUI.java
index 588109f..bc0db41 100644
--- a/AppHarnessUI/AppHarnessUI.java
+++ b/AppHarnessUI/AppHarnessUI.java
@@ -18,12 +18,13 @@
 */
 package org.apache.appharness;
 
+import org.apache.cordova.AndroidChromeClient;
+import org.apache.cordova.AndroidWebView;
 import org.apache.cordova.CallbackContext;
 import org.apache.cordova.CordovaActivity;
 import org.apache.cordova.CordovaArgs;
 import org.apache.cordova.CordovaChromeClient;
 import org.apache.cordova.CordovaPlugin;
-import org.apache.cordova.CordovaWebView;
 import org.apache.cordova.CordovaWebViewClient;
 import org.apache.cordova.IceCreamCordovaWebViewClient;
 import org.apache.cordova.LinearLayoutSoftKeyboardDetect;
@@ -121,7 +122,7 @@ public class AppHarnessUI extends CordovaPlugin {
             slaveWebView = new CustomCordovaWebView(activity);
             initWebView(slaveWebView);
             if (activity.getBooleanProperty("DisallowOverscroll", false)) {
-                slaveWebView.setOverScrollMode(CordovaWebView.OVER_SCROLL_NEVER);
+                slaveWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
             }
             slaveWebView.clearCache(true);
             slaveWebView.clearHistory();
@@ -180,7 +181,7 @@ public class AppHarnessUI extends CordovaPlugin {
         }
     }
 
-    private void initWebView(final CordovaWebView newWebView) {
+    private void initWebView(final AndroidWebView newWebView) {
         CordovaActivity activity = (CordovaActivity)cordova.getActivity();
         if (contentView == null) {
             contentView = (ViewGroup)activity.findViewById(android.R.id.content);
@@ -193,12 +194,8 @@ public class AppHarnessUI extends CordovaPlugin {
 //        layoutView.setBackground(origRootView.getBackground());
         layoutView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.BOTTOM | Gravity.LEFT));
 
-        if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
-            newWebView.setWebViewClient(new CordovaWebViewClient(cordova, newWebView));
-        } else {
-            newWebView.setWebViewClient(new IceCreamCordovaWebViewClient(cordova, newWebView));
-        }
-        newWebView.setWebChromeClient(new CordovaChromeClient(cordova, newWebView));
+        newWebView.setWebViewClient((CordovaWebViewClient)new IceCreamCordovaWebViewClient(cordova, newWebView));
+        newWebView.setWebChromeClient((CordovaChromeClient)new AndroidChromeClient(cordova, newWebView));
 
         newWebView.setLayoutParams(new LinearLayout.LayoutParams(
                 ViewGroup.LayoutParams.MATCH_PARENT,
@@ -247,7 +244,7 @@ public class AppHarnessUI extends CordovaPlugin {
 
     }
 
-    private class CustomCordovaWebView extends CordovaWebView {
+    private class CustomCordovaWebView extends AndroidWebView {
         TwoFingerDoubleTapGestureDetector twoFingerTapDetector;
         boolean stealTapEvents;
 

http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/4eedf4d1/createproject.sh
----------------------------------------------------------------------
diff --git a/createproject.sh b/createproject.sh
index 9eabd5c..accb639 100755
--- a/createproject.sh
+++ b/createproject.sh
@@ -26,6 +26,7 @@ if [[ $# -eq 0 || "$1" = "--help" ]]; then
     echo '  APP_ID="org.apache.AppHarness"'
     echo '  APP_NAME="CordovaAppHarness"'
     echo '  APP_VERSION="0.0.1"'
+    echo '  ANDROID_PATH="path/to/cordova-android"'
     exit 1
 fi
 
@@ -57,6 +58,7 @@ if [[ -n "$COHO_PATH" ]]; then
     CDV_PATH="$(dirname $(dirname "$COHO_PATH"))"
     AddSearchPathIfExists "$CDV_PATH"
     AddSearchPathIfExists "$CDV_PATH/cordova-plugins"
+    ANDROID_PATH=${ANDROID_PATH-$CDV_PATH/cordova-android}
 else
     # For when repos are cloned as siblings.
     AddSearchPathIfExists "$(dirname "$AH_PATH")"
@@ -81,9 +83,13 @@ perl -i -pe "s/{ID}/$APP_ID/g" config.xml || exit 1
 perl -i -pe "s/{NAME}/$APP_NAME/g" config.xml || exit 1
 perl -i -pe "s/{VERSION}/$APP_VERSION/g" config.xml || exit 1
 
+PLATFORM_ARGS="$PLATFORMS"
+if [[ -n "$ANDROID_PATH" ]]; then
+  PLATFORM_ARGS="${PLATFORMS/android/$ANDROID_PATH}"
+fi
 
 set -x
-$CORDOVA platform add $PLATFORMS || exit 1
+$CORDOVA platform add $PLATFORM_ARGS || exit 1
 set +x
 
 # if [[ $PLATFORMS = *ios* ]]; then