Search in sources :

Example 6 with CameraFragmentBottomSheet

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);
    });
}
Also used : CameraFragmentBottomSheet(com.samourai.wallet.fragments.CameraFragmentBottomSheet) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 7 with CameraFragmentBottomSheet

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();
// 
// });
// 
}
Also used : CameraFragmentBottomSheet(com.samourai.wallet.fragments.CameraFragmentBottomSheet) ColorDrawable(android.graphics.drawable.ColorDrawable) Dialog(android.app.Dialog)

Example 8 with CameraFragmentBottomSheet

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) {
        }
    });
}
Also used : CameraFragmentBottomSheet(com.samourai.wallet.fragments.CameraFragmentBottomSheet) NetworkDashboard(com.samourai.wallet.network.NetworkDashboard) CharSequenceX(com.samourai.wallet.util.CharSequenceX) SendActivity(com.samourai.wallet.send.SendActivity) PrivKeyReader(com.samourai.wallet.util.PrivKeyReader) Intent(android.content.Intent) ManualCahootsActivity(com.samourai.wallet.send.cahoots.ManualCahootsActivity) JSONException(org.json.JSONException) ConcurrentModificationException(java.util.ConcurrentModificationException) DecryptionException(com.samourai.wallet.crypto.DecryptionException) IOException(java.io.IOException) MnemonicException(org.bitcoinj.crypto.MnemonicException)

Aggregations

CameraFragmentBottomSheet (com.samourai.wallet.fragments.CameraFragmentBottomSheet)8 Intent (android.content.Intent)4 SendActivity (com.samourai.wallet.send.SendActivity)3 ManualCahootsActivity (com.samourai.wallet.send.cahoots.ManualCahootsActivity)3 IOException (java.io.IOException)3 MnemonicException (org.bitcoinj.crypto.MnemonicException)3 TextView (android.widget.TextView)2 DecryptionException (com.samourai.wallet.crypto.DecryptionException)2 Activity (android.app.Activity)1 Dialog (android.app.Dialog)1 BroadcastReceiver (android.content.BroadcastReceiver)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 IntentFilter (android.content.IntentFilter)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 Drawable (android.graphics.drawable.Drawable)1 Bundle (android.os.Bundle)1 Handler (android.os.Handler)1 Nullable (android.support.annotation.Nullable)1 Group (android.support.constraint.Group)1