text: package com.vipulasri.ticketview;
  
  import android.content.Context;
  import android.content.res.Resources;
  import android.util.TypedValue;
  
  public class Utils {
  
      public static int dpToPx(float dp, Context context) {
          return dpToPx(dp, context.getResources());
      }
  
      public static int dpToPx(float dp, Resources resources) {
          float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics());
          return (int) px;
      }
  
      public static boolean isJellyBeanAndAbove() {
          return android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
      }
  }