- Now the transactions list use first the contact name, then the bitshares account name and finally the user's account name. If none of them is useful, the bitshares account id will appear instead.

This commit is contained in:
Javier Varona 2018-06-16 22:17:27 -04:00
parent bb2e98431b
commit 39a8a1e446
4 changed files with 14 additions and 1 deletions

View file

@ -54,6 +54,7 @@ public abstract class CrystalDatabase extends RoomDatabase {
public abstract CryptoCoinBalanceDao cryptoCoinBalanceDao(); public abstract CryptoCoinBalanceDao cryptoCoinBalanceDao();
public abstract CryptoCurrencyDao cryptoCurrencyDao(); public abstract CryptoCurrencyDao cryptoCurrencyDao();
public abstract BitsharesAssetDao bitsharesAssetDao(); public abstract BitsharesAssetDao bitsharesAssetDao();
public abstract BitsharesAccountNameCacheDao bitsharesAccountNameCacheDao();
public abstract CryptoCurrencyEquivalenceDao cryptoCurrencyEquivalenceDao(); public abstract CryptoCurrencyEquivalenceDao cryptoCurrencyEquivalenceDao();
public abstract GeneralSettingDao generalSettingDao(); public abstract GeneralSettingDao generalSettingDao();

View file

@ -20,9 +20,10 @@ import cy.agorise.crystalwallet.models.CryptoCoinTransactionExtended;
@Dao @Dao
public interface TransactionDao { 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 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 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||'%'"; "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") @Query("SELECT * FROM crypto_coin_transaction")

View file

@ -29,6 +29,9 @@ public class CryptoCoinTransactionExtended {
@ColumnInfo(name="contact_name") @ColumnInfo(name="contact_name")
public String contactName; public String contactName;
@ColumnInfo(name="bitshares_account_name")
public String bitsharesAccountName;
public String getUserAccountName(){ public String getUserAccountName(){
return this.userAccountName; return this.userAccountName;
} }
@ -37,6 +40,10 @@ public class CryptoCoinTransactionExtended {
return this.contactName; return this.contactName;
} }
public String getBitsharesAccountName(){
return this.bitsharesAccountName;
}
public String getFrom() { return this.cryptoCoinTransaction.getFrom(); } public String getFrom() { return this.cryptoCoinTransaction.getFrom(); }
public String getTo() { return this.cryptoCoinTransaction.getTo(); } public String getTo() { return this.cryptoCoinTransaction.getTo(); }

View file

@ -156,12 +156,16 @@ public class TransactionViewHolder extends RecyclerView.ViewHolder {
if ((transaction.getContactName() != null)&&(!transaction.equals(""))){ if ((transaction.getContactName() != null)&&(!transaction.equals(""))){
tvFrom.setText(transaction.getContactName()); tvFrom.setText(transaction.getContactName());
} else if ((transaction.getBitsharesAccountName() != null)&&(!transaction.equals(""))){
tvFrom.setText(transaction.getBitsharesAccountName());
} }
} else { } else {
tvFrom.setText(transaction.getUserAccountName()); tvFrom.setText(transaction.getUserAccountName());
if ((transaction.getContactName() != null)&&(!transaction.equals(""))){ if ((transaction.getContactName() != null)&&(!transaction.equals(""))){
tvTo.setText(transaction.getContactName()); tvTo.setText(transaction.getContactName());
} else if ((transaction.getBitsharesAccountName() != null)&&(!transaction.equals(""))){
tvTo.setText(transaction.getBitsharesAccountName());
} }
} }
// } // }