summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b597867)
looks bad when the accounts tree is all collapsed and the top-level accounts are
not enough to fill the screen height
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2020 Damyan Ivanov.
* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
public void onBindViewHolder(@NonNull LedgerRowHolder holder, int position) {
try (LockHolder lh = Data.accounts.lockForReading()) {
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);
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();
holder.tvAccountName.setText(acc.getShortName());
ConstraintLayout.LayoutParams lp =
(ConstraintLayout.LayoutParams) holder.tvAccountName.getLayoutParams();
}
holder.row.setTag(R.id.POS, position);
}
holder.row.setTag(R.id.POS, position);
- }
- else {
- // FIXME trailer's divider looks bad
- // perhaps replace the trailer with bottom padding for the last item?
- holder.vTrailer.setVisibility(View.VISIBLE);
- holder.row.setVisibility(View.GONE);
- }
@Override
public int getItemCount() {
@Override
public int getItemCount() {
- return Data.accounts.size() + (Data.profile.getValue()
- .isPostingPermitted() ? 1 : 0);
+ return Data.accounts.size();
}
static class LedgerRowHolder extends RecyclerView.ViewHolder {
TextView tvAccountName, tvAccountAmounts;
ConstraintLayout row;
}
static class LedgerRowHolder extends RecyclerView.ViewHolder {
TextView tvAccountName, tvAccountAmounts;
ConstraintLayout row;
View expanderContainer;
ImageView expander;
View accountExpanderContainer;
View expanderContainer;
ImageView expander;
View accountExpanderContainer;
this.row = itemView.findViewById(R.id.account_summary_row);
this.tvAccountName = itemView.findViewById(R.id.account_row_acc_name);
this.tvAccountAmounts = itemView.findViewById(R.id.account_row_acc_amounts);
this.row = itemView.findViewById(R.id.account_summary_row);
this.tvAccountName = itemView.findViewById(R.id.account_row_acc_name);
this.tvAccountAmounts = itemView.findViewById(R.id.account_row_acc_amounts);
- this.vTrailer = itemView.findViewById(R.id.account_summary_trailer);
this.expanderContainer = itemView.findViewById(R.id.account_expander_container);
this.expander = itemView.findViewById(R.id.account_expander);
this.accountExpanderContainer =
this.expanderContainer = itemView.findViewById(R.id.account_expander_container);
this.expander = itemView.findViewById(R.id.account_expander);
this.accountExpanderContainer =
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
- <View
- android:id="@+id/account_summary_trailer"
- android:layout_width="match_parent"
- android:layout_height="80dp"
- />