Fetches ETH icon from crx packager always in Android wallet

This commit is contained in:
Serg
2021-11-29 15:25:23 -05:00
parent e4bceafcb3
commit 3e701f533f
5 changed files with 23 additions and 5 deletions
@@ -175,6 +175,9 @@ public class AccountDetailActivity extends AsyncInitializationActivity
// Amount in current crypto currency/token
cryptoBalanceString);
if (userAsset.symbol.equals("ETH")) {
userAsset.logo = "eth.png";
}
walletListItemModel.setIconPath("file://" + tokensPath + "/" + userAsset.logo);
walletListItemModel.setErcToken(userAsset);
walletListItemModelList.add(walletListItemModel);
@@ -97,6 +97,9 @@ public class AssetDetailActivity extends AsyncInitializationActivity
mContractAddress = getIntent().getStringExtra(Utils.ASSET_CONTRACT_ADDRESS);
mAssetLogo = getIntent().getStringExtra(Utils.ASSET_LOGO);
mAssetDecimals = getIntent().getIntExtra(Utils.ASSET_DECIMALS, 18);
if (mAssetSymbol.equals("ETH")) {
mAssetLogo = "eth.png";
}
}
mExecutor = Executors.newSingleThreadExecutor();
mHandler = new Handler(Looper.getMainLooper());
@@ -1202,8 +1202,12 @@ public class BuySendSwapActivity extends AsyncInitializationActivity
mCurrentErcToken.contractAddress = Utils.getContractAddress(
mCurrentChainId, mCurrentErcToken.symbol, mCurrentErcToken.contractAddress);
String tokensPath = ERCTokenRegistryFactory.getInstance().getTokensIconsLocation();
String iconPath =
ercToken.logo.isEmpty() ? null : ("file://" + tokensPath + "/" + ercToken.logo);
if (mCurrentErcToken.symbol.equals("ETH")) {
mCurrentErcToken.logo = "eth.png";
}
String iconPath = ercToken.logo.isEmpty()
? null
: ("file://" + tokensPath + "/" + mCurrentErcToken.logo);
Utils.setBitmapResource(mExecutor, mHandler, this, iconPath, R.drawable.ic_eth_24, null,
assetFromDropDown, true);
updateBalance(
@@ -1223,8 +1227,12 @@ public class BuySendSwapActivity extends AsyncInitializationActivity
mCurrentSwapToErcToken.contractAddress = Utils.getContractAddress(mCurrentChainId,
mCurrentSwapToErcToken.symbol, mCurrentSwapToErcToken.contractAddress);
String tokensPath = ERCTokenRegistryFactory.getInstance().getTokensIconsLocation();
String iconPath =
ercToken.logo.isEmpty() ? null : ("file://" + tokensPath + "/" + ercToken.logo);
if (mCurrentSwapToErcToken.symbol.equals("ETH")) {
mCurrentSwapToErcToken.logo = "eth.png";
}
String iconPath = ercToken.logo.isEmpty()
? null
: ("file://" + tokensPath + "/" + mCurrentSwapToErcToken.logo);
Utils.setBitmapResource(mExecutor, mHandler, this, iconPath, R.drawable.ic_eth_24, null,
assetToDropDown, true);
updateBalance(
@@ -221,15 +221,16 @@ public class EditVisibleAssetsBottomSheetDialogFragment
RecyclerView rvAssets = view.findViewById(R.id.rvAssets);
walletCoinAdapter = new WalletCoinAdapter(mType);
List<WalletListItemModel> walletListItemModelList = new ArrayList<>();
String tokensPath = ERCTokenRegistryFactory.getInstance().getTokensIconsLocation();
// Add ETH as a first item always
ErcToken eth = Utils.createEthereumErcToken();
WalletListItemModel itemModelEth =
new WalletListItemModel(R.drawable.ic_eth, eth.name, eth.symbol, "", "");
itemModelEth.setIsUserSelected(
selectedTokensSymbols.contains(eth.symbol.toUpperCase(Locale.getDefault())));
itemModelEth.setIconPath("file://" + tokensPath + "/" + eth.logo);
itemModelEth.setErcToken(eth);
walletListItemModelList.add(itemModelEth);
String tokensPath = ERCTokenRegistryFactory.getInstance().getTokensIconsLocation();
for (int i = 0; i < tokens.length; i++) {
if (tokens[i].symbol.equals("ETH")) {
// We have added ETH already
@@ -266,6 +266,9 @@ public class PortfolioFragment extends Fragment
fiatBalanceString,
// Amount in current crypto currency/token
cryptoBalanceString);
if (userAsset.symbol.equals("ETH")) {
userAsset.logo = "eth.png";
}
walletListItemModel.setIconPath("file://" + tokensPath + "/" + userAsset.logo);
walletListItemModel.setErcToken(userAsset);
walletListItemModelList.add(walletListItemModel);