X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Faccount_summary%2FAccountSummaryAdapter.java;h=47cc14b45bc5311858e0522a2cc05c1bf52d588d;hb=77b60ba7a9bff0d76a0955eb7009f0d77e0e938f;hp=060828e746424e69f90f37704d469d30209cfbd8;hpb=e67c3f4928d4898f845c8414f59f4d896046558a;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java b/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java index 060828e7..47cc14b4 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java @@ -1,5 +1,5 @@ /* - * 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 @@ -46,14 +46,12 @@ public class AccountSummaryAdapter 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(); @@ -82,11 +80,6 @@ public class AccountSummaryAdapter } holder.row.setTag(R.id.POS, position); - } - else { - holder.vTrailer.setVisibility(View.VISIBLE); - holder.row.setVisibility(View.GONE); - } } } @@ -100,13 +93,11 @@ public class AccountSummaryAdapter @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; - View vTrailer; View expanderContainer; ImageView expander; View accountExpanderContainer; @@ -115,23 +106,11 @@ public class AccountSummaryAdapter 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 = itemView.findViewById(R.id.account_row_amounts_expander_container); - expanderContainer.addOnLayoutChangeListener( - (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { - int w = right - left; - int h = bottom - top; - if (h > w) { - int p = (h - w) / 2; - v.setPadding(0, p, 0, p); - } - else v.setPadding(0, 0, 0, 0); - }); - itemView.setOnLongClickListener(this::onItemLongClick); tvAccountName.setOnLongClickListener(this::onItemLongClick); tvAccountAmounts.setOnLongClickListener(this::onItemLongClick);