import android.content.Context;
import android.content.res.Resources;
import android.database.sqlite.SQLiteDatabase;
-import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import net.ktnx.mobileledger.model.LedgerTransaction;
import net.ktnx.mobileledger.model.LedgerTransactionAccount;
+import net.ktnx.mobileledger.utils.Globals;
import net.ktnx.mobileledger.utils.MLDB;
import java.util.Iterator;
public void onBindViewHolder(@NonNull TransactionRowHolder holder, int position) {
LedgerTransaction tr = transactions.get(position);
Context ctx = holder.row.getContext();
- Resources rm = ctx.getResources();
- try (SQLiteDatabase db = MLDB.getReadableDatabase(ctx.getApplicationContext())) {
+
+ try (SQLiteDatabase db = MLDB.getReadableDatabase(ctx)) {
tr.loadData(db);
holder.tvDescription
}
if (position % 2 == 0) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) holder.row
- .setBackgroundColor(rm.getColor(R.color.table_row_even_bg, ctx.getTheme()));
- else holder.row.setBackgroundColor(rm.getColor(R.color.table_row_even_bg));
+ holder.row.setBackgroundColor(Globals.table_row_even_bg);
}
else {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) holder.row
- .setBackgroundColor(rm.getColor(R.color.table_row_odd_bg, ctx
- .getTheme()));
- else holder.row.setBackgroundColor(rm.getColor(R.color.table_row_odd_bg));
+ holder.row.setBackgroundColor(Globals.table_row_odd_bg);
}
holder.row.setTag(R.id.POS, position);