why not writing as this?
if (hasFocus && VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
  View decorView = getWindow().getDecorView();
  decorView.setSystemUiVisibility(...);
}