code: public static Orientation getOrientation(@NonNull final Context context) {
          Condition.INSTANCE.ensureNotNull(context, "The context may not be null");
          int orientation = context.getResources().getConfiguration().orientation;
  
          if (orientation == Configuration.ORIENTATION_UNDEFINED) {
              int width = getDisplayWidth(context);
              int height = getDisplayHeight(context);
  
              if (width > height) {
                  return Orientation.LANDSCAPE;
              } else if (width < height) {
                  return Orientation.PORTRAIT;
              } else {
                  return Orientation.SQUARE;
              }
          } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
              return Orientation.LANDSCAPE;
          } else if (orientation == Configuration.ORIENTATION_PORTRAIT) {
              return Orientation.PORTRAIT;
          } else {
              return Orientation.SQUARE;
          }
      }
docs: Returns the orientation of the device.
  
  @param context
  The context, which should be used, as an instance of the class {@link Context}. The
  context may not be null
  @return The orientation of the device as a value of the enum {@link Orientation}. The
  orientation may either be <code>PORTRAIT</code>, <code>LANDSCAPE</code> or
  <code>SQUARE</code>