Created a blue lightning bolt icon and use it in the Homescreen to show it to the left of the account name in case it is LTM.

This commit is contained in:
Severiano Jaramillo 2019-01-21 11:13:54 -06:00
parent 710a04ac5d
commit 00b8919566
2 changed files with 22 additions and 2 deletions

View file

@ -60,8 +60,18 @@ class HomeFragment : Fragment() {
// Configure UserAccountViewModel to show the current account
mUserAccountViewModel = ViewModelProviders.of(this).get(UserAccountViewModel::class.java)
mUserAccountViewModel.getUserAccount(userId).observe(this, Observer<UserAccount>{ user ->
tvAccountName.text = user?.name ?: ""
mUserAccountViewModel.getUserAccount(userId).observe(this, Observer<UserAccount>{ userAccount ->
if (userAccount != null) {
tvAccountName.text = userAccount.name
if (userAccount.isLtm) {
// Add the lightning bolt to the start of the account name if it is LTM
tvAccountName.setCompoundDrawablesRelativeWithIntrinsicBounds(
resources.getDrawable(R.drawable.ic_ltm_account, null), null, null, null
)
// Add some padding so that the lightning bolt icon is not too close to the account name text
tvAccountName.compoundDrawablePadding = 4
}
}
})
// Navigate to the Receive Transaction Fragment

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="9dp"
android:height="18dp"
android:viewportWidth="12.0"
android:viewportHeight="24.0">
<path
android:fillColor="#337ab5"
android:pathData="M0,14 h5 l-3,9 l10,-12 h-5 l3,-9 z"/>
</vector>