package com.dianyitech.madaptor.activitys.templates.mapfield;

import android.content.Intent;
import android.net.Uri;
import com.google.zxing.BarcodeFormat;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import java.util.regex.Pattern;

final class DecodeFormatManager
{
  private static final Pattern COMMA_PATTERN = Pattern.compile(",");
  static final Vector<BarcodeFormat> DATA_MATRIX_FORMATS;
  static final Vector<BarcodeFormat> ONE_D_FORMATS;
  static final Vector<BarcodeFormat> PRODUCT_FORMATS = new Vector(5);
  static final Vector<BarcodeFormat> QR_CODE_FORMATS;

  static
  {
    PRODUCT_FORMATS.add(BarcodeFormat.UPC_A);
    PRODUCT_FORMATS.add(BarcodeFormat.UPC_E);
    PRODUCT_FORMATS.add(BarcodeFormat.EAN_13);
    PRODUCT_FORMATS.add(BarcodeFormat.EAN_8);
    PRODUCT_FORMATS.add(BarcodeFormat.RSS14);
    ONE_D_FORMATS = new Vector(4 + PRODUCT_FORMATS.size());
    ONE_D_FORMATS.addAll(PRODUCT_FORMATS);
    ONE_D_FORMATS.add(BarcodeFormat.CODE_39);
    ONE_D_FORMATS.add(BarcodeFormat.CODE_93);
    ONE_D_FORMATS.add(BarcodeFormat.CODE_128);
    ONE_D_FORMATS.add(BarcodeFormat.ITF);
    QR_CODE_FORMATS = new Vector(1);
    QR_CODE_FORMATS.add(BarcodeFormat.QR_CODE);
    DATA_MATRIX_FORMATS = new Vector(1);
    DATA_MATRIX_FORMATS.add(BarcodeFormat.DATA_MATRIX);
  }

  static Vector<BarcodeFormat> parseDecodeFormats(Intent paramIntent)
  {
    List localList = null;
    String str = paramIntent.getStringExtra("SCAN_FORMATS");
    if (str != null)
      localList = Arrays.asList(COMMA_PATTERN.split(str));
    return parseDecodeFormats(localList, paramIntent.getStringExtra("SCAN_MODE"));
  }

  static Vector<BarcodeFormat> parseDecodeFormats(Uri paramUri)
  {
    List localList = paramUri.getQueryParameters("SCAN_FORMATS");
    if ((localList != null) && (localList.size() == 1) && (localList.get(0) != null))
      localList = Arrays.asList(COMMA_PATTERN.split((CharSequence)localList.get(0)));
    return parseDecodeFormats(localList, paramUri.getQueryParameter("SCAN_MODE"));
  }

  private static Vector<BarcodeFormat> parseDecodeFormats(Iterable<String> paramIterable, String paramString)
  {
    Vector localVector;
    if (paramIterable != null)
    {
      localVector = new Vector();
      try
      {
        Iterator localIterator = paramIterable.iterator();
        while (localIterator.hasNext())
          localVector.add(BarcodeFormat.valueOf((String)localIterator.next()));
      }
      catch (IllegalArgumentException localIllegalArgumentException)
      {
      }
    }
    else
    {
      if (paramString != null)
      {
        if ("PRODUCT_MODE".equals(paramString))
        {
          localVector = PRODUCT_FORMATS;
          break label125;
        }
        if ("QR_CODE_MODE".equals(paramString))
        {
          localVector = QR_CODE_FORMATS;
          break label125;
        }
        if ("DATA_MATRIX_MODE".equals(paramString))
        {
          localVector = DATA_MATRIX_FORMATS;
          break label125;
        }
        if ("ONE_D_MODE".equals(paramString))
        {
          localVector = ONE_D_FORMATS;
          break label125;
        }
      }
      localVector = null;
    }
    label125: return localVector;
  }
}

/* Location:           /Users/zqq/Downloads/联通软件 2/classes.jar
 * Qualified Name:     com.dianyitech.madaptor.activitys.templates.mapfield.DecodeFormatManager
 * JD-Core Version:    0.6.2
 */