Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change status bar color in themeable browser in Android with Ionic?

I am using themeable browser plugin link for display url in my Ionic application.

Default themeable browser take black color in status bar, and I have to change it. I am trying below code for that but nothing happens.

    Window window = cordova.getActivity().getWindow();

    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) 
    {
         window.setStatusBarColor(ContextCompat.getColor(cordova.getActivity(), android.R.color.holo_green_dark));
    }

I am changing this code in Android file which is located here:

https://github.com/initialxy/cordova-plugin-themeablebrowser/blob/master/src/android/ThemeableBrowser.java

like image 791
Paresh Gami Avatar asked Nov 07 '22 13:11

Paresh Gami


1 Answers

It seems that the dialog height is incorrectly calculated just fork the plugin and correct the height calculation. The status bar will maintain the color it had before opening the ThemeableBrowser :

    Display display = cordova.getActivity().getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    lp.height = size.y;
like image 183
radu.cigmaian Avatar answered Nov 14 '22 22:11

radu.cigmaian