mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-04-04 13:27:36 +03:00
parent
8ce63cb5c5
commit
d244eef62e
3 changed files with 16 additions and 2 deletions
|
@ -117,7 +117,7 @@ class BreadcrumbAdapter(val context: Context)
|
||||||
PreferencesUtil.showExpiredEntries(context)
|
PreferencesUtil.showExpiredEntries(context)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
text = group.numberOfChildEntries.toString()
|
text = group.recursiveNumberOfChildEntries.toString()
|
||||||
visibility = View.VISIBLE
|
visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
visibility = View.GONE
|
visibility = View.GONE
|
||||||
|
|
|
@ -197,6 +197,7 @@ class NodesAdapter (
|
||||||
&& oldItem.containsAttachment() == newItem.containsAttachment()
|
&& oldItem.containsAttachment() == newItem.containsAttachment()
|
||||||
} else if (oldItem is Group && newItem is Group) {
|
} else if (oldItem is Group && newItem is Group) {
|
||||||
typeContentTheSame = oldItem.numberOfChildEntries == newItem.numberOfChildEntries
|
typeContentTheSame = oldItem.numberOfChildEntries == newItem.numberOfChildEntries
|
||||||
|
&& oldItem.recursiveNumberOfChildEntries == newItem.recursiveNumberOfChildEntries
|
||||||
&& oldItem.notes == newItem.notes
|
&& oldItem.notes == newItem.notes
|
||||||
}
|
}
|
||||||
return typeContentTheSame
|
return typeContentTheSame
|
||||||
|
@ -472,7 +473,7 @@ class NodesAdapter (
|
||||||
if (mShowNumberEntries) {
|
if (mShowNumberEntries) {
|
||||||
holder.numberChildren?.apply {
|
holder.numberChildren?.apply {
|
||||||
text = (subNode as Group)
|
text = (subNode as Group)
|
||||||
.numberOfChildEntries
|
.recursiveNumberOfChildEntries
|
||||||
.toString()
|
.toString()
|
||||||
setTextSize(mTextSizeUnit, mNumberChildrenTextDefaultDimension, mPrefSizeMultiplier)
|
setTextSize(mTextSizeUnit, mNumberChildrenTextDefaultDimension, mPrefSizeMultiplier)
|
||||||
visibility = View.VISIBLE
|
visibility = View.VISIBLE
|
||||||
|
|
|
@ -46,6 +46,7 @@ class Group : Node, GroupVersionedInterface<Group, Entry> {
|
||||||
var isVirtual = false
|
var isVirtual = false
|
||||||
|
|
||||||
var numberOfChildEntries: Int = 0
|
var numberOfChildEntries: Int = 0
|
||||||
|
var recursiveNumberOfChildEntries: Int = 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this constructor to copy a Group
|
* Use this constructor to copy a Group
|
||||||
|
@ -332,6 +333,18 @@ class Group : Node, GroupVersionedInterface<Group, Entry> {
|
||||||
|
|
||||||
fun refreshNumberOfChildEntries(filters: Array<ChildFilter> = emptyArray()) {
|
fun refreshNumberOfChildEntries(filters: Array<ChildFilter> = emptyArray()) {
|
||||||
this.numberOfChildEntries = getFilteredChildEntries(filters).size
|
this.numberOfChildEntries = getFilteredChildEntries(filters).size
|
||||||
|
this.recursiveNumberOfChildEntries = getFilteredChildEntriesInGroups(filters)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the cumulative number of entries in the current group and its children
|
||||||
|
*/
|
||||||
|
private fun getFilteredChildEntriesInGroups(filters: Array<ChildFilter>): Int {
|
||||||
|
var counter = 0
|
||||||
|
getChildGroups().forEach { childGroup ->
|
||||||
|
counter += childGroup.getFilteredChildEntriesInGroups(filters)
|
||||||
|
}
|
||||||
|
return getFilteredChildEntries(filters).size + counter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue