Search in sources :

Example 1 with CameraFragmentBottomSheet

use of com.samourai.wallet.fragments.CameraFragmentBottomSheet in project samourai-wallet-android by Samourai-Wallet.

the class SendActivity method doScan.

private void doScan() {
    CameraFragmentBottomSheet cameraFragmentBottomSheet = new CameraFragmentBottomSheet();
    cameraFragmentBottomSheet.show(getSupportFragmentManager(), cameraFragmentBottomSheet.getTag());
    cameraFragmentBottomSheet.setQrCodeScanLisenter(code -> {
        cameraFragmentBottomSheet.dismissAllowingStateLoss();
        processScan(code);
    });
}
Also used : CameraFragmentBottomSheet(com.samourai.wallet.fragments.CameraFragmentBottomSheet)

Example 2 with CameraFragmentBottomSheet

use of com.samourai.wallet.fragments.CameraFragmentBottomSheet in project samourai-wallet-android by Samourai-Wallet.

the class BalanceActivity method doSweepViaScan.

private void doSweepViaScan() {
    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);
            } else if (FormatsUtil.getInstance().isPSBT(code.trim())) {
                CahootsUtil.getInstance(BalanceActivity.this).doPSBT(code.trim());
            } else if (DojoUtil.getInstance(BalanceActivity.this).isValidPairingPayload(code.trim())) {
                Toast.makeText(BalanceActivity.this, "Samourai Dojo full node coming soon.", Toast.LENGTH_SHORT).show();
            } 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) 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)

Example 3 with CameraFragmentBottomSheet

use of com.samourai.wallet.fragments.CameraFragmentBottomSheet in project samourai-wallet-android by Samourai-Wallet.

the class NetworkDashboard method doScan.

private void doScan() {
    CameraFragmentBottomSheet cameraFragmentBottomSheet = new CameraFragmentBottomSheet();
    cameraFragmentBottomSheet.show(getSupportFragmentManager(), cameraFragmentBottomSheet.getTag());
    cameraFragmentBottomSheet.setQrCodeScanLisenter(code -> {
        cameraFragmentBottomSheet.dismissAllowingStateLoss();
        try {
            if (DojoUtil.getInstance(NetworkDashboard.this).isValidPairingPayload(code.trim())) {
                DojoUtil.getInstance(NetworkDashboard.this).clear();
                strPairingParams = code.trim();
                enableDojoConfigure(strPairingParams);
            } else {
                ;
            }
        } catch (Exception e) {
        }
    });
}
Also used : CameraFragmentBottomSheet(com.samourai.wallet.fragments.CameraFragmentBottomSheet) MnemonicException(org.bitcoinj.crypto.MnemonicException) IOException(java.io.IOException)

Example 4 with CameraFragmentBottomSheet

use of com.samourai.wallet.fragments.CameraFragmentBottomSheet in project samourai-wallet-android by Samourai-Wallet.

the class WhirlpoolMain method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home)
        finish();
    if (id == R.id.action_utxo) {
        Intent intent = new Intent(WhirlpoolMain.this, UTXOSActivity.class);
        intent.putExtra("_account", WhirlpoolMeta.getInstance(WhirlpoolMain.this).getWhirlpoolPostmix());
        startActivity(intent);
    } else if (id == R.id.action_menu_view_post_mix) {
        Intent intent = new Intent(WhirlpoolMain.this, BalanceActivity.class);
        intent.putExtra("_account", WhirlpoolMeta.getInstance(WhirlpoolMain.this).getWhirlpoolPostmix());
        startActivity(intent);
    } else if (id == R.id.action_scode) {
        doSCODE();
    } else if (id == R.id.action_scan_qr) {
        CameraFragmentBottomSheet cameraFragmentBottomSheet = new CameraFragmentBottomSheet();
        cameraFragmentBottomSheet.show(getSupportFragmentManager(), cameraFragmentBottomSheet.getTag());
        cameraFragmentBottomSheet.setQrCodeScanLisenter(code -> {
            cameraFragmentBottomSheet.dismissAllowingStateLoss();
            try {
                if (Cahoots.isCahoots(code.trim())) {
                    Intent cahootIntent = new Intent(this, ManualCahootsActivity.class);
                    cahootIntent.putExtra("payload", code.trim());
                    cahootIntent.putExtra("_account", WhirlpoolMeta.getInstance(getApplication()).getWhirlpoolPostmix());
                    startActivity(cahootIntent);
                } else if (FormatsUtil.getInstance().isPSBT(code.trim())) {
                    CahootsUtil.getInstance(getApplication()).doPSBT(code.trim());
                } else if (DojoUtil.getInstance(getApplication()).isValidPairingPayload(code.trim())) {
                    Intent intent = new Intent(getApplication(), NetworkDashboard.class);
                    intent.putExtra("params", code.trim());
                    startActivity(intent);
                } else {
                    Intent intent = new Intent(getApplication(), SendActivity.class);
                    intent.putExtra("uri", code.trim());
                    intent.putExtra("_account", WhirlpoolMeta.getInstance(getApplication()).getWhirlpoolPostmix());
                    startActivity(intent);
                }
            } catch (Exception e) {
            }
        });
    }
    return super.onOptionsItemSelected(item);
}
Also used : Bundle(android.os.Bundle) ProgressBar(android.widget.ProgressBar) ImageView(android.widget.ImageView) LinearLayoutManagerWrapper(com.samourai.wallet.util.LinearLayoutManagerWrapper) LocalBroadcastManager(android.support.v4.content.LocalBroadcastManager) Optional(java8.util.Optional) Drawable(android.graphics.drawable.Drawable) Group(android.support.constraint.Group) AndroidSchedulers(io.reactivex.android.schedulers.AndroidSchedulers) Cahoots(com.samourai.wallet.cahoots.Cahoots) ItemDividerDecorator(com.samourai.wallet.widgets.ItemDividerDecorator) WhirlpoolAccount(com.samourai.whirlpool.client.wallet.beans.WhirlpoolAccount) DojoUtil(com.samourai.wallet.network.dojo.DojoUtil) UTXOSActivity(com.samourai.wallet.utxos.UTXOSActivity) WhirlpoolWallet(com.samourai.whirlpool.client.wallet.WhirlpoolWallet) BalanceActivity(com.samourai.wallet.home.BalanceActivity) Handler(android.os.Handler) NewPoolActivity(com.samourai.wallet.whirlpool.newPool.NewPoolActivity) View(android.view.View) SendActivity(com.samourai.wallet.send.SendActivity) ManualCahootsActivity(com.samourai.wallet.send.cahoots.ManualCahootsActivity) Schedulers(io.reactivex.schedulers.Schedulers) UTXOUtil(com.samourai.wallet.utxos.UTXOUtil) PreSelectUtil(com.samourai.wallet.utxos.PreSelectUtil) FeeUtil(com.samourai.wallet.send.FeeUtil) AndroidWhirlpoolWalletService(com.samourai.whirlpool.client.wallet.AndroidWhirlpoolWalletService) IntentFilter(android.content.IntentFilter) NetworkDashboard(com.samourai.wallet.network.NetworkDashboard) BroadcastReceiver(android.content.BroadcastReceiver) AppUtil(com.samourai.wallet.util.AppUtil) AppCompatActivity(android.support.v7.app.AppCompatActivity) ViewGroup(android.view.ViewGroup) List(java.util.List) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) Disposable(io.reactivex.disposables.Disposable) TextView(android.widget.TextView) Nullable(android.support.annotation.Nullable) FormatsUtil(com.samourai.wallet.util.FormatsUtil) WhirlpoolUtxoViewModel(com.samourai.wallet.whirlpool.models.WhirlpoolUtxoViewModel) Context(android.content.Context) Intent(android.content.Intent) FormatsUtil.getBTCDecimalFormat(com.samourai.wallet.util.FormatsUtil.getBTCDecimalFormat) CahootsUtil(com.samourai.wallet.cahoots.CahootsUtil) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) Toast(android.widget.Toast) Menu(android.view.Menu) Observable(io.reactivex.Observable) WhirlPoolLoaderDialog(com.samourai.wallet.whirlpool.fragments.WhirlPoolLoaderDialog) DialogInterface(android.content.DialogInterface) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) UTXOCoin(com.samourai.wallet.utxos.models.UTXOCoin) WhirlpoolUtxoStatus(com.samourai.whirlpool.client.wallet.beans.WhirlpoolUtxoStatus) CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout) WhirlpoolUtxo(com.samourai.whirlpool.client.wallet.beans.WhirlpoolUtxo) LayoutInflater(android.view.LayoutInflater) DiffUtil(android.support.v7.util.DiffUtil) R(com.samourai.wallet.R) WhirlpoolUtxoState(com.samourai.whirlpool.client.wallet.beans.WhirlpoolUtxoState) RecyclerView(android.support.v7.widget.RecyclerView) WhirlpoolDialog(com.samourai.wallet.whirlpool.newPool.WhirlpoolDialog) AlertDialog(android.support.v7.app.AlertDialog) Toolbar(android.support.v7.widget.Toolbar) CameraFragmentBottomSheet(com.samourai.wallet.fragments.CameraFragmentBottomSheet) JobRefreshService(com.samourai.wallet.service.JobRefreshService) APIFactory(com.samourai.wallet.api.APIFactory) WhirlpoolNotificationService(com.samourai.wallet.whirlpool.service.WhirlpoolNotificationService) Activity(android.app.Activity) EditText(android.widget.EditText) CameraFragmentBottomSheet(com.samourai.wallet.fragments.CameraFragmentBottomSheet) NetworkDashboard(com.samourai.wallet.network.NetworkDashboard) SendActivity(com.samourai.wallet.send.SendActivity) BalanceActivity(com.samourai.wallet.home.BalanceActivity) Intent(android.content.Intent) ManualCahootsActivity(com.samourai.wallet.send.cahoots.ManualCahootsActivity)

Example 5 with CameraFragmentBottomSheet

use of com.samourai.wallet.fragments.CameraFragmentBottomSheet in project samourai-wallet-android by Samourai-Wallet.

the class CahootsStepFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    TextView stepText = view.findViewById(R.id.cahoots_step_text);
    showQRBtn = view.findViewById(R.id.cahoots_step_show_qr_btn);
    scanQRbtn = view.findViewById(R.id.cahoots_step_scan_qr_btn);
    stoneWallx2TotalFee = view.findViewById(R.id.stonewall_splitup_total_fee);
    stoneWallx2SplitFee = view.findViewById(R.id.stonewall_collab_fee);
    feeSplitUpContainer = view.findViewById(R.id.stonewall_fee_splitup_container);
    step = getArguments().getInt("step");
    stepText.setText("Step ".concat(String.valueOf(step + 1)));
    scanQRbtn.setOnClickListener(view1 -> {
        CameraFragmentBottomSheet cameraFragmentBottomSheet = new CameraFragmentBottomSheet();
        cameraFragmentBottomSheet.show(getActivity().getSupportFragmentManager(), cameraFragmentBottomSheet.getTag());
        cameraFragmentBottomSheet.setQrCodeScanLisenter(code -> {
            cameraFragmentBottomSheet.dismissAllowingStateLoss();
            if (cahootsFragmentListener != null) {
                cahootsFragmentListener.onScan(step, code);
            }
        });
    });
    showQRBtn.setOnClickListener(view1 -> {
        if (cahootsFragmentListener != null) {
            cahootsFragmentListener.onShare(step);
        }
    });
    feeSplitUpContainer.setVisibility(View.GONE);
    if (this.stowaway != null) {
        if (stowaway.getStep() == 2) {
            feeSplitUpContainer.post(() -> {
                feeSplitUpContainer.setVisibility(View.VISIBLE);
            });
            stoneWallx2TotalFee.setText(formatForBtc(this.stowaway.getFeeAmount()));
            stoneWallx2SplitFee.setText(formatForBtc(this.stowaway.getFeeAmount() / 2));
        }
    }
}
Also used : CameraFragmentBottomSheet(com.samourai.wallet.fragments.CameraFragmentBottomSheet) TextView(android.widget.TextView)

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