diff --git a/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java b/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java index 81570ea..5db0c0f 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java +++ b/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java @@ -54,6 +54,7 @@ public abstract class CrystalDatabase extends RoomDatabase { public abstract CryptoCoinBalanceDao cryptoCoinBalanceDao(); public abstract CryptoCurrencyDao cryptoCurrencyDao(); public abstract BitsharesAssetDao bitsharesAssetDao(); + public abstract BitsharesAccountNameCacheDao bitsharesAccountNameCacheDao(); public abstract CryptoCurrencyEquivalenceDao cryptoCurrencyEquivalenceDao(); public abstract GeneralSettingDao generalSettingDao(); diff --git a/app/src/main/java/cy/agorise/crystalwallet/dao/TransactionDao.java b/app/src/main/java/cy/agorise/crystalwallet/dao/TransactionDao.java index bcdca57..6e10049 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/dao/TransactionDao.java +++ b/app/src/main/java/cy/agorise/crystalwallet/dao/TransactionDao.java @@ -20,9 +20,10 @@ import cy.agorise.crystalwallet.models.CryptoCoinTransactionExtended; @Dao public interface TransactionDao { - static final String transactionsQuery = "SELECT cct.*, cna.name AS user_account_name, c.name AS contact_name FROM crypto_coin_transaction cct " + + static final String transactionsQuery = "SELECT cct.*, cna.name AS user_account_name, c.name AS contact_name, banc.name AS bitshares_account_name FROM crypto_coin_transaction cct " + "LEFT JOIN crypto_net_account cna ON cct.account_id = cna.id " + "LEFT JOIN contact c ON c.id = (SELECT ca.contact_id FROM contact_address ca WHERE ca.address LIKE (CASE is_input WHEN 1 THEN cct.\"from\" ELSE cct.\"to\" END) LIMIT 1) " + + "LEFT JOIN bitshares_account_name_cache banc ON banc.account_id = (CASE is_input WHEN 1 THEN cct.\"from\" ELSE cct.\"to\" END) " + "WHERE user_account_name LIKE '%'||:search||'%' OR contact_name LIKE '%'||:search||'%' OR cct.\"from\" LIKE '%'||:search||'%' OR cct.\"to\" LIKE '%'||:search||'%'"; @Query("SELECT * FROM crypto_coin_transaction") diff --git a/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransactionExtended.java b/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransactionExtended.java index 00ae487..b319e15 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransactionExtended.java +++ b/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransactionExtended.java @@ -29,6 +29,9 @@ public class CryptoCoinTransactionExtended { @ColumnInfo(name="contact_name") public String contactName; + @ColumnInfo(name="bitshares_account_name") + public String bitsharesAccountName; + public String getUserAccountName(){ return this.userAccountName; } @@ -37,6 +40,10 @@ public class CryptoCoinTransactionExtended { return this.contactName; } + public String getBitsharesAccountName(){ + return this.bitsharesAccountName; + } + public String getFrom() { return this.cryptoCoinTransaction.getFrom(); } public String getTo() { return this.cryptoCoinTransaction.getTo(); } diff --git a/app/src/main/java/cy/agorise/crystalwallet/views/TransactionViewHolder.java b/app/src/main/java/cy/agorise/crystalwallet/views/TransactionViewHolder.java index a8ca0d0..b4b134b 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/views/TransactionViewHolder.java +++ b/app/src/main/java/cy/agorise/crystalwallet/views/TransactionViewHolder.java @@ -156,12 +156,16 @@ public class TransactionViewHolder extends RecyclerView.ViewHolder { if ((transaction.getContactName() != null)&&(!transaction.equals(""))){ tvFrom.setText(transaction.getContactName()); + } else if ((transaction.getBitsharesAccountName() != null)&&(!transaction.equals(""))){ + tvFrom.setText(transaction.getBitsharesAccountName()); } } else { tvFrom.setText(transaction.getUserAccountName()); if ((transaction.getContactName() != null)&&(!transaction.equals(""))){ tvTo.setText(transaction.getContactName()); + } else if ((transaction.getBitsharesAccountName() != null)&&(!transaction.equals(""))){ + tvTo.setText(transaction.getBitsharesAccountName()); } } // }