package net.ktnx.mobileledger.ui.transaction_list;
+import android.app.Activity;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Typeface;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.StyleSpan;
-import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
-import androidx.appcompat.widget.AppCompatTextView;
import androidx.recyclerview.widget.RecyclerView;
import net.ktnx.mobileledger.App;
import net.ktnx.mobileledger.model.TransactionListItem;
import net.ktnx.mobileledger.utils.Colors;
import net.ktnx.mobileledger.utils.Globals;
+import net.ktnx.mobileledger.utils.Misc;
import java.text.DateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
-import static net.ktnx.mobileledger.utils.DimensionUtils.dp2px;
-
public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowHolder> {
public void onBindViewHolder(@NonNull TransactionRowHolder holder, int position) {
TransactionListItem item = TransactionListViewModel.getTransactionListItem(position);
case HEAD:
holder.tvDescription.setText(step.getTransaction()
.getDescription());
+ String trComment = Misc.emptyIsNull(step.getTransaction()
+ .getComment());
+ if (trComment == null)
+ holder.tvComment.setVisibility(View.GONE);
+ else {
+ holder.tvComment.setText(trComment);
+ holder.tvComment.setVisibility(View.VISIBLE);
+ }
- if (step.isOdd())
- holder.row.setBackgroundColor(Colors.tableRowDarkBG);
- else
- holder.row.setBackgroundColor(Colors.tableRowLightBG);
+// if (step.isOdd())
+// holder.row.setBackgroundColor(Colors.tableRowDarkBG);
+// else
+// holder.row.setBackgroundColor(Colors.tableRowLightBG);
break;
case ACCOUNTS:
if (row == null) {
LayoutInflater inflater = ((Activity) ctx).getLayoutInflater();
row = (LinearLayout) inflater.inflate(
- R.layout.transaction_list_row_accounts_table_row,
- holder.tableAccounts);
+ R.layout.transaction_list_row_accounts_table_row, null);
+ // if the rootView above is given (and the line below is spared)
+ // the accounts remain with their default text (set in the layout resource)
+ holder.tableAccounts.addView(row);
}
TextView accName = row.findViewById(R.id.transaction_list_acc_row_acc_name);
TextView accComment =