import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
+import com.google.zxing.client.android.FinishListener;
import com.google.zxing.client.android.Intents;
import com.google.zxing.client.android.R;
setTitle(getString(R.string.app_name) + " - " + qrCodeEncoder.getTitle());
qrCodeEncoder.requestBarcode(handler, smallerDimension);
progressDialog = ProgressDialog.show(EncodeActivity.this, null,
- getString(R.string.msg_encode_in_progress), true, true, cancelListener);
+ getString(R.string.msg_encode_in_progress), true, true, new FinishListener(EncodeActivity.this));
} catch (IllegalArgumentException e) {
showErrorMessage(R.string.msg_encode_contents_failed);
}
}
};
- private final OnClickListener clickListener = new OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- finish();
- }
- };
-
- private final OnCancelListener cancelListener = new OnCancelListener() {
- public void onCancel(DialogInterface dialog) {
- finish();
- }
- };
-
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
bitmap = QRCodeEncoder.encodeAsBitmap(contents, BarcodeFormat.QR_CODE,
SHARE_BARCODE_DIMENSION, SHARE_BARCODE_DIMENSION);
} catch (WriterException we) {
- Log.w(TAG, we.toString());
+ Log.w(TAG, we);
return true;
}
File bsRoot = new File(Environment.getExternalStorageDirectory(), "BarcodeScanner");
File barcodesRoot = new File(bsRoot, "Barcodes");
if (!barcodesRoot.exists() && !barcodesRoot.mkdirs()) {
- Log.v(TAG, "Couldn't make dir " + barcodesRoot);
+ Log.w(TAG, "Couldn't make dir " + barcodesRoot);
showErrorMessage(R.string.msg_unmount_usb);
return true;
}
fos = new FileOutputStream(barcodeFile);
bitmap.compress(Bitmap.CompressFormat.PNG, 0, fos);
} catch (FileNotFoundException fnfe) {
- Log.v(TAG, "Couldn't access file " + barcodeFile + " due to " + fnfe);
+ Log.w(TAG, "Couldn't access file " + barcodeFile + " due to " + fnfe);
showErrorMessage(R.string.msg_unmount_usb);
return true;
} finally {
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(message);
- builder.setPositiveButton(R.string.button_ok, clickListener);
+ builder.setPositiveButton(R.string.button_ok, new FinishListener(this));
+ builder.setOnCancelListener(new FinishListener(this));
builder.show();
}
}