@@ -407,6 +407,7 @@ public void run() {
407407 // NB: wait for about:blank before dismissing
408408 public void onPageFinished (WebView view , String url ) {
409409 if (dialog != null ) {
410+ int myWidth = dialog .getWindow ().getDecorView ().getWidth ();
410411 dialog .dismiss ();
411412 }
412413
@@ -569,10 +570,12 @@ public void run() {
569570 toolbar .setBackgroundColor (hexStringToColor (
570571 toolbarDef != null && toolbarDef .color != null
571572 ? toolbarDef .color : "#ffffffff" ));
572- toolbar .setLayoutParams (new ViewGroup .LayoutParams (
573+
574+ ViewGroup .LayoutParams toolbarLayoutParams = new ViewGroup .LayoutParams (
573575 LayoutParams .MATCH_PARENT ,
574576 dpToPixels (toolbarDef != null
575- ? toolbarDef .height : TOOLBAR_DEF_HEIGHT )));
577+ ? toolbarDef .height : TOOLBAR_DEF_HEIGHT ));
578+ toolbar .setLayoutParams (toolbarLayoutParams );
576579
577580 if (toolbarDef != null
578581 && (toolbarDef .image != null || toolbarDef .wwwImage != null )) {
@@ -771,6 +774,9 @@ public void onNothingSelected(
771774 if (features .title .staticText != null ) {
772775 title .setText (features .title .staticText );
773776 }
777+ if (features .title .fontSize != null ) {
778+ title .setTextSize (features .title .fontSize );
779+ }
774780 }
775781
776782 // WebView
@@ -997,10 +1003,30 @@ public void onClick(View view) {
9971003 int titleMargin = Math .max (
9981004 leftContainerWidth , rightContainerWidth );
9991005
1006+ int paddingX = features .toolbar .paddingX ;
1007+ int titleMarginLeft , titleMarginRight ;
1008+ titleMarginLeft = titleMarginRight = titleMargin ;
1009+ if (leftContainerWidth == 0 ){
1010+ titleMarginLeft = paddingX ;
1011+ title .setGravity (Gravity .LEFT );
1012+ }else if (rightContainerWidth == 0 ){
1013+ titleMarginRight = paddingX ;
1014+ title .setGravity (Gravity .RIGHT );
1015+ }
1016+
10001017 FrameLayout .LayoutParams titleParams
10011018 = (FrameLayout .LayoutParams ) title .getLayoutParams ();
1002- titleParams .setMargins (titleMargin , 0 , titleMargin , 0 );
1003- toolbar .addView (title );
1019+ titleParams .setMargins (titleMarginLeft , 0 , titleMarginRight , 0 );
1020+
1021+ ViewGroup titleContainer ;
1022+ if (leftContainerWidth == 0 ){
1023+ titleContainer = leftButtonContainer ;
1024+ }else if (rightContainerWidth == 0 ){
1025+ titleContainer = rightButtonContainer ;
1026+ }else {
1027+ titleContainer = toolbar ;
1028+ }
1029+ titleContainer .addView (title );
10041030 }
10051031
10061032 if (features .fullscreen ) {
@@ -1027,6 +1053,7 @@ public void onClick(View view) {
10271053 dialog .setContentView (main );
10281054 dialog .show ();
10291055 dialog .getWindow ().setAttributes (lp );
1056+
10301057 // the goal of openhidden is to load the url and not display it
10311058 // Show() needs to be called to cause the URL to be loaded
10321059 if (features .hidden ) {
@@ -1567,12 +1594,14 @@ private static class Toolbar {
15671594 public String image ;
15681595 public String wwwImage ;
15691596 public double wwwImageDensity = 1 ;
1597+ public int paddingX = 0 ;
15701598 }
15711599
15721600 private static class Title {
15731601 public String color ;
15741602 public String staticText ;
15751603 public boolean showPageTitle ;
1604+ public Float fontSize ;
15761605 }
15771606
15781607 public static class ArrayHelper {
0 commit comments