cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject git commit: Didn't test on ICS or lower, getDrawable isn't supported until Jellybean
Date Thu, 16 Jan 2014 21:56:02 GMT
Updated Branches:
  refs/heads/dev 736c8ddec -> 0ce0eed58


Didn't test on ICS or lower, getDrawable isn't supported until Jellybean


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/0ce0eed5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/0ce0eed5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/0ce0eed5

Branch: refs/heads/dev
Commit: 0ce0eed585309ee2a9933bd93a58a56f60bf7fc2
Parents: 736c8dd
Author: Joe Bowser <bowserj@apache.org>
Authored: Thu Jan 16 13:55:53 2014 -0800
Committer: Joe Bowser <bowserj@apache.org>
Committed: Thu Jan 16 13:55:53 2014 -0800

----------------------------------------------------------------------
 src/android/InAppBrowser.java | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/0ce0eed5/src/android/InAppBrowser.java
----------------------------------------------------------------------
diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java
index 394e62b..4efd99b 100644
--- a/src/android/InAppBrowser.java
+++ b/src/android/InAppBrowser.java
@@ -27,7 +27,6 @@ import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
-import android.os.Build;
 import android.os.Bundle;
 import android.text.InputType;
 import android.util.Log;
@@ -254,16 +253,11 @@ public class InAppBrowser extends CordovaPlugin {
             scriptToInject = source;
         }
         final String finalScriptToInject = scriptToInject;
+        // This action will have the side-effect of blurring the currently focused element
         this.cordova.getActivity().runOnUiThread(new Runnable() {
-            @SuppressLint("NewApi")
             @Override
             public void run() {
-                if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
-                    // This action will have the side-effect of blurring the currently focused
element
-                    inAppWebView.loadUrl("javascript:" + finalScriptToInject);
-                } else {
-                    inAppWebView.evaluateJavascript(finalScriptToInject, null);
-                }
+                inAppWebView.loadUrl("javascript:" + finalScriptToInject);
             }
         });
     }
@@ -491,7 +485,14 @@ public class InAppBrowser extends CordovaPlugin {
                 Resources activityRes = cordova.getActivity().getResources();
                 int backResId = activityRes.getIdentifier("ic_action_previous_item", "drawable",
cordova.getActivity().getPackageName());
                 Drawable backIcon = activityRes.getDrawable(backResId);
-                back.setBackground(backIcon);
+                if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
+                {
+                    back.setBackgroundDrawable(backIcon);
+                }
+                else
+                {
+                    back.setBackground(backIcon);
+                }
                 back.setOnClickListener(new View.OnClickListener() {
                     public void onClick(View v) {
                         goBack();
@@ -508,7 +509,14 @@ public class InAppBrowser extends CordovaPlugin {
                 //forward.setText(">");
                 int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable",
cordova.getActivity().getPackageName());
                 Drawable fwdIcon = activityRes.getDrawable(fwdResId);
-                forward.setBackground(fwdIcon);
+                if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
+                {
+                    forward.setBackgroundDrawable(fwdIcon);
+                }
+                else
+                {
+                    forward.setBackground(fwdIcon);
+                }
                 forward.setOnClickListener(new View.OnClickListener() {
                     public void onClick(View v) {
                         goForward();
@@ -548,7 +556,14 @@ public class InAppBrowser extends CordovaPlugin {
                 //close.setText(buttonLabel);
                 int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable",
cordova.getActivity().getPackageName());
                 Drawable closeIcon = activityRes.getDrawable(closeResId);
-                close.setBackground(closeIcon);
+                if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN)
+                {
+                    close.setBackgroundDrawable(closeIcon);
+                }
+                else
+                {
+                    close.setBackground(closeIcon);
+                }
                 close.setOnClickListener(new View.OnClickListener() {
                     public void onClick(View v) {
                         closeDialog();


Mime
View raw message