         let duration = enabled ? self.duration.show : self.duration.hide
 
         isEnabled = enabled
-        moveWindowToFront()
+        adjustWindowLevel?()
+        setNeedsStatusBarAppearanceUpdate()
+
         if enabled {
             window.isHidden = false
             window.makeKey()


    public init() {
        window.backgroundColor = .clear
        window.addSubview(view)
        view.backgroundColor = .white
        NSLayoutConstraint.constraintsForViewToFillSuperview(view).activate()
    }

    open func moveWindowToFront() {
        let windowLevel = UIApplication.sharedOrNil?.windows.last?.windowLevel ?? .normal
        let maxWinLevel = max(windowLevel, .normal)
        window.windowLevel = maxWinLevel + 1
    }

    open func addSubview(_ view: UIView) {
        self.view.addSubview(view)
    }

    }
}

extension HUD {
    private final class ViewController: UIViewController {
        override func viewDidLoad() {
            view.backgroundColor = .white
        }

        override var preferredStatusBarStyle: UIStatusBarStyle {
            return statusBarStyle ?? .default
        }
    }
}

/// A base class to create a HUD that sets up blank canvas that can be
/// customized by subclasses to show anything in a fullscreen window.
open class HUD {
    private let window = UIWindow(frame: UIScreen.main.bounds)
    private let viewController = ViewController()
    private var isEnabled = false
    private var temporaryUnavailable = false
    private var view: UIView {
        return viewController.view
    }

    /// The default value is `.white`.
    open var backgroundColor: UIColor = .white {
