- Now the name of the coins appears in the balances, instead of "unknown";

This commit is contained in:
Javier Varona 2017-10-28 20:58:39 -04:00
parent 08152814b3
commit 131a5c5ea8
2 changed files with 9 additions and 2 deletions

View file

@ -20,7 +20,7 @@ public interface CryptoCurrencyDao {
List<CryptoCurrency> getAll(); List<CryptoCurrency> getAll();
@Query("SELECT * FROM crypto_currency WHERE id = :id") @Query("SELECT * FROM crypto_currency WHERE id = :id")
CryptoCurrency getById(int id); CryptoCurrency getById(long id);
@Query("SELECT * FROM crypto_currency WHERE id IN (:ids)") @Query("SELECT * FROM crypto_currency WHERE id IN (:ids)")
List<CryptoCurrency> getByIds(List<Long> ids); List<CryptoCurrency> getByIds(List<Long> ids);

View file

@ -1,12 +1,15 @@
package cy.agorise.crystalwallet.views; package cy.agorise.crystalwallet.views;
import android.content.Context;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import cy.agorise.crystalwallet.R; import cy.agorise.crystalwallet.R;
import cy.agorise.crystalwallet.dao.CrystalDatabase;
import cy.agorise.crystalwallet.models.CryptoCoinBalance; import cy.agorise.crystalwallet.models.CryptoCoinBalance;
import cy.agorise.crystalwallet.models.CryptoCoinTransaction; import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
import cy.agorise.crystalwallet.models.CryptoCurrency;
/** /**
* Created by Henry Varona on 17/9/2017. * Created by Henry Varona on 17/9/2017.
@ -15,11 +18,13 @@ import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
public class CryptoCoinBalanceViewHolder extends RecyclerView.ViewHolder { public class CryptoCoinBalanceViewHolder extends RecyclerView.ViewHolder {
private TextView cryptoCoinName; private TextView cryptoCoinName;
private TextView cryptoCoinBalance; private TextView cryptoCoinBalance;
private Context context;
public CryptoCoinBalanceViewHolder(View itemView) { public CryptoCoinBalanceViewHolder(View itemView) {
super(itemView); super(itemView);
cryptoCoinName = (TextView) itemView.findViewById(R.id.tvCryptoCoinName); cryptoCoinName = (TextView) itemView.findViewById(R.id.tvCryptoCoinName);
cryptoCoinBalance = (TextView) itemView.findViewById(R.id.tvCryptoCoinBalanceAmount); cryptoCoinBalance = (TextView) itemView.findViewById(R.id.tvCryptoCoinBalanceAmount);
this.context = itemView.getContext();
} }
@ -33,7 +38,9 @@ public class CryptoCoinBalanceViewHolder extends RecyclerView.ViewHolder {
cryptoCoinName.setText("loading..."); cryptoCoinName.setText("loading...");
cryptoCoinBalance.setText(""); cryptoCoinBalance.setText("");
} else { } else {
//cryptoCoinName.setText(balance.getCoin().getLabel()); CryptoCurrency currency = CrystalDatabase.getAppDatabase(this.context).cryptoCurrencyDao().getById(balance.getCryptoCurrencyId());
cryptoCoinName.setText(currency.getName());
cryptoCoinBalance.setText(""+balance.getBalance()); cryptoCoinBalance.setText(""+balance.getBalance());
} }
} }