- 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:
parent
bb2e98431b
commit
39a8a1e446
4 changed files with 14 additions and 1 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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(); }
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
|
Loading…
Reference in a new issue