Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 40D5D1056F for ; Thu, 16 Jan 2014 21:56:03 +0000 (UTC) Received: (qmail 3998 invoked by uid 500); 16 Jan 2014 21:56:02 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 3975 invoked by uid 500); 16 Jan 2014 21:56:02 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 3968 invoked by uid 99); 16 Jan 2014 21:56:02 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jan 2014 21:56:02 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 5A7BD52851; Thu, 16 Jan 2014 21:56:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bowserj@apache.org To: commits@cordova.apache.org Message-Id: <05c92f51fdb7495c86abe25b34339aae@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: Didn't test on ICS or lower, getDrawable isn't supported until Jellybean Date: Thu, 16 Jan 2014 21:56:02 +0000 (UTC) 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 Authored: Thu Jan 16 13:55:53 2014 -0800 Committer: Joe Bowser 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();