diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt index 54ec790..c5b4712 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/adapters/TransfersDetailsAdapter.kt @@ -17,6 +17,7 @@ import cy.agorise.bitsybitshareswallet.utils.Constants import java.math.RoundingMode import java.text.DecimalFormat import java.text.DecimalFormatSymbols +import java.text.SimpleDateFormat import java.util.* class TransfersDetailsAdapter(private val context: Context) : @@ -59,6 +60,15 @@ class TransfersDetailsAdapter(private val context: Context) : } }) + private val dateFormat: SimpleDateFormat + private val timeFormat: SimpleDateFormat + + init { + val locale = context.resources.configuration.locale + dateFormat = SimpleDateFormat("dd MMM", locale) + timeFormat = SimpleDateFormat("HH:mm:ss z", locale) + } + inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { val rootView: ConstraintLayout = itemView.findViewById(R.id.rootView) val vPaymentDirection: View = itemView.findViewById(R.id.vPaymentDirection) @@ -91,8 +101,11 @@ class TransfersDetailsAdapter(private val context: Context) : viewHolder.tvFrom.text = transferDetail.from ?: "" viewHolder.tvTo.text = transferDetail.to ?: "" - viewHolder.tvDate.text = "02 Oct" - viewHolder.tvTime.text = "15:01:18 CET" + // Format date and time + val date = Date(transferDetail.date * 1000) + + viewHolder.tvDate.text = dateFormat.format(date) + viewHolder.tvTime.text = timeFormat.format(date) // Show the crypto amount correctly formatted // TODO lift the DecimalFormat declaration to other place to make things more efficient diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/database/joins/TransferDetail.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/database/joins/TransferDetail.kt index c2062f8..ba027a1 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/database/joins/TransferDetail.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/database/joins/TransferDetail.kt @@ -5,7 +5,7 @@ data class TransferDetail( val from: String?, val to: String?, val direction: Boolean, // True -> Received, False -> Sent -// val date: Long, + val date: Long, val cryptoAmount: Long, val cryptoPrecision: Int, val cryptoSymbol: String diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/database/joins/TransferDetailDao.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/database/joins/TransferDetailDao.kt index 5945a61..d985b7a 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/database/joins/TransferDetailDao.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/database/joins/TransferDetailDao.kt @@ -7,6 +7,6 @@ import androidx.room.Query @Dao 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.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.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> } \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 48dd899..84af3e9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -38,15 +38,19 @@ more than one account, please select which account you wish to import - - MainActivity + + Transactions + Merchants Receive Balances - Merchants Send + Net Worth + Coming soon - - Transactions + + Search + Filter + Export To @@ -57,6 +61,7 @@ Please Pay: %1$s %2$s To: %1$s BiTSy invoice from %1$s + Share Share with @@ -77,11 +82,5 @@ https://github.com/Agorise Block: %1$s - Coming soon - Net Worth - Search - Filter - Export - Share