content: package androidx.core.view;
  
  import android.content.Context;
  import android.content.res.Resources;
  import android.os.Build;
  import android.util.Log;
  import android.util.TypedValue;
  import android.view.ViewConfiguration;
  import java.lang.reflect.Method;
  
  public final class ViewConfigurationCompat {
      private static final String TAG = "ViewConfigCompat";
      private static Method sGetScaledScrollFactorMethod;
  
      static class Api26Impl {
          private Api26Impl() {
          }
  
          static float getScaledHorizontalScrollFactor(ViewConfiguration viewConfiguration) {
              return viewConfiguration.getScaledHorizontalScrollFactor();
          }
  
          static float getScaledVerticalScrollFactor(ViewConfiguration viewConfiguration) {
              return viewConfiguration.getScaledVerticalScrollFactor();
          }
      }
  
      static class Api28Impl {
          private Api28Impl() {
          }
  
          static int getScaledHoverSlop(ViewConfiguration viewConfiguration) {
              return viewConfiguration.getScaledHoverSlop();
          }
  
          static boolean shouldShowMenuShortcutsWhenKeyboardPresent(ViewConfiguration viewConfiguration) {
              return viewConfiguration.shouldShowMenuShortcutsWhenKeyboardPresent();
          }
      }
  
      static {
          if (Build.VERSION.SDK_INT == 25) {
              try {
                  sGetScaledScrollFactorMethod = ViewConfiguration.class.getDeclaredMethod("getScaledScrollFactor", new Class[0]);
              } catch (Exception e) {
                  Log.i(TAG, "Could not find method getScaledScrollFactor() on ViewConfiguration");
              }
          }
      }
  
      private ViewConfigurationCompat() {
      }
  
      private static float getLegacyScrollFactor(ViewConfiguration config, Context context) {
          Method method;
          if (Build.VERSION.SDK_INT >= 25 && (method = sGetScaledScrollFactorMethod) != null) {
              try {
                  return (float) ((Integer) method.invoke(config, new Object[0])).intValue();
              } catch (Exception e) {
                  Log.i(TAG, "Could not find method getScaledScrollFactor() on ViewConfiguration");
              }
          }
          TypedValue typedValue = new TypedValue();
          if (context.getTheme().resolveAttribute(16842829, typedValue, true)) {
              return typedValue.getDimension(context.getResources().getDisplayMetrics());
          }
          return 0.0f;
      }
  
      public static float getScaledHorizontalScrollFactor(ViewConfiguration config, Context context) {
          return Build.VERSION.SDK_INT >= 26 ? Api26Impl.getScaledHorizontalScrollFactor(config) : getLegacyScrollFactor(config, context);
      }
  
      public static int getScaledHoverSlop(ViewConfiguration config) {
          return Build.VERSION.SDK_INT >= 28 ? Api28Impl.getScaledHoverSlop(config) : config.getScaledTouchSlop() / 2;
      }
  
      @Deprecated
      public static int getScaledPagingTouchSlop(ViewConfiguration config) {
          return config.getScaledPagingTouchSlop();
      }
  
      public static float getScaledVerticalScrollFactor(ViewConfiguration config, Context context) {
          return Build.VERSION.SDK_INT >= 26 ? Api26Impl.getScaledVerticalScrollFactor(config) : getLegacyScrollFactor(config, context);
      }
  
      @Deprecated
      public static boolean hasPermanentMenuKey(ViewConfiguration config) {
          return config.hasPermanentMenuKey();
      }
  
      public static boolean shouldShowMenuShortcutsWhenKeyboardPresent(ViewConfiguration config, Context context) {
          if (Build.VERSION.SDK_INT >= 28) {
              return Api28Impl.shouldShowMenuShortcutsWhenKeyboardPresent(config);
          }
          Resources resources = context.getResources();
          int identifier = resources.getIdentifier("config_showMenuShortcutsWhenKeyboardPresent", "bool", "android");
          return identifier != 0 && resources.getBoolean(identifier);
      }
  }
  