Show memo if available in the Transactions list.
This commit is contained in:
parent
9fe152ef7c
commit
6ef5d84394
3 changed files with 12 additions and 1 deletions
|
@ -101,6 +101,16 @@ class TransfersDetailsAdapter(private val context: Context) :
|
||||||
viewHolder.tvFrom.text = transferDetail.from ?: ""
|
viewHolder.tvFrom.text = transferDetail.from ?: ""
|
||||||
viewHolder.tvTo.text = transferDetail.to ?: ""
|
viewHolder.tvTo.text = transferDetail.to ?: ""
|
||||||
|
|
||||||
|
// Shows memo if available
|
||||||
|
val memo = transferDetail.memo
|
||||||
|
if (memo == "") {
|
||||||
|
viewHolder.tvMemo.text = ""
|
||||||
|
viewHolder.llMemo.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
viewHolder.tvMemo.text = memo
|
||||||
|
viewHolder.llMemo.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
// Format date and time
|
// Format date and time
|
||||||
val date = Date(transferDetail.date * 1000)
|
val date = Date(transferDetail.date * 1000)
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ data class TransferDetail(
|
||||||
val from: String?,
|
val from: String?,
|
||||||
val to: String?,
|
val to: String?,
|
||||||
val direction: Boolean, // True -> Received, False -> Sent
|
val direction: Boolean, // True -> Received, False -> Sent
|
||||||
|
val memo: String,
|
||||||
val date: Long,
|
val date: Long,
|
||||||
val cryptoAmount: Long,
|
val cryptoAmount: Long,
|
||||||
val cryptoPrecision: Int,
|
val cryptoPrecision: Int,
|
||||||
|
|
|
@ -7,6 +7,6 @@ import androidx.room.Query
|
||||||
@Dao
|
@Dao
|
||||||
interface TransferDetailDao {
|
interface TransferDetailDao {
|
||||||
|
|
||||||
@Query("SELECT transfers.id, (SELECT name FROM user_accounts WHERE user_accounts.id=transfers.source) AS `from`, (SELECT name FROM user_accounts WHERE user_accounts.id=transfers.destination) AS `to`, (CASE WHEN destination=:userId THEN 1 ELSE 0 END) AS `direction`, transfers.timestamp AS `date`, transfers.transfer_amount AS `cryptoAmount`, assets.precision AS `cryptoPrecision`, assets.symbol AS cryptoSymbol FROM transfers INNER JOIN assets WHERE transfers.transfer_asset_id = assets.id")
|
@Query("SELECT transfers.id, (SELECT name FROM user_accounts WHERE user_accounts.id=transfers.source) AS `from`, (SELECT name FROM user_accounts WHERE user_accounts.id=transfers.destination) AS `to`, (CASE WHEN destination=:userId THEN 1 ELSE 0 END) AS `direction`, transfers.memo AS `memo`, transfers.timestamp AS `date`, transfers.transfer_amount AS `cryptoAmount`, assets.precision AS `cryptoPrecision`, assets.symbol AS cryptoSymbol FROM transfers INNER JOIN assets WHERE transfers.transfer_asset_id = assets.id")
|
||||||
fun getAll(userId: String): LiveData<List<TransferDetail>>
|
fun getAll(userId: String): LiveData<List<TransferDetail>>
|
||||||
}
|
}
|
Loading…
Reference in a new issue