Search in sources :

Example 1 with QRCode

use of run.wallet.iota.model.QRCode in project run-wallet-android by runplay.

the class AboutFragment method onAboutDonationIotaClick.

@OnClick(R.id.about_donation_iota)
public void onAboutDonationIotaClick() {
    if (Store.getCurrentWallet() != null) {
        QRCode qrCode = new QRCode();
        qrCode.setAddress(Constants.DONATION_ADDRESS);
        qrCode.setTag(Constants.DONATION_TAG);
        Bundle bundle = new Bundle();
        bundle.putParcelable(Constants.QRCODE, qrCode);
        Intent pickContactIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("iota://send"));
        pickContactIntent.putExtra(Constants.QRCODE, qrCode);
        getActivity().setResult(Constants.DONATE_NOW, pickContactIntent);
        getActivity().finish();
    } else
        onAboutDonationIotaAddressClick();
}
Also used : QRCode(run.wallet.iota.model.QRCode) Bundle(android.os.Bundle) Intent(android.content.Intent) OnClick(butterknife.OnClick)

Example 2 with QRCode

use of run.wallet.iota.model.QRCode in project run-wallet-android by runplay.

the class MainActivity method onActivityResult.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch(resultCode) {
        case Constants.REQUEST_CODE_LOGIN:
        case 0:
            inputManager.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
            navigationView.getMenu().performIdentifierAction(R.id.nav_wallet, 0);
            break;
        case Constants.REQUEST_RESTART_KILL_APP:
            FragmentManager fragman = getFragmentManager();
            FragmentTransaction fragmentTransaction = fragman.beginTransaction();
            for (Class fragmentClass : fragmentsToKill) {
                String tag = fragmentClass.getCanonicalName();
                Fragment fragmentToKill = fragman.findFragmentByTag(tag);
                if (fragmentToKill != null) {
                    fragmentTransaction.remove(fragmentToKill);
                }
            }
            TaskManager.stopAndDestroyAllTasks(this);
            Store.wipeAllStoreSavedData(this);
            fragmentTransaction.commit();
            WalletAddressCardAdapter.clear();
            WalletTransfersCardAdapter.clear();
            inputManager.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
            UiManager.openFragment(this, WelcomeFragment.class);
            break;
        case Constants.REQUEST_GO_TOR:
            UiManager.openFragmentBackStack(this, TorFragment.class);
            break;
        case Constants.REQUEST_GO_COLORS:
            UiManager.openFragmentBackStack(this, ColorFragment.class);
            break;
    }
    if (data != null) {
        if (resultCode == Constants.DONATE_NOW) {
            Bundle bundle = data.getExtras();
            if (bundle != null) {
                Fragment fragment = new SnTrFragment();
                fragment.setArguments(bundle);
                showFragment(fragment, true);
            }
        } else if (Intent.ACTION_VIEW.equals(data.getAction())) {
            QRCode qrCode = new QRCode();
            Uri uri = data.getData();
            if (uri != null && uri.getQueryParameter("address:") != null && !uri.getQueryParameter("address:").isEmpty()) {
                qrCode.setAddress(uri.getQueryParameter("address:"));
                qrCode.setAmount(uri.getQueryParameter("amount:"));
                qrCode.setMessage(uri.getQueryParameter("message:"));
                Bundle bundle = new Bundle();
                bundle.putParcelable(Constants.QRCODE, qrCode);
                Fragment fragment = new SnTrFragment();
                fragment.setArguments(bundle);
                showFragment(fragment, true);
            }
        }
    }
}
Also used : FragmentManager(android.app.FragmentManager) QRCode(run.wallet.iota.model.QRCode) FragmentTransaction(android.app.FragmentTransaction) SnTrFragment(run.wallet.iota.ui.fragment.SnTrFragment) Bundle(android.os.Bundle) NetworkNodeInfoFragment(run.wallet.iota.ui.fragment.NetworkNodeInfoFragment) NetworkNodesFragment(run.wallet.iota.ui.fragment.NetworkNodesFragment) NetworkNodesAddFragment(run.wallet.iota.ui.fragment.NetworkNodesAddFragment) SnTrFragment(run.wallet.iota.ui.fragment.SnTrFragment) HelpFragment(run.wallet.iota.ui.fragment.HelpFragment) NetworkTabFragment(run.wallet.iota.ui.fragment.NetworkTabFragment) WalletAddressesFragment(run.wallet.iota.ui.fragment.WalletAddressesFragment) SettingsFragment(run.wallet.iota.ui.fragment.SettingsFragment) WelcomeFragment(run.wallet.iota.ui.fragment.WelcomeFragment) GenerateQRCodeFragment(run.wallet.iota.ui.fragment.GenerateQRCodeFragment) ChooseSeedFragment(run.wallet.iota.ui.fragment.ChooseSeedFragment) PasswordLoginFragment(run.wallet.iota.ui.fragment.PasswordLoginFragment) NetworkNeighborsFragment(run.wallet.iota.ui.fragment.NetworkNeighborsFragment) QRScannerFragment(run.wallet.iota.ui.fragment.QRScannerFragment) Fragment(android.app.Fragment) SeedLoginFragment(run.wallet.iota.ui.fragment.SeedLoginFragment) ColorFragment(run.wallet.iota.ui.fragment.ColorFragment) WalletTransfersFragment(run.wallet.iota.ui.fragment.WalletTransfersFragment) TorFragment(run.wallet.iota.ui.fragment.TorFragment) WalletTabFragment(run.wallet.iota.ui.fragment.WalletTabFragment) AboutFragment(run.wallet.iota.ui.fragment.AboutFragment) Uri(android.net.Uri)

Example 3 with QRCode

use of run.wallet.iota.model.QRCode 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)

Example 4 with QRCode

use of run.wallet.iota.model.QRCode in project run-wallet-android by runplay.

the class HelpFragment method onAboutDonationIotaClick.

@OnClick(R.id.about_donation_iota)
public void onAboutDonationIotaClick() {
    if (Store.getCurrentWallet() != null) {
        QRCode qrCode = new QRCode();
        qrCode.setAddress(Constants.DONATION_ADDRESS);
        qrCode.setTag(Constants.DONATION_TAG);
        Bundle bundle = new Bundle();
        bundle.putParcelable(Constants.QRCODE, qrCode);
        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        SnTrFragment sendTransfer = new SnTrFragment();
        sendTransfer.setArguments(bundle);
        fragmentTransaction.replace(R.id.container, sendTransfer, SnTrFragment.class.getCanonicalName());
        fragmentTransaction.commit();
    } else
        onAboutDonationIotaAddressClick();
}
Also used : FragmentManager(android.app.FragmentManager) QRCode(run.wallet.iota.model.QRCode) FragmentTransaction(android.app.FragmentTransaction) Bundle(android.os.Bundle) OnClick(butterknife.OnClick)

Example 5 with QRCode

use of run.wallet.iota.model.QRCode in project run-wallet-android by runplay.

the class GenerateQRCodeFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ((AppCompatActivity) getActivity()).setSupportActionBar(generateQrCodeToolbar);
    Bundle bundle = getArguments();
    if (bundle != null) {
        QRCode qrCode = bundle.getParcelable(Constants.QRCODE);
        if (qrCode != null) {
            if (qrCode.getAddress() != null)
                addressEditText.setText(qrCode.getAddress());
        }
    }
    // else
    // generateNewAddress();
    initUnitsSpinner();
}
Also used : QRCode(run.wallet.iota.model.QRCode) Bundle(android.os.Bundle) AppCompatActivity(android.support.v7.app.AppCompatActivity)

Aggregations

QRCode (run.wallet.iota.model.QRCode)8 Bundle (android.os.Bundle)7 Fragment (android.app.Fragment)3 FragmentManager (android.app.FragmentManager)3 FragmentTransaction (android.app.FragmentTransaction)3 OnClick (butterknife.OnClick)3 ClipData (android.content.ClipData)2 ClipboardManager (android.content.ClipboardManager)2 AppCompatActivity (android.support.v7.app.AppCompatActivity)2 GenerateQRCodeFragment (run.wallet.iota.ui.fragment.GenerateQRCodeFragment)2 DialogFragment (android.app.DialogFragment)1 Intent (android.content.Intent)1 Uri (android.net.Uri)1 MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 InputMethodManager (android.view.inputmethod.InputMethodManager)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ScrollView (android.widget.ScrollView)1 TextView (android.widget.TextView)1