use of com.samourai.wallet.fragments.CameraFragmentBottomSheet in project samourai-wallet-android by Samourai-Wallet.
the class AddPaynymActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_paynym);
setSupportActionBar(findViewById(R.id.toolbar_addpaynym));
viewSwitcher = findViewById(R.id.viewswitcher_addpaynym);
searchPaynymList = findViewById(R.id.search_list_addpaynym);
searchPaynymList.setLayoutManager(new LinearLayoutManager(this));
searchPaynymList.setAdapter(new SearchAdapter());
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
findViewById(R.id.add_paynym_scan_qr).setOnClickListener(view -> {
CameraFragmentBottomSheet cameraFragmentBottomSheet = new CameraFragmentBottomSheet();
cameraFragmentBottomSheet.show(getSupportFragmentManager(), cameraFragmentBottomSheet.getTag());
cameraFragmentBottomSheet.setQrCodeScanLisenter(code -> {
cameraFragmentBottomSheet.dismissAllowingStateLoss();
processScan(code);
});
});
findViewById(R.id.add_paynym_paste).setOnClickListener(view -> {
pastePcode();
});
findViewById(R.id.dev_fund_button).setOnClickListener(view -> {
Intent intent = new Intent(this, PayNymDetailsActivity.class);
intent.putExtra("pcode", strSamouraiDonationPCode);
intent.putExtra("label", BIP47Meta.getInstance().getDisplayLabel(strSamouraiDonationPCode));
startActivityForResult(intent, EDIT_PCODE);
});
}
use of com.samourai.wallet.fragments.CameraFragmentBottomSheet in project samourai-wallet-android by Samourai-Wallet.
the class DojoConfigureBottomSheet method showConnectionAlert.
private void showConnectionAlert() {
Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Dialog);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.dojo_connect_dialog);
dialog.setCanceledOnTouchOutside(true);
if (dialog.getWindow() != null)
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
dialog.show();
dialog.findViewById(R.id.dojo_scan_qr).setOnClickListener(view -> {
dialog.dismiss();
cameraFragmentBottomSheet = new CameraFragmentBottomSheet();
cameraFragmentBottomSheet.show(getActivity().getSupportFragmentManager(), cameraFragmentBottomSheet.getTag());
cameraFragmentBottomSheet.setQrCodeScanLisenter(this::connectToDojo);
});
dialog.findViewById(R.id.dojo_paste_config).setVisibility(View.GONE);
// dialog.findViewById(R.id.dojo_paste_config).setOnClickListener(view -> {
//
// try {
// ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
// ClipData.Item item = clipboard.getPrimaryClip().getItemAt(0);
// connectToDojo(item.getText().toString());
//
// } catch (Exception e) {
// e.printStackTrace();
// }
//
// dialog.dismiss();
//
// });
//
}
use of com.samourai.wallet.fragments.CameraFragmentBottomSheet in project samourai-wallet-android by Samourai-Wallet.
the class BalanceActivity method doScan.
private void doScan() {
CameraFragmentBottomSheet cameraFragmentBottomSheet = new CameraFragmentBottomSheet();
cameraFragmentBottomSheet.show(getSupportFragmentManager(), cameraFragmentBottomSheet.getTag());
cameraFragmentBottomSheet.setQrCodeScanLisenter(code -> {
cameraFragmentBottomSheet.dismissAllowingStateLoss();
PrivKeyReader privKeyReader = new PrivKeyReader(new CharSequenceX(code.trim()));
try {
if (privKeyReader.getFormat() != null) {
doPrivKey(code.trim());
} else if (Cahoots.isCahoots(code.trim())) {
Intent cahootIntent = new Intent(this, ManualCahootsActivity.class);
cahootIntent.putExtra("payload", code.trim());
cahootIntent.putExtra("_account", account);
startActivity(cahootIntent);
// CahootsUtil.getInstance(BalanceActivity.this).processCahoots(code.trim(), 0);
} else if (FormatsUtil.getInstance().isPSBT(code.trim())) {
CahootsUtil.getInstance(BalanceActivity.this).doPSBT(code.trim());
} else if (DojoUtil.getInstance(BalanceActivity.this).isValidPairingPayload(code.trim())) {
Intent intent = new Intent(BalanceActivity.this, NetworkDashboard.class);
intent.putExtra("params", code.trim());
startActivity(intent);
} else {
Intent intent = new Intent(BalanceActivity.this, SendActivity.class);
intent.putExtra("uri", code.trim());
intent.putExtra("_account", account);
startActivity(intent);
}
} catch (Exception e) {
}
});
}
Aggregations