Search in sources :

Example 1 with ChainAccounts

use of wannabit.io.cosmostaion.dao.ChainAccounts in project cosmostation-android by cosmostation.

the class WalletSwitchActivity method setExpendChains.

public void setExpendChains() {
    mExpendedChains.clear();
    for (ChainAccounts chainAccounts : mChainAccounts) {
        if (chainAccounts.opened) {
            mExpendedChains.add(chainAccounts.baseChain);
        }
    }
    getBaseDao().setExpendedChains(mExpendedChains);
}
Also used : ChainAccounts(wannabit.io.cosmostaion.dao.ChainAccounts)

Example 2 with ChainAccounts

use of wannabit.io.cosmostaion.dao.ChainAccounts in project cosmostation-android by cosmostation.

the class WalletSwitchActivity method loadChains.

private void loadChains() {
    mAccount = getBaseDao().onSelectAccount(getBaseDao().getLastUser());
    ArrayList<BaseChain> mDisplayChains = getBaseDao().dpSortedChains();
    mExpendedChains = getBaseDao().getExpendedChains();
    mSelectedChain = BaseChain.getChain(mAccount.baseChain);
    getBaseDao().setLastChain(mSelectedChain.getChain());
    for (BaseChain chain : mDisplayChains) {
        if (mExpendedChains.contains(chain) || mSelectedChain.equals(chain)) {
            mChainAccounts.add(new ChainAccounts(true, chain, getBaseDao().onSelectAccountsByChain(chain)));
        } else {
            mChainAccounts.add(new ChainAccounts(false, chain, getBaseDao().onSelectAccountsByChain(chain)));
        }
    }
    mAccountRecyclerView.scrollToPosition(getBaseDao().dpSortedChains().indexOf(mSelectedChain));
    mAccountListAdapter.notifyDataSetChanged();
}
Also used : ChainAccounts(wannabit.io.cosmostaion.dao.ChainAccounts) BaseChain(wannabit.io.cosmostaion.base.BaseChain)

Example 3 with ChainAccounts

use of wannabit.io.cosmostaion.dao.ChainAccounts in project cosmostation-android by cosmostation.

the class MainActivity method onChainSelect.

private void onChainSelect(BaseChain baseChain) {
    invalidateOptionsMenu();
    mChainAccounts.clear();
    ArrayList<BaseChain> mDisplayChains = new ArrayList<>();
    mDisplayChains = getBaseDao().dpSortedChains();
    mExpendedChains = getBaseDao().getExpendedChains();
    mSelectedChain = baseChain;
    getBaseDao().setLastChain(mSelectedChain.getChain());
    for (BaseChain chain : mDisplayChains) {
        if (mExpendedChains.contains(chain) || mSelectedChain.equals(chain)) {
            mChainAccounts.add(new ChainAccounts(true, chain, getBaseDao().onSelectAccountsByChain(chain)));
        } else {
            mChainAccounts.add(new ChainAccounts(false, chain, getBaseDao().onSelectAccountsByChain(chain)));
        }
    }
}
Also used : ArrayList(java.util.ArrayList) ChainAccounts(wannabit.io.cosmostaion.dao.ChainAccounts) BaseChain(wannabit.io.cosmostaion.base.BaseChain)

Aggregations

ChainAccounts (wannabit.io.cosmostaion.dao.ChainAccounts)3 BaseChain (wannabit.io.cosmostaion.base.BaseChain)2 ArrayList (java.util.ArrayList)1