X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2FTransactionListAdapter.java;fp=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2FTransactionListAdapter.java;h=263aa96e23b896e090e7b79c36be43f9f83ced55;hp=d0b2e9433e7c8a5c5893c4f2674cd4caa02251a0;hb=70c486fbea2d6606f68d35fceedc90680fd13f7f;hpb=6c58c1072c9af6ea0d0f52baeae7f95ba7f7ee2f diff --git a/app/src/main/java/net/ktnx/mobileledger/TransactionListAdapter.java b/app/src/main/java/net/ktnx/mobileledger/TransactionListAdapter.java index d0b2e943..263aa96e 100644 --- a/app/src/main/java/net/ktnx/mobileledger/TransactionListAdapter.java +++ b/app/src/main/java/net/ktnx/mobileledger/TransactionListAdapter.java @@ -53,37 +53,34 @@ class TransactionListAdapter try (SQLiteDatabase db = MLDB.getReadableDatabase(ctx.getApplicationContext())) { tr.loadData(db); - holder.tvDescription - .setText(String.format("%s\n%s", tr.getDescription(), tr.getDate())); - TableLayout tbl = holder.row.findViewById(R.id.transaction_row_acc_amounts); - tbl.removeAllViews(); - for (Iterator it = tr.getItemsIterator(); it.hasNext(); ) { - LedgerTransactionItem acc = it.next(); - TableRow row = new TableRow(holder.row.getContext()); - TextView child = new TextView(ctx); - child.setText(acc.getShortAccountName()); - row.addView(child); - child = new TextView(ctx); - child.setText(acc.toString()); - row.addView(child); - tbl.addView(row); - } - - 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)); - } - else { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) holder.row - .setBackgroundColor( - rm.getColor(R.color.drawer_background, ctx.getTheme())); - else holder.row.setBackgroundColor(rm.getColor(R.color.drawer_background)); - } + holder.tvDescription + .setText(String.format("%s\n%s", tr.getDescription(), tr.getDate())); + TableLayout tbl = holder.row.findViewById(R.id.transaction_row_acc_amounts); + tbl.removeAllViews(); + for (Iterator it = tr.getItemsIterator(); it.hasNext(); ) { + LedgerTransactionItem acc = it.next(); + TableRow row = new TableRow(holder.row.getContext()); + TextView child = new TextView(ctx); + child.setText(acc.getShortAccountName()); + row.addView(child); + child = new TextView(ctx); + child.setText(acc.toString()); + row.addView(child); + tbl.addView(row); + } - holder.row.setTag(R.id.POS, position); + 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)); } + else { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) holder.row + .setBackgroundColor(rm.getColor(R.color.drawer_background, ctx.getTheme())); + else holder.row.setBackgroundColor(rm.getColor(R.color.drawer_background)); + } + + holder.row.setTag(R.id.POS, position); } }