Java 类com.google.zxing.encode.QRCodeEncoder 实例源码

项目:mobile-store    文件:QrGenAsyncTask.java   
@SuppressWarnings("deprecation")
@TargetApi(13)
@Override
protected Void doInBackground(String... s) {
    String qrData = s[0];
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point outSize = new Point();
    int x, y, qrCodeDimension;
    /* lame, got to use both the new and old APIs here */
    if (Build.VERSION.SDK_INT >= 13) {
        display.getSize(outSize);
        x = outSize.x;
        y = outSize.y;
    } else {
        x = display.getWidth();
        y = display.getHeight();
    }
    if (x < y) {
        qrCodeDimension = x;
    } else {
        qrCodeDimension = y;
    }
    Utils.debugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
    QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
            Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

    try {
        qrBitmap = qrCodeEncoder.encodeAsBitmap();
    } catch (WriterException e) {
        Log.e(TAG, "Could not encode QR as bitmap", e);
    }
    return null;
}
项目:fdroid    文件:QrGenAsyncTask.java   
@SuppressWarnings("deprecation")
@TargetApi(13)
@Override
protected Void doInBackground(String... s) {
    String qrData = s[0];
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point outSize = new Point();
    int x, y, qrCodeDimension;
    /* lame, got to use both the new and old APIs here */
    if (Build.VERSION.SDK_INT >= 13) {
        display.getSize(outSize);
        x = outSize.x;
        y = outSize.y;
    } else {
        x = display.getWidth();
        y = display.getHeight();
    }
    if (x < y) {
        qrCodeDimension = x;
    } else {
        qrCodeDimension = y;
    }
    Utils.debugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
    QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
            Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

    try {
        qrBitmap = qrCodeEncoder.encodeAsBitmap();
    } catch (WriterException e) {
        Log.e(TAG, "Could not encode QR as bitmap", e);
    }
    return null;
}
项目:AppHub    文件:QrGenAsyncTask.java   
@SuppressWarnings("deprecation")
@TargetApi(13)
@Override
protected Void doInBackground(String... s) {
    String qrData = s[0];
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point outSize = new Point();
    int x, y, qrCodeDimension;
    /* lame, got to use both the new and old APIs here */
    if (Build.VERSION.SDK_INT >= 13) {
        display.getSize(outSize);
        x = outSize.x;
        y = outSize.y;
    } else {
        x = display.getWidth();
        y = display.getHeight();
    }
    if (x < y)
        qrCodeDimension = x;
    else
        qrCodeDimension = y;
    Utils.debugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
    QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
            Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

    try {
        qrBitmap = qrCodeEncoder.encodeAsBitmap();
    } catch (WriterException e) {
        Log.e(TAG, "Could not encode QR as bitmap", e);
    }
    return null;
}
项目:f-droid    文件:QrGenAsyncTask.java   
@SuppressWarnings("deprecation")
@TargetApi(13)
@Override
protected Void doInBackground(String... s) {
    String qrData = s[0];
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point outSize = new Point();
    int x, y, qrCodeDimension;
    /* lame, got to use both the new and old APIs here */
    if (Build.VERSION.SDK_INT >= 13) {
        display.getSize(outSize);
        x = outSize.x;
        y = outSize.y;
    } else {
        x = display.getWidth();
        y = display.getHeight();
    }
    if (x < y)
        qrCodeDimension = x;
    else
        qrCodeDimension = y;
    Log.i(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
    QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
            Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

    try {
        qrBitmap = qrCodeEncoder.encodeAsBitmap();
    } catch (WriterException e) {
        Log.e(TAG, e.getMessage());
    }
    return (Void) null;
}
项目:Zom-Android    文件:QrGenAsyncTask.java   
@SuppressWarnings("deprecation")
  @TargetApi(13)
  @Override
  protected Void doInBackground(String... s) {
      String qrData = s[0];
      /*
      //Display display = activity.getWindowManager().getDefaultDisplay();

      Point outSize = new Point();
      int x, y, qrCodeDimension;
      if (Build.VERSION.SDK_INT >= 13) {
          view.getSize(outSize);
          x = outSize.x;
          y = outSize.y;
      } else {
          x = display.getWidth();
          y = display.getHeight();
      }
      if (x < y)
          qrCodeDimension = x;
      else
          qrCodeDimension = y;
      **/

//      Log.i(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
      QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
              Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

      try {
          qrBitmap = qrCodeEncoder.encodeAsBitmap();
      } catch (WriterException e) {
          Log.e(TAG, e.getMessage());
      }
      return null;
  }
项目:fdroidclient    文件:QrGenAsyncTask.java   
@SuppressWarnings("deprecation")
@TargetApi(13)
@Override
protected Void doInBackground(String... s) {
    String qrData = s[0];
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point outSize = new Point();
    int x, y, qrCodeDimension;
    /* lame, got to use both the new and old APIs here */
    if (Build.VERSION.SDK_INT >= 13) {
        display.getSize(outSize);
        x = outSize.x;
        y = outSize.y;
    } else {
        x = display.getWidth();
        y = display.getHeight();
    }
    if (x < y) {
        qrCodeDimension = x;
    } else {
        qrCodeDimension = y;
    }
    Utils.debugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
    QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
            Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

    try {
        qrBitmap = qrCodeEncoder.encodeAsBitmap();
    } catch (WriterException e) {
        Log.e(TAG, "Could not encode QR as bitmap", e);
    }
    return null;
}
项目:Zom-Android    文件:QrShareAsyncTask.java   
@SuppressWarnings("deprecation")
@TargetApi(13)
@Override
protected Bitmap doInBackground(String... s) {
    inviteLink = s[0];

    message = new StringBuffer();

    if (s.length > 0)
    {
        message.append(s[1]).append(": ");
    }

    message.append(inviteLink);
    message.append("\n\n");
    message.append(activity.getString(R.string.action_tap_invite));

    if (mShareQRCode) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        Point outSize = new Point();
        int x, y, qrCodeDimension;
        /* lame, got to use both the new and old APIs here */
        if (Build.VERSION.SDK_INT >= 13) {
            display.getSize(outSize);
            x = outSize.x;
            y = outSize.y;
        } else {
            x = display.getWidth();
            y = display.getHeight();
        }
        if (x < y)
            qrCodeDimension = x;
        else
            qrCodeDimension = y;
        Log.i(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
        QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(inviteLink, null,
                Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

        try {
            qrBitmap = qrCodeEncoder.encodeAsBitmap();
            return qrBitmap;
        } catch (WriterException e) {
            Log.e(TAG, e.getMessage());
        }
    }

    return null;
}