Java Code Examples for com.google.zxing.DecodeHintType#values()

The following examples show how to use com.google.zxing.DecodeHintType#values() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DecodeHintManager.java    From CodeScaner with MIT License 5 votes vote down vote up
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
Example 2
Source File: DecodeHintManager.java    From ZXing-Standalone-library with Apache License 2.0 5 votes vote down vote up
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
Example 3
Source File: DecodeHintManager.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
Example 4
Source File: DecodeHintManager.java    From Viewer with Apache License 2.0 5 votes vote down vote up
public static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
    Bundle extras = intent.getExtras();
    if (extras == null || extras.isEmpty()) {
        return null;
    }
    Map<DecodeHintType, Object> hints = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);

    for (DecodeHintType hintType : DecodeHintType.values()) {

        if (hintType == DecodeHintType.CHARACTER_SET ||
                hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
                hintType == DecodeHintType.POSSIBLE_FORMATS) {
            continue; // This hint is specified in another way
        }

        String hintName = hintType.name();
        if (extras.containsKey(hintName)) {
            if (hintType.getValueType().equals(Void.class)) {
                // Void hints are just flags: use the constant specified by the DecodeHintType
                hints.put(hintType, Boolean.TRUE);
            } else {
                Object hintData = extras.get(hintName);
                if (hintType.getValueType().isInstance(hintData)) {
                    hints.put(hintType, hintData);
                } else {
                    Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
                }
            }
        }
    }

    Log.i(TAG, "Hints from the Intent: " + hints);
    return hints;
}
 
Example 5
Source File: DecodeHintManager.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
Example 6
Source File: DecodeHintManager.java    From weex with Apache License 2.0 5 votes vote down vote up
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
Example 7
Source File: DecodeHintManager.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
Example 8
Source File: DecodeHintManager.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
Example 9
Source File: DecodeHintManager.java    From AndroidWebServ with Apache License 2.0 5 votes vote down vote up
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
    Bundle extras = intent.getExtras();
    if (extras == null || extras.isEmpty()) {
        return null;
    }
    Map<DecodeHintType, Object> hints = new EnumMap<DecodeHintType, Object>(
            DecodeHintType.class);

    for (DecodeHintType hintType : DecodeHintType.values()) {

        if (hintType == DecodeHintType.CHARACTER_SET
                || hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK
                || hintType == DecodeHintType.POSSIBLE_FORMATS) {
            continue; // This hint is specified in another way
        }

        String hintName = hintType.name();
        if (extras.containsKey(hintName)) {
            if (hintType.getValueType().equals(Void.class)) {
                // Void hints are just flags: use the constant specified by the DecodeHintType
                hints.put(hintType, Boolean.TRUE);
            } else {
                Object hintData = extras.get(hintName);
                if (hintType.getValueType().isInstance(hintData)) {
                    hints.put(hintType, hintData);
                } else {
                    Log.w(TAG, "Ignoring hint " + hintType
                            + " because it is not assignable from " + hintData);
                }
            }
        }
    }

    Log.i(TAG, "Hints from the Intent: " + hints);
    return hints;
}
 
Example 10
Source File: DecodeHintManager.java    From zxingfragmentlib with Apache License 2.0 5 votes vote down vote up
public static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}
 
Example 11
Source File: DecodeHintManager.java    From BarcodeEye with Apache License 2.0 5 votes vote down vote up
static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
  Bundle extras = intent.getExtras();
  if (extras == null || extras.isEmpty()) {
    return null;
  }
  Map<DecodeHintType,Object> hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);

  for (DecodeHintType hintType: DecodeHintType.values()) {

    if (hintType == DecodeHintType.CHARACTER_SET ||
        hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
        hintType == DecodeHintType.POSSIBLE_FORMATS) {
      continue; // This hint is specified in another way
    }

    String hintName = hintType.name();
    if (extras.containsKey(hintName)) {
      if (hintType.getValueType().equals(Void.class)) {
        // Void hints are just flags: use the constant specified by the DecodeHintType
        hints.put(hintType, Boolean.TRUE);
      } else {
        Object hintData = extras.get(hintName);
        if (hintType.getValueType().isInstance(hintData)) {
          hints.put(hintType, hintData);
        } else {
          Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
        }
      }
    }
  }

  Log.i(TAG, "Hints from the Intent: " + hints);
  return hints;
}