- Fixed Transaction List not updating when it should

- Now the transaction list searches for bitshares account names too
This commit is contained in:
Javier Varona 2018-09-17 22:02:21 -04:00
parent de2391c6f8
commit 35f273de23
2 changed files with 6 additions and 4 deletions

View file

@ -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<List<CryptoCoinTransaction>> getAll();

View file

@ -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<PagedList<CryptoCoinTransactionExtended>>() {
@Override
public void onChanged(@Nullable PagedList<CryptoCoinTransactionExtended> cryptoCoinTransactions) {
Log.i("Transactions","Transactions have change! Count:"+cryptoCoinTransactions.size());
transactionListView.setData(cryptoCoinTransactions, fragment);
}
});