- void setLastUpdateText(String text) {
- tvLastUpdate.setText(text);
- }
- void setType(TransactionListItem.Type newType) {
- if (newType == lastType)
- return;
+ public void bind(@NonNull LedgerTransaction tr, @Nullable String boldAccountName) {
+ b.transactionRowDescription.setText(tr.getDescription());
+ String trComment = Misc.emptyIsNull(tr.getComment());
+ if (trComment == null)
+ b.transactionComment.setVisibility(View.GONE);
+ else {
+ b.transactionComment.setText(trComment);
+ b.transactionComment.setVisibility(View.VISIBLE);
+ }
+
+ int rowIndex = 0;
+ Context ctx = b.getRoot()
+ .getContext();
+ LayoutInflater inflater = ((Activity) ctx).getLayoutInflater();
+ for (LedgerTransactionAccount acc : tr.getAccounts()) {
+ LinearLayout row = (LinearLayout) b.transactionRowAccAmounts.getChildAt(rowIndex);
+ if (row == null) {
+ row = new LinearLayout(ctx);
+ inflater.inflate(R.layout.transaction_list_row_accounts_table_row, row);
+ b.transactionRowAccAmounts.addView(row);
+ }
+
+ TextView dummyText = row.findViewById(R.id.dummy_text);
+ TextView accName = row.findViewById(R.id.transaction_list_acc_row_acc_name);
+ TextView accComment = row.findViewById(R.id.transaction_list_acc_row_acc_comment);
+ TextView accAmount = row.findViewById(R.id.transaction_list_acc_row_acc_amount);