You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2019/03/06 01:56:47 UTC

[cordova-plugin-inappbrowser] branch revert-353-patch-1 created (now 2f74d67)

This is an automated email from the ASF dual-hosted git repository.

purplecabbage pushed a change to branch revert-353-patch-1
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-inappbrowser.git.


      at 2f74d67  Revert "Add support for right to left direction languages"

This branch includes the following new commits:

     new 2f74d67  Revert "Add support for right to left direction languages"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[cordova-plugin-inappbrowser] 01/01: Revert "Add support for right to left direction languages"

Posted by pu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

purplecabbage pushed a commit to branch revert-353-patch-1
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-inappbrowser.git

commit 2f74d677b762357356280772e175fe28ddd22cce
Author: Jesse MacFadyen <pu...@gmail.com>
AuthorDate: Tue Mar 5 17:56:34 2019 -0800

    Revert "Add support for right to left direction languages"
---
 src/android/InAppBrowser.java | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java
index 6fc7a2d..895b543 100644
--- a/src/android/InAppBrowser.java
+++ b/src/android/InAppBrowser.java
@@ -85,8 +85,6 @@ import java.util.List;
 import java.util.HashMap;
 import java.util.StringTokenizer;
 
-import android.content.res.Configuration;
-
 @SuppressLint("SetJavaScriptEnabled")
 public class InAppBrowser extends CordovaPlugin {
 
@@ -747,10 +745,8 @@ public class InAppBrowser extends CordovaPlugin {
                     _close = close;
                 }
 
-                Configuration config = activityRes.getConfiguration();
-                boolean isLeftToRight = config.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;
                 RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
-                closeLayoutParams.addRule(isLeftToRight ? RelativeLayout.ALIGN_PARENT_RIGHT : RelativeLayout.ALIGN_PARENT_LEFT);
+                closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
                 _close.setLayoutParams(closeLayoutParams);
 
                 if (Build.VERSION.SDK_INT >= 16)
@@ -777,9 +773,6 @@ public class InAppBrowser extends CordovaPlugin {
                     dialog.dismiss();
                 };
 
-                Configuration config = cordova.getActivity().getResources().getConfiguration();
-                boolean isLeftToRight = config.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR;
-
                 // Let's create the main dialog
                 dialog = new InAppBrowserDialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
                 dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
@@ -797,25 +790,25 @@ public class InAppBrowser extends CordovaPlugin {
                 toolbar.setBackgroundColor(toolbarColor);
                 toolbar.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44)));
                 toolbar.setPadding(this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2));
-                toolbar.setHorizontalGravity(isLeftToRight ? Gravity.LEFT : Gravity.RIGHT);
+                toolbar.setHorizontalGravity(Gravity.LEFT);
                 toolbar.setVerticalGravity(Gravity.TOP);
 
                 // Action Button Container layout
                 RelativeLayout actionButtonContainer = new RelativeLayout(cordova.getActivity());
                 actionButtonContainer.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
-                actionButtonContainer.setHorizontalGravity(isLeftToRight ? Gravity.LEFT : Gravity.RIGHT);
+                actionButtonContainer.setHorizontalGravity(Gravity.LEFT);
                 actionButtonContainer.setVerticalGravity(Gravity.CENTER_VERTICAL);
                 actionButtonContainer.setId(Integer.valueOf(1));
 
                 // Back button
                 ImageButton back = new ImageButton(cordova.getActivity());
                 RelativeLayout.LayoutParams backLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
-                backLayoutParams.addRule(isLeftToRight ? RelativeLayout.ALIGN_LEFT : RelativeLayout.ALIGN_RIGHT);
+                backLayoutParams.addRule(RelativeLayout.ALIGN_LEFT);
                 back.setLayoutParams(backLayoutParams);
                 back.setContentDescription("Back Button");
                 back.setId(Integer.valueOf(2));
                 Resources activityRes = cordova.getActivity().getResources();
-                int backResId = activityRes.getIdentifier(isLeftToRight ? "ic_action_previous_item" : "ic_action_next_item", "drawable", cordova.getActivity().getPackageName());
+                int backResId = activityRes.getIdentifier("ic_action_previous_item", "drawable", cordova.getActivity().getPackageName());
                 Drawable backIcon = activityRes.getDrawable(backResId);
                 if (navigationButtonColor != "") back.setColorFilter(android.graphics.Color.parseColor(navigationButtonColor));
                 if (Build.VERSION.SDK_INT >= 16)
@@ -837,11 +830,11 @@ public class InAppBrowser extends CordovaPlugin {
                 // Forward button
                 ImageButton forward = new ImageButton(cordova.getActivity());
                 RelativeLayout.LayoutParams forwardLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
-                forwardLayoutParams.addRule(isLeftToRight ? RelativeLayout.RIGHT_OF : RelativeLayout.LEFT_OF, 2);
+                forwardLayoutParams.addRule(RelativeLayout.RIGHT_OF, 2);
                 forward.setLayoutParams(forwardLayoutParams);
                 forward.setContentDescription("Forward Button");
                 forward.setId(Integer.valueOf(3));
-                int fwdResId = activityRes.getIdentifier(isLeftToRight ? "ic_action_next_item" : "ic_action_previous_item", "drawable", cordova.getActivity().getPackageName());
+                int fwdResId = activityRes.getIdentifier("ic_action_next_item", "drawable", cordova.getActivity().getPackageName());
                 Drawable fwdIcon = activityRes.getDrawable(fwdResId);
                 if (navigationButtonColor != "") forward.setColorFilter(android.graphics.Color.parseColor(navigationButtonColor));
                 if (Build.VERSION.SDK_INT >= 16)
@@ -863,8 +856,8 @@ public class InAppBrowser extends CordovaPlugin {
                 // Edit Text Box
                 edittext = new EditText(cordova.getActivity());
                 RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
-                textLayoutParams.addRule(isLeftToRight ? RelativeLayout.RIGHT_OF : RelativeLayout.LEFT_OF, 1);
-                textLayoutParams.addRule(isLeftToRight ? RelativeLayout.LEFT_OF : RelativeLayout.RIGHT_OF, 5);
+                textLayoutParams.addRule(RelativeLayout.RIGHT_OF, 1);
+                textLayoutParams.addRule(RelativeLayout.LEFT_OF, 5);
                 edittext.setLayoutParams(textLayoutParams);
                 edittext.setId(Integer.valueOf(4));
                 edittext.setSingleLine(true);
@@ -901,7 +894,7 @@ public class InAppBrowser extends CordovaPlugin {
                 footerLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
                 footer.setLayoutParams(footerLayout);
                 if (closeButtonCaption != "") footer.setPadding(this.dpToPixels(8), this.dpToPixels(8), this.dpToPixels(8), this.dpToPixels(8));
-                footer.setHorizontalGravity(isLeftToRight ? Gravity.LEFT : Gravity.RIGHT);
+                footer.setHorizontalGravity(Gravity.LEFT);
                 footer.setVerticalGravity(Gravity.BOTTOM);
 
                 View footerClose = createCloseButton(7);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org