]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/account_summary/AccountSummaryAdapter.java
drop accounts.hidden and "hidden by star" handling
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / account_summary / AccountSummaryAdapter.java
index b4064a80d262ea216f062da672f4bdd014e2c23d..0540438ddcd6c47e4e7d9e873c393cd4a50cdb66 100644 (file)
@@ -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
@@ -19,7 +19,6 @@ package net.ktnx.mobileledger.ui.account_summary;
 
 import android.content.Context;
 import android.content.res.Resources;
-import android.graphics.Typeface;
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -46,14 +45,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();
@@ -72,21 +69,7 @@ public class AccountSummaryAdapter
                     holder.accountExpanderContainer.setVisibility(View.GONE);
                 }
 
-                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);
-                }
-
                 holder.row.setTag(R.id.POS, position);
-            }
-            else {
-                holder.vTrailer.setVisibility(View.VISIBLE);
-                holder.row.setVisibility(View.GONE);
-            }
         }
     }
 
@@ -100,13 +83,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,7 +96,6 @@ 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 =