本文整理匯總了Java中github.nisrulz.qreader.QREader類的典型用法代碼示例。如果您正苦於以下問題:Java QREader類的具體用法?Java QREader怎麽用?Java QREader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
QREader類屬於github.nisrulz.qreader包,在下文中一共展示了QREader類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupQREader
import github.nisrulz.qreader.QREader; //導入依賴的package包/類
void setupQREader() {
// Init QREader
// ------------
qrEader = new QREader.Builder(this, mySurfaceView, new QRDataListener() {
@Override
public void onDetected(final String data) {
Log.d("QREader", "Value : " + data);
text.post(new Runnable() {
@Override
public void run() {
text.setText(data);
}
});
}
}).facing(QREader.BACK_CAM)
.enableAutofocus(true)
.height(mySurfaceView.getHeight())
.width(mySurfaceView.getWidth())
.build();
}
示例2: onCreate
import github.nisrulz.qreader.QREader; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_continuous_capture);
ButterKnife.bind(this);
ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
reader = new QREader.Builder(this, scanner, new BarcodeRead(this))
.facing(QREader.BACK_CAM)
.enableAutofocus(true)
.height(scanner.getHeight())
.width(scanner.getWidth())
.build();
}
示例3: onViewCreated
import github.nisrulz.qreader.QREader; //導入依賴的package包/類
/**
*
* @param view
* @param savedInstanceState
*/
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
_sendViewContract.initViews();
// Init QREader
// ------------
qrEader = new QREader.Builder(getBaseActivity(), _sendViewContract.getCameraSurfaceView(), new QRDataListener() {
@Override
public void onDetected(final String data) {
if ( (data == null || data.equals(_latestDetectedData)) && _sendViewContract.getAddressField().getText().length() > 0) return;
_latestDetectedData = data;
getBaseActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// check if data includes address + amount + currency (i.e, bitcoin : [addr] ? amount = [amount])
String addr = _latestDetectedData;
if (_latestDetectedData.contains(":")) {
String[] tokens = _latestDetectedData.split(":");
if (tokens.length > 1) {
if (isBitcoinAddress(tokens[1])) {
addr = tokens[1];
} else if (tokens[1].contains("?")) {
String[] addrAmountTokens = tokens[1].split("\\?");
addr = addrAmountTokens[0];
}
}
}
_sendViewContract.getAddressField().setText(addr);
}
});
}
}).facing(QREader.BACK_CAM)
.enableAutofocus(true)
.height(_sendViewContract.getCameraSurfaceView().getHeight())
.width(_sendViewContract.getCameraSurfaceView().getWidth())
.build();
//checkClipboard();
}