mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix search
This commit is contained in:
@@ -86,6 +86,9 @@ class GroupActivity : DatabaseLockActivity(),
|
||||
private var lockView: View? = null
|
||||
private var toolbar: Toolbar? = null
|
||||
private var databaseNameView: TextView? = null
|
||||
private var searchContainer: ViewGroup? = null
|
||||
private var searchNumbers: TextView? = null
|
||||
private var searchString: TextView? = null
|
||||
private var toolbarBreadcrumb: Toolbar? = null
|
||||
private var searchTitleView: View? = null
|
||||
private var toolbarAction: ToolbarAction? = null
|
||||
@@ -139,6 +142,9 @@ class GroupActivity : DatabaseLockActivity(),
|
||||
addNodeButtonView = findViewById(R.id.add_node_button)
|
||||
toolbar = findViewById(R.id.toolbar)
|
||||
databaseNameView = findViewById(R.id.database_name)
|
||||
searchContainer = findViewById(R.id.search_container)
|
||||
searchNumbers = findViewById(R.id.search_numbers)
|
||||
searchString = findViewById(R.id.search_string)
|
||||
toolbarBreadcrumb = findViewById(R.id.toolbar_breadcrumb)
|
||||
searchTitleView = findViewById(R.id.search_title)
|
||||
breadcrumbListView = findViewById(R.id.breadcrumb_list)
|
||||
@@ -524,13 +530,17 @@ class GroupActivity : DatabaseLockActivity(),
|
||||
|
||||
private fun assignGroupViewElements(group: Group?) {
|
||||
// Assign title
|
||||
|
||||
if (group?.isVirtual == true) {
|
||||
searchTitleView?.visibility = View.VISIBLE
|
||||
searchContainer?.visibility = View.VISIBLE
|
||||
val title = group.title
|
||||
searchString?.text = if (title.isNotEmpty()) title else ""
|
||||
searchNumbers?.text = group.numberOfChildEntries.toString()
|
||||
databaseNameView?.visibility = View.GONE
|
||||
toolbarBreadcrumb?.navigationIcon = null
|
||||
toolbarBreadcrumb?.visibility = View.GONE
|
||||
} else {
|
||||
searchTitleView?.visibility = View.GONE
|
||||
searchContainer?.visibility = View.GONE
|
||||
databaseNameView?.visibility = View.VISIBLE
|
||||
// Assign the group icon depending of IconPack or custom icon
|
||||
group?.let {
|
||||
if (group.containsParent())
|
||||
@@ -539,11 +549,10 @@ class GroupActivity : DatabaseLockActivity(),
|
||||
toolbarBreadcrumb?.navigationIcon = null
|
||||
}
|
||||
}
|
||||
toolbarBreadcrumb?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
// Assign number of children
|
||||
mBreadcrumbAdapter?.setNode(group)
|
||||
toolbarBreadcrumb?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
// Hide button
|
||||
initAddButton(group)
|
||||
|
||||
@@ -69,7 +69,7 @@ class BreadcrumbAdapter(val context: Context)
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BreadcrumbGroupViewHolder {
|
||||
return BreadcrumbGroupViewHolder(inflater.inflate(
|
||||
when (viewType) {
|
||||
0 -> R.layout.item_breadcrumb_current
|
||||
0 -> R.layout.item_group
|
||||
else -> R.layout.item_breadcrumb
|
||||
}, parent, false)
|
||||
)
|
||||
|
||||
@@ -44,15 +44,48 @@
|
||||
android:id="@+id/database_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Database"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Title.TextOnPrimary" />
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<TextView android:id="@+id/search_title"
|
||||
android:layout_width="match_parent"
|
||||
<RelativeLayout
|
||||
android:id="@+id/search_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/search_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/search_results"
|
||||
android:visibility="gone"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Default.TextOnPrimary" />
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/search_numbers"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="3"
|
||||
android:layout_margin="4dp"
|
||||
android:layout_below="@+id/search_title"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Info" />
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/search_string"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/search"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_below="@+id/search_title"
|
||||
android:layout_toRightOf="@+id/search_numbers"
|
||||
android:layout_toEndOf="@+id/search_numbers"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Title.TextOnPrimary" />
|
||||
</RelativeLayout>
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/group_coordinator"
|
||||
|
||||
Reference in New Issue
Block a user