- public void onBindViewHolder(@NonNull LedgerRowHolder holder, int position) {
- try (LockHolder lh = Data.accounts.lockForReading()) {
- if (position < Data.accounts.size()) {
- LedgerAccount acc = Data.accounts.get(position);
- Context ctx = holder.row.getContext();
- Resources rm = ctx.getResources();
-
- holder.row.setTag(acc);
- holder.row.setVisibility(View.VISIBLE);
- holder.vTrailer.setVisibility(View.GONE);
- holder.tvAccountName.setText(acc.getShortName());
- ConstraintLayout.LayoutParams lp =
- (ConstraintLayout.LayoutParams) holder.tvAccountName.getLayoutParams();
- lp.setMarginStart(
- acc.getLevel() * rm.getDimensionPixelSize(R.dimen.thumb_row_height) / 2);
- holder.expanderContainer
- .setVisibility(acc.hasSubAccounts() ? View.VISIBLE : View.INVISIBLE);
- holder.expanderContainer.setRotation(acc.isExpanded() ? 0 : 180);
- holder.tvAccountAmounts.setText(acc.getAmountsString());
-
- if (acc.isHiddenByStar()) {
- holder.tvAccountName.setTypeface(null, Typeface.ITALIC);
- holder.tvAccountAmounts.setTypeface(null, Typeface.ITALIC);
- }
- else {
- holder.tvAccountName.setTypeface(null, Typeface.NORMAL);
- holder.tvAccountAmounts.setTypeface(null, Typeface.NORMAL);
- }