Search in sources :

Example 1 with GenerateQRCodeFragment

use of run.wallet.iota.ui.fragment.GenerateQRCodeFragment in project run-wallet-android by runplay.

the class WalletAddressesItemDialog method onClick.

@Override
public void onClick(DialogInterface dialogInterface, int which) {
    ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
    Fragment fragment;
    final Bundle bundle = new Bundle();
    if (address != null) {
        switch(which) {
            case 0:
                ClipData clipAddress = ClipData.newPlainText(getActivity().getString(R.string.address), addressChecksum);
                clipboard.setPrimaryClip(clipAddress);
                break;
            case 1:
                if (!isAddressUsed) {
                    QRCode qrCode = new QRCode();
                    qrCode.setAddress(addressChecksum);
                    bundle.putParcelable(Constants.QRCODE, qrCode);
                    fragment = new GenerateQRCodeFragment();
                    fragment.setArguments(bundle);
                    getActivity().getFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).replace(R.id.container, fragment, null).addToBackStack(null).commit();
                } else {
                    Snackbar.make(getActivity().findViewById(R.id.drawer_layout), getString(R.string.messages_address_used), Snackbar.LENGTH_LONG).show();
                }
                break;
            case 2:
                if (isPig == 1) {
                    Snackbar.make(getActivity().findViewById(R.id.drawer_layout), getString(R.string.help_aw_piglock_no_unlock), Snackbar.LENGTH_LONG).show();
                } else {
                    if (isPig > 1) {
                        // Log.e("SET-PIG","set to false");
                        Store.setCurrentAddressPig(getActivity(), address, false);
                    } else {
                        // Log.e("SET-PIG","set to true");
                        Store.setCurrentAddressPig(getActivity(), address, true);
                    }
                    AppService.refreshEvent();
                }
                break;
            case 3:
                Address useaddress = Store.isAlreadyAddress(address, Store.getAddresses());
                if (useaddress != null) {
                    Store.setCacheAddress(useaddress);
                    UiManager.openFragmentBackStack(getActivity(), AddressSecurityFragment.class);
                }
                break;
        }
    }
}
Also used : ClipboardManager(android.content.ClipboardManager) QRCode(run.wallet.iota.model.QRCode) Address(run.wallet.iota.model.Address) Bundle(android.os.Bundle) GenerateQRCodeFragment(run.wallet.iota.ui.fragment.GenerateQRCodeFragment) GenerateQRCodeFragment(run.wallet.iota.ui.fragment.GenerateQRCodeFragment) DialogFragment(android.app.DialogFragment) Fragment(android.app.Fragment) AddressSecurityFragment(run.wallet.iota.ui.fragment.AddressSecurityFragment) ClipData(android.content.ClipData)

Aggregations

DialogFragment (android.app.DialogFragment)1 Fragment (android.app.Fragment)1 ClipData (android.content.ClipData)1 ClipboardManager (android.content.ClipboardManager)1 Bundle (android.os.Bundle)1 Address (run.wallet.iota.model.Address)1 QRCode (run.wallet.iota.model.QRCode)1 AddressSecurityFragment (run.wallet.iota.ui.fragment.AddressSecurityFragment)1 GenerateQRCodeFragment (run.wallet.iota.ui.fragment.GenerateQRCodeFragment)1