code: public static void toggleVisibility(View view, int hidingPolicy) {
          int current = view.getVisibility();
          view.setVisibility(current == View.VISIBLE ? hidingPolicy : View.VISIBLE);
      }
docs: Toggle visibility of a {@link android.view.View}.
  Status of invisible is applied by the parameter of hidingPolicy.
  @param view to toggle
  @param hidingPolicy {@link android.view.View#INVISIBLE} or {@link android.view.View#GONE}