private void refreshToolbarAndStatusBarStyle() {
    // Shadow of the toolbar is not supported for Pre-Lollipop. We need to show a fake shadow on
    // pre-Lollipop devices.
    if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
      toolbar.setElevation(
          getResources()
              .getDimension(
                  users.length > 0
                      ? R.dimen.toolbar_elevation_shadow
                      : R.dimen.toolbar_elevation_no_shadow));
      findViewById(R.id.toolbar_shadow).setVisibility(View.GONE);
      // Change status bar's color to dark if the dark mode is enabled and there is
      // at least one account.
      if (users.length > 0 && darkModeEnabled) {
        getWindow().setStatusBarColor(getResources().getColor(R.color.statusBarColorDark));
      } else {
        getWindow().setStatusBarColor(getResources().getColor(R.color.statusBarColor));
      }
    } else {
      findViewById(R.id.toolbar_shadow).setVisibility(View.VISIBLE);
    }
    if (users.length == 0) {
      toolbar.setBackgroundResource(R.color.google_blue500);
    } else {
      if (darkModeEnabled) {
        toolbar.setBackgroundResource(R.color.actionBarColorDark);
      } else {
        toolbar.setBackgroundResource(R.color.actionBarColor);
      }
    }
  }
Refresh the style of the toolbar and status bar based on the layout being showed to user. When
there is no account, the toolbar must be non-shadowed, with blue color. Otherwise, the toolbar
must be shadowed (Not supported for pre-Lollipop) and the color will be depended on the current
UI mode (light/dark). The status bar's color (Not supported for pre-Lollipop also change color
based on the UI mode.
java/com/google/android/apps/authenticator/AuthenticatorActivity.java