I am using of Palette for dynamic status bar background color . for white color the status bar color should be in TranslucentStatus and for other color should be transparent color and with set color by Palette.

```
      Glide.with(fragmentContext)
                .load(offerData.getOfferImage())
                .into(new ImageViewTarget<GlideDrawable>(imgViewOffer) {
                   @Override
                    protected void setResource(GlideDrawable resource){
                        setImage(resource);
                        extractColor(resource);
                    }
 private void setImage(GlideDrawable resource) {
                    imgViewOffer.setImageDrawable(resource.getCurrent());
                    }
private void extractColor(GlideDrawable resource) {
                        Bitmap b = ((GlideBitmapDrawable) resource.getCurrent()).getBitmap();
                        Palette p = Palette.from(b).generate();
                        int defaultColor = fragmentContext.getResources().getColor(R.color.white);
                        int whiteColor = fragmentContext.getResources().getColor(R.color.white);
                        int color = p.getDarkVibrantColor(defaultColor);
                        if ((whiteColor == color)) {
                            setTransparentStatusBar(false);
                        } else {
                            setTransparentStatusBar(true);
                        }
                    }
                });private void setTransparentStatusBar(boolean isCheckStatus) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window w = getActivity().getWindow();
        if (isCheckStatus) {
            w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
        } else {
            w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
    }
}

```