@@ -85,8 +85,6 @@ Licensed to the Apache Software Foundation (ASF) under one
85
85
import java .util .HashMap ;
86
86
import java .util .StringTokenizer ;
87
87
88
- import android .content .res .Configuration ;
89
-
90
88
@ SuppressLint ("SetJavaScriptEnabled" )
91
89
public class InAppBrowser extends CordovaPlugin {
92
90
@@ -747,10 +745,8 @@ private View createCloseButton(int id){
747
745
_close = close ;
748
746
}
749
747
750
- Configuration config = activityRes .getConfiguration ();
751
- boolean isLeftToRight = config .getLayoutDirection () == View .LAYOUT_DIRECTION_LTR ;
752
748
RelativeLayout .LayoutParams closeLayoutParams = new RelativeLayout .LayoutParams (LayoutParams .WRAP_CONTENT , LayoutParams .MATCH_PARENT );
753
- closeLayoutParams .addRule (isLeftToRight ? RelativeLayout .ALIGN_PARENT_RIGHT : RelativeLayout . ALIGN_PARENT_LEFT );
749
+ closeLayoutParams .addRule (RelativeLayout .ALIGN_PARENT_RIGHT );
754
750
_close .setLayoutParams (closeLayoutParams );
755
751
756
752
if (Build .VERSION .SDK_INT >= 16 )
@@ -777,9 +773,6 @@ public void run() {
777
773
dialog .dismiss ();
778
774
};
779
775
780
- Configuration config = cordova .getActivity ().getResources ().getConfiguration ();
781
- boolean isLeftToRight = config .getLayoutDirection () == View .LAYOUT_DIRECTION_LTR ;
782
-
783
776
// Let's create the main dialog
784
777
dialog = new InAppBrowserDialog (cordova .getActivity (), android .R .style .Theme_NoTitleBar );
785
778
dialog .getWindow ().getAttributes ().windowAnimations = android .R .style .Animation_Dialog ;
@@ -797,25 +790,25 @@ public void run() {
797
790
toolbar .setBackgroundColor (toolbarColor );
798
791
toolbar .setLayoutParams (new RelativeLayout .LayoutParams (LayoutParams .MATCH_PARENT , this .dpToPixels (44 )));
799
792
toolbar .setPadding (this .dpToPixels (2 ), this .dpToPixels (2 ), this .dpToPixels (2 ), this .dpToPixels (2 ));
800
- toolbar .setHorizontalGravity (isLeftToRight ? Gravity .LEFT : Gravity . RIGHT );
793
+ toolbar .setHorizontalGravity (Gravity .LEFT );
801
794
toolbar .setVerticalGravity (Gravity .TOP );
802
795
803
796
// Action Button Container layout
804
797
RelativeLayout actionButtonContainer = new RelativeLayout (cordova .getActivity ());
805
798
actionButtonContainer .setLayoutParams (new RelativeLayout .LayoutParams (LayoutParams .WRAP_CONTENT , LayoutParams .WRAP_CONTENT ));
806
- actionButtonContainer .setHorizontalGravity (isLeftToRight ? Gravity .LEFT : Gravity . RIGHT );
799
+ actionButtonContainer .setHorizontalGravity (Gravity .LEFT );
807
800
actionButtonContainer .setVerticalGravity (Gravity .CENTER_VERTICAL );
808
801
actionButtonContainer .setId (Integer .valueOf (1 ));
809
802
810
803
// Back button
811
804
ImageButton back = new ImageButton (cordova .getActivity ());
812
805
RelativeLayout .LayoutParams backLayoutParams = new RelativeLayout .LayoutParams (LayoutParams .WRAP_CONTENT , LayoutParams .MATCH_PARENT );
813
- backLayoutParams .addRule (isLeftToRight ? RelativeLayout .ALIGN_LEFT : RelativeLayout . ALIGN_RIGHT );
806
+ backLayoutParams .addRule (RelativeLayout .ALIGN_LEFT );
814
807
back .setLayoutParams (backLayoutParams );
815
808
back .setContentDescription ("Back Button" );
816
809
back .setId (Integer .valueOf (2 ));
817
810
Resources activityRes = cordova .getActivity ().getResources ();
818
- int backResId = activityRes .getIdentifier (isLeftToRight ? "ic_action_previous_item" : "ic_action_next_item " , "drawable" , cordova .getActivity ().getPackageName ());
811
+ int backResId = activityRes .getIdentifier ("ic_action_previous_item" , "drawable" , cordova .getActivity ().getPackageName ());
819
812
Drawable backIcon = activityRes .getDrawable (backResId );
820
813
if (navigationButtonColor != "" ) back .setColorFilter (android .graphics .Color .parseColor (navigationButtonColor ));
821
814
if (Build .VERSION .SDK_INT >= 16 )
@@ -837,11 +830,11 @@ public void onClick(View v) {
837
830
// Forward button
838
831
ImageButton forward = new ImageButton (cordova .getActivity ());
839
832
RelativeLayout .LayoutParams forwardLayoutParams = new RelativeLayout .LayoutParams (LayoutParams .WRAP_CONTENT , LayoutParams .MATCH_PARENT );
840
- forwardLayoutParams .addRule (isLeftToRight ? RelativeLayout .RIGHT_OF : RelativeLayout . LEFT_OF , 2 );
833
+ forwardLayoutParams .addRule (RelativeLayout .RIGHT_OF , 2 );
841
834
forward .setLayoutParams (forwardLayoutParams );
842
835
forward .setContentDescription ("Forward Button" );
843
836
forward .setId (Integer .valueOf (3 ));
844
- int fwdResId = activityRes .getIdentifier (isLeftToRight ? "ic_action_next_item" : "ic_action_previous_item " , "drawable" , cordova .getActivity ().getPackageName ());
837
+ int fwdResId = activityRes .getIdentifier ("ic_action_next_item" , "drawable" , cordova .getActivity ().getPackageName ());
845
838
Drawable fwdIcon = activityRes .getDrawable (fwdResId );
846
839
if (navigationButtonColor != "" ) forward .setColorFilter (android .graphics .Color .parseColor (navigationButtonColor ));
847
840
if (Build .VERSION .SDK_INT >= 16 )
@@ -863,8 +856,8 @@ public void onClick(View v) {
863
856
// Edit Text Box
864
857
edittext = new EditText (cordova .getActivity ());
865
858
RelativeLayout .LayoutParams textLayoutParams = new RelativeLayout .LayoutParams (LayoutParams .MATCH_PARENT , LayoutParams .MATCH_PARENT );
866
- textLayoutParams .addRule (isLeftToRight ? RelativeLayout .RIGHT_OF : RelativeLayout . LEFT_OF , 1 );
867
- textLayoutParams .addRule (isLeftToRight ? RelativeLayout .LEFT_OF : RelativeLayout . RIGHT_OF , 5 );
859
+ textLayoutParams .addRule (RelativeLayout .RIGHT_OF , 1 );
860
+ textLayoutParams .addRule (RelativeLayout .LEFT_OF , 5 );
868
861
edittext .setLayoutParams (textLayoutParams );
869
862
edittext .setId (Integer .valueOf (4 ));
870
863
edittext .setSingleLine (true );
@@ -901,7 +894,7 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
901
894
footerLayout .addRule (RelativeLayout .ALIGN_PARENT_BOTTOM , RelativeLayout .TRUE );
902
895
footer .setLayoutParams (footerLayout );
903
896
if (closeButtonCaption != "" ) footer .setPadding (this .dpToPixels (8 ), this .dpToPixels (8 ), this .dpToPixels (8 ), this .dpToPixels (8 ));
904
- footer .setHorizontalGravity (isLeftToRight ? Gravity .LEFT : Gravity . RIGHT );
897
+ footer .setHorizontalGravity (Gravity .LEFT );
905
898
footer .setVerticalGravity (Gravity .BOTTOM );
906
899
907
900
View footerClose = createCloseButton (7 );
0 commit comments