From 35f273de23502400ef4560ff79bb2b192cfd8357 Mon Sep 17 00:00:00 2001 From: Javier Varona Date: Mon, 17 Sep 2018 22:02:21 -0400 Subject: [PATCH] - Fixed Transaction List not updating when it should - Now the transaction list searches for bitshares account names too --- .../java/cy/agorise/crystalwallet/dao/TransactionDao.java | 2 +- .../crystalwallet/fragments/TransactionsFragment.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) 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 6e10049..3ba5a9e 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/dao/TransactionDao.java +++ b/app/src/main/java/cy/agorise/crystalwallet/dao/TransactionDao.java @@ -24,7 +24,7 @@ public interface TransactionDao { "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||'%'"; + "WHERE user_account_name LIKE '%'||:search||'%' OR contact_name LIKE '%'||:search||'%' OR cct.\"from\" LIKE '%'||:search||'%' OR cct.\"to\" LIKE '%'||:search||'%' OR banc.name LIKE '%'||:search||'%'"; @Query("SELECT * FROM crypto_coin_transaction") LiveData> getAll(); diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/TransactionsFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/TransactionsFragment.java index 83ce128..6e61b70 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/TransactionsFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/TransactionsFragment.java @@ -10,6 +10,7 @@ import android.support.design.widget.FloatingActionButton; import android.support.v4.app.Fragment; import android.support.v7.widget.RecyclerView; import android.text.Editable; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -112,9 +113,9 @@ public class TransactionsFragment extends Fragment { TransactionOrderSpinnerAdapter.TransactionOrderSpinnerItem orderSelected = (TransactionOrderSpinnerAdapter.TransactionOrderSpinnerItem)(spTransactionsOrder.getSelectedItem()); - if (transactionsLiveData != null){ - transactionsLiveData.removeObservers(this); - } + //if (transactionsLiveData != null){ + //transactionsLiveData.removeObservers(this); + //} transactionListViewModel.initTransactionList(orderSelected.getField(),etTransactionSearch.getText().toString()); transactionsLiveData = transactionListViewModel.getTransactionList(); @@ -122,6 +123,7 @@ public class TransactionsFragment extends Fragment { transactionsLiveData.observe(this, new Observer>() { @Override public void onChanged(@Nullable PagedList cryptoCoinTransactions) { + Log.i("Transactions","Transactions have change! Count:"+cryptoCoinTransactions.size()); transactionListView.setData(cryptoCoinTransactions, fragment); } });