Skip to content

Commit dfcffb4

Browse files
authored
fix(android): increase toolbar to 48dp (apache#946)
Material Design Guidelines says "For most platforms, consider making touch targets at least 48 x 48dp."
1 parent 1718efa commit dfcffb4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/android/InAppBrowser.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ public class InAppBrowser extends CordovaPlugin {
117117
private static final String BEFORELOAD = "beforeload";
118118
private static final String FULLSCREEN = "fullscreen";
119119

120+
private static final int TOOLBAR_HEIGHT = 48;
121+
120122
private static final List customizableOptions = Arrays.asList(CLOSE_BUTTON_CAPTION, TOOLBAR_COLOR, NAVIGATION_COLOR, CLOSE_BUTTON_COLOR, FOOTER_COLOR);
121123

122124
private InAppBrowserDialog dialog;
@@ -799,7 +801,7 @@ public void run() {
799801
RelativeLayout toolbar = new RelativeLayout(cordova.getActivity());
800802
//Please, no more black!
801803
toolbar.setBackgroundColor(toolbarColor);
802-
toolbar.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44)));
804+
toolbar.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(TOOLBAR_HEIGHT)));
803805
toolbar.setPadding(this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2));
804806
if (leftToRight) {
805807
toolbar.setHorizontalGravity(Gravity.LEFT);
@@ -901,7 +903,7 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
901903
_footerColor = android.graphics.Color.LTGRAY;
902904
}
903905
footer.setBackgroundColor(_footerColor);
904-
RelativeLayout.LayoutParams footerLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44));
906+
RelativeLayout.LayoutParams footerLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(TOOLBAR_HEIGHT));
905907
footerLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
906908
footer.setLayoutParams(footerLayout);
907909
if (closeButtonCaption != "") footer.setPadding(this.dpToPixels(8), this.dpToPixels(8), this.dpToPixels(8), this.dpToPixels(8));

0 commit comments

Comments
 (0)