use of com.google.zxing.integration.android.IntentIntegrator in project Conversations by siacs.
the class StartConversationActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.action_create_contact:
showCreateContactDialog(null, null);
return true;
case R.id.action_join_conference:
showJoinConferenceDialog(null);
return true;
case R.id.action_create_conference:
showCreateConferenceDialog();
return true;
case R.id.action_scan_qr_code:
new IntentIntegrator(this).initiateScan(Arrays.asList("AZTEC", "QR_CODE"));
return true;
case R.id.action_hide_offline:
mHideOfflineContacts = !item.isChecked();
getPreferences().edit().putBoolean("hide_offline", mHideOfflineContacts).commit();
if (mSearchEditText != null) {
filter(mSearchEditText.getText().toString());
}
invalidateOptionsMenu();
}
return super.onOptionsItemSelected(item);
}
use of com.google.zxing.integration.android.IntentIntegrator in project weex-example by KalicyZhou.
the class WXPageActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.action_refresh:
createWeexInstance();
renderPage();
break;
case R.id.action_scan:
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
integrator.setPrompt("Scan a barcode");
//integrator.setCameraId(0); // Use a specific camera of the device
integrator.setBeepEnabled(true);
integrator.setOrientationLocked(false);
integrator.setBarcodeImageEnabled(true);
integrator.setPrompt(getString(R.string.capture_qrcode_prompt));
integrator.initiateScan();
break;
case android.R.id.home:
finish();
default:
break;
}
return super.onOptionsItemSelected(item);
}
use of com.google.zxing.integration.android.IntentIntegrator in project weex-example by KalicyZhou.
the class WXPageActivity method showDevOptionsDialog.
public void showDevOptionsDialog() {
if (mDevOptionsDialog != null || !mIsDevSupportEnabled || ActivityManager.isUserAMonkey()) {
return;
}
LinkedHashMap<String, DevOptionHandler> options = new LinkedHashMap<>();
/* register standard options */
options.put(getString(R.string.scan_qr_code), new DevOptionHandler() {
@Override
public void onOptionSelected() {
IntentIntegrator integrator = new IntentIntegrator(WXPageActivity.this);
integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
integrator.setPrompt("Scan a barcode");
//integrator.setCameraId(0); // Use a specific camera of the device
integrator.setBeepEnabled(true);
integrator.setOrientationLocked(false);
integrator.setBarcodeImageEnabled(true);
integrator.setPrompt(getString(R.string.capture_qrcode_prompt));
integrator.initiateScan();
}
});
options.put(getString(R.string.page_refresh), new DevOptionHandler() {
@Override
public void onOptionSelected() {
createWeexInstance();
renderPage();
}
});
if (mCustomDevOptions.size() > 0) {
options.putAll(mCustomDevOptions);
}
final DevOptionHandler[] optionHandlers = options.values().toArray(new DevOptionHandler[0]);
mDevOptionsDialog = new AlertDialog.Builder(WXPageActivity.this).setItems(options.keySet().toArray(new String[0]), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
optionHandlers[which].onOptionSelected();
mDevOptionsDialog = null;
}
}).setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
mDevOptionsDialog = null;
}
}).create();
mDevOptionsDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
mDevOptionsDialog.show();
}
use of com.google.zxing.integration.android.IntentIntegrator in project zxing-android-embedded by journeyapps.
the class MainActivity method scanBarcodeFrontCamera.
public void scanBarcodeFrontCamera(View view) {
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.setCameraId(Camera.CameraInfo.CAMERA_FACING_FRONT);
integrator.initiateScan();
}
use of com.google.zxing.integration.android.IntentIntegrator in project zxing-android-embedded by journeyapps.
the class MainActivity method scanWithTimeout.
public void scanWithTimeout(View view) {
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.setTimeout(8000);
integrator.initiateScan();
}
Aggregations