Merge pull request #11446 from brave/nw_default_swap
[Android] Change default token in swap to BAT
This commit is contained in:
+21
-1
@@ -105,6 +105,7 @@ public class BuySendSwapActivity extends AsyncInitializationActivity
|
||||
|
||||
private CameraSource mCameraSource;
|
||||
private CameraSourcePreview mCameraSourcePreview;
|
||||
private boolean mInitialLayoutInflationComplete = false;
|
||||
|
||||
public enum ActivityType {
|
||||
BUY(0),
|
||||
@@ -228,13 +229,15 @@ public class BuySendSwapActivity extends AsyncInitializationActivity
|
||||
|
||||
TextView toBalanceText = findViewById(R.id.to_balance_text);
|
||||
TextView toAssetText = findViewById(R.id.to_asset_text);
|
||||
toAssetText.setText("ETH");
|
||||
toAssetText.setText("BAT");
|
||||
|
||||
TextView marketPriceValueText = findViewById(R.id.market_price_value_text);
|
||||
|
||||
onInitialLayoutInflationComplete();
|
||||
|
||||
adjustControls();
|
||||
|
||||
mInitialLayoutInflationComplete = true;
|
||||
}
|
||||
|
||||
private class BuySendSwapUiInfo {
|
||||
@@ -773,6 +776,13 @@ public class BuySendSwapActivity extends AsyncInitializationActivity
|
||||
TabUtils.openUrlInNewTab(false, Utils.DEX_AGGREGATOR_URL);
|
||||
TabUtils.bringChromeTabbedActivityToTheTop(this);
|
||||
});
|
||||
if (mErcTokenRegistry != null && mCustomAccountAdapter != null) {
|
||||
mErcTokenRegistry.getTokenBySymbol("BAT", token -> {
|
||||
if (token != null) {
|
||||
updateSwapToAsset(token.symbol, token);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
btnBuySendSwap.setOnClickListener(v -> {
|
||||
@@ -1381,6 +1391,16 @@ public class BuySendSwapActivity extends AsyncInitializationActivity
|
||||
updateBalance(accountTitles[0], false);
|
||||
}
|
||||
}
|
||||
|
||||
// updateSwapToAsset needs mCustomAccountAdapter to be initialized
|
||||
if (mErcTokenRegistry != null && mActivityType == ActivityType.SWAP
|
||||
&& mInitialLayoutInflationComplete) {
|
||||
mErcTokenRegistry.getTokenBySymbol("BAT", token -> {
|
||||
if (token != null) {
|
||||
updateSwapToAsset(token.symbol, token);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user