Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 37CAA200B50 for ; Thu, 14 Jul 2016 17:00:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 36E09160A63; Thu, 14 Jul 2016 15:00:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3A8F4160A60 for ; Thu, 14 Jul 2016 17:00:30 +0200 (CEST) Received: (qmail 67199 invoked by uid 500); 14 Jul 2016 15:00:24 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 67171 invoked by uid 99); 14 Jul 2016 15:00:24 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2016 15:00:24 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 34E3F2C02A1 for ; Thu, 14 Jul 2016 15:00:24 +0000 (UTC) Date: Thu, 14 Jul 2016 15:00:24 +0000 (UTC) From: "Andrew (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CB-11578) InAppBrowser doesn't open on Android 4.0.4 (regression) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 14 Jul 2016 15:00:31 -0000 [ https://issues.apache.org/jira/browse/CB-11578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andrew updated CB-11578: ------------------------ Description: Some changes made as part of the 1.4.0 release prevent the InAppBrowser from opening on my Android 4.0.4 test device. I traced the problem to some code that appears to have been refactored/removed when it shouldn't have been (setBackground/setBackgroundDrawable calls) and a call to getAdjustViewBounds which doesn't appear to serve any purpose but it is a method that was only made available at API level 16 (Jelly Bean). I made the following changes to the latest code in the repository to fix this problem: {noformat} diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 30915dc..f1e8222 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -579,11 +579,18 @@ 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(null); + + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) + { + back.setBackgroundDrawable(null); + } + else + { + back.setBackground(null); + } back.setImageDrawable(backIcon); back.setScaleType(ImageView.ScaleType.FIT_CENTER); back.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10)); - back.getAdjustViewBounds(); back.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -600,11 +607,18 @@ public class InAppBrowser extends CordovaPlugin { forward.setId(Integer.valueOf(3)); int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName()); Drawable fwdIcon = activityRes.getDrawable(fwdResId); - forward.setBackground(null); + + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) + { + forward.setBackgroundDrawable(null); + } + else + { + forward.setBackground(null); + } forward.setImageDrawable(fwdIcon); forward.setScaleType(ImageView.ScaleType.FIT_CENTER); forward.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10)); - forward.getAdjustViewBounds(); forward.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -644,11 +658,18 @@ public class InAppBrowser extends CordovaPlugin { close.setId(Integer.valueOf(5)); int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName()); Drawable closeIcon = activityRes.getDrawable(closeResId); - close.setBackground(null); + + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) + { + close.setBackgroundDrawable(null); + } + else + { + close.setBackground(null); + } close.setImageDrawable(closeIcon); close.setScaleType(ImageView.ScaleType.FIT_CENTER); back.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10)); - close.getAdjustViewBounds(); close.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { {noformat} was: Some changes made as part of the 1.4.0 release prevent the InAppBrowser from opening on my Android 4.0.4 test device. I traced the problem to some code that appears to have been refactored/removed when it shouldn't have been (setBackground/setBackgroundDrawable calls) and a call to getAdjustViewBounds which doesn't appear to serve any purpose but it is a method that was only made available at API level 16 (Jelly Bean). I made the following changes to the latest code in the repository to fix this problem: diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 30915dc..f1e8222 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -579,11 +579,18 @@ 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(null); + + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) + { + back.setBackgroundDrawable(null); + } + else + { + back.setBackground(null); + } back.setImageDrawable(backIcon); back.setScaleType(ImageView.ScaleType.FIT_CENTER); back.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10)); - back.getAdjustViewBounds(); back.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -600,11 +607,18 @@ public class InAppBrowser extends CordovaPlugin { forward.setId(Integer.valueOf(3)); int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName()); Drawable fwdIcon = activityRes.getDrawable(fwdResId); - forward.setBackground(null); + + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) + { + forward.setBackgroundDrawable(null); + } + else + { + forward.setBackground(null); + } forward.setImageDrawable(fwdIcon); forward.setScaleType(ImageView.ScaleType.FIT_CENTER); forward.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10)); - forward.getAdjustViewBounds(); forward.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -644,11 +658,18 @@ public class InAppBrowser extends CordovaPlugin { close.setId(Integer.valueOf(5)); int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName()); Drawable closeIcon = activityRes.getDrawable(closeResId); - close.setBackground(null); + + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) + { + close.setBackgroundDrawable(null); + } + else + { + close.setBackground(null); + } close.setImageDrawable(closeIcon); close.setScaleType(ImageView.ScaleType.FIT_CENTER); back.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10)); - close.getAdjustViewBounds(); close.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { > InAppBrowser doesn't open on Android 4.0.4 (regression) > ------------------------------------------------------- > > Key: CB-11578 > URL: https://issues.apache.org/jira/browse/CB-11578 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin InAppBrowser > Affects Versions: 1.4.0 > Environment: Likely affects all pre-Jelly Bean Android devices. Tested on Android 4.0.4 with a Samsung Galaxy phone (Samsung-SGH-I437). > Reporter: Andrew > > Some changes made as part of the 1.4.0 release prevent the InAppBrowser from opening on my Android 4.0.4 test device. I traced the problem to some code that appears to have been refactored/removed when it shouldn't have been (setBackground/setBackgroundDrawable calls) and a call to getAdjustViewBounds which doesn't appear to serve any purpose but it is a method that was only made available at API level 16 (Jelly Bean). > I made the following changes to the latest code in the repository to fix this problem: > {noformat} > diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java > index 30915dc..f1e8222 100644 > --- a/src/android/InAppBrowser.java > +++ b/src/android/InAppBrowser.java > @@ -579,11 +579,18 @@ 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(null); > + > + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) > + { > + back.setBackgroundDrawable(null); > + } > + else > + { > + back.setBackground(null); > + } > back.setImageDrawable(backIcon); > back.setScaleType(ImageView.ScaleType.FIT_CENTER); > back.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10)); > - back.getAdjustViewBounds(); > > back.setOnClickListener(new View.OnClickListener() { > public void onClick(View v) { > @@ -600,11 +607,18 @@ public class InAppBrowser extends CordovaPlugin { > forward.setId(Integer.valueOf(3)); > int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName()); > Drawable fwdIcon = activityRes.getDrawable(fwdResId); > - forward.setBackground(null); > + > + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) > + { > + forward.setBackgroundDrawable(null); > + } > + else > + { > + forward.setBackground(null); > + } > forward.setImageDrawable(fwdIcon); > forward.setScaleType(ImageView.ScaleType.FIT_CENTER); > forward.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10)); > - forward.getAdjustViewBounds(); > > forward.setOnClickListener(new View.OnClickListener() { > public void onClick(View v) { > @@ -644,11 +658,18 @@ public class InAppBrowser extends CordovaPlugin { > close.setId(Integer.valueOf(5)); > int closeResId = activityRes.getIdentifier("ic_action_remove", "drawable", cordova.getActivity().getPackageName()); > Drawable closeIcon = activityRes.getDrawable(closeResId); > - close.setBackground(null); > + > + if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) > + { > + close.setBackgroundDrawable(null); > + } > + else > + { > + close.setBackground(null); > + } > close.setImageDrawable(closeIcon); > close.setScaleType(ImageView.ScaleType.FIT_CENTER); > back.setPadding(0, this.dpToPixels(10), 0, this.dpToPixels(10)); > - close.getAdjustViewBounds(); > > close.setOnClickListener(new View.OnClickListener() { > public void onClick(View v) { > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org