Search in sources :

Example 1 with SnTrFragment

use of run.wallet.iota.ui.fragment.SnTrFragment 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)

Aggregations

Fragment (android.app.Fragment)1 FragmentManager (android.app.FragmentManager)1 FragmentTransaction (android.app.FragmentTransaction)1 Uri (android.net.Uri)1 Bundle (android.os.Bundle)1 QRCode (run.wallet.iota.model.QRCode)1 AboutFragment (run.wallet.iota.ui.fragment.AboutFragment)1 ChooseSeedFragment (run.wallet.iota.ui.fragment.ChooseSeedFragment)1 ColorFragment (run.wallet.iota.ui.fragment.ColorFragment)1 GenerateQRCodeFragment (run.wallet.iota.ui.fragment.GenerateQRCodeFragment)1 HelpFragment (run.wallet.iota.ui.fragment.HelpFragment)1 NetworkNeighborsFragment (run.wallet.iota.ui.fragment.NetworkNeighborsFragment)1 NetworkNodeInfoFragment (run.wallet.iota.ui.fragment.NetworkNodeInfoFragment)1 NetworkNodesAddFragment (run.wallet.iota.ui.fragment.NetworkNodesAddFragment)1 NetworkNodesFragment (run.wallet.iota.ui.fragment.NetworkNodesFragment)1 NetworkTabFragment (run.wallet.iota.ui.fragment.NetworkTabFragment)1 PasswordLoginFragment (run.wallet.iota.ui.fragment.PasswordLoginFragment)1 QRScannerFragment (run.wallet.iota.ui.fragment.QRScannerFragment)1 SeedLoginFragment (run.wallet.iota.ui.fragment.SeedLoginFragment)1 SettingsFragment (run.wallet.iota.ui.fragment.SettingsFragment)1