From de9a201587bfefc9fed8adba3db5a0a2e9557fde Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 15 Nov 2019 12:05:53 +0530 Subject: Also count subdirectories in child count (#573) * Also count sub-directories in child count * Respect hidden folders setting in child count Signed-off-by: Harsh Shandilya --- .../com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt b/app/src/main/java/com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt index f5b982bb..893ece62 100644 --- a/app/src/main/java/com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt +++ b/app/src/main/java/com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt @@ -4,11 +4,13 @@ */ package com.zeapo.pwdstore.ui.adapters +import android.content.SharedPreferences import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.appcompat.widget.AppCompatImageView import androidx.appcompat.widget.AppCompatTextView +import androidx.preference.PreferenceManager import androidx.recyclerview.widget.RecyclerView import com.zeapo.pwdstore.R import com.zeapo.pwdstore.utils.PasswordItem @@ -19,6 +21,7 @@ import java.util.TreeSet abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList) : RecyclerView.Adapter() { internal val selectedItems: MutableSet = TreeSet() + internal var settings: SharedPreferences? = null // Return the size of your dataset (invoked by the layout manager) override fun getItemCount(): Int { @@ -76,13 +79,18 @@ abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList

File(current, name).isFile } ?: emptyArray()).size + val children = pass.file.listFiles { pathname -> + !(!showHidden && (pathname.isDirectory && pathname.isHidden)) + } ?: emptyArray() + val childCount = children.size if (childCount > 0) { holder.childCount.visibility = View.VISIBLE holder.childCount.text = "$childCount" -- cgit v1.2.3