mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix database v1 available features
This commit is contained in:
@@ -23,6 +23,7 @@ import android.app.Dialog
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.activityViewModels
|
||||
@@ -57,9 +58,12 @@ class GroupEditDialogFragment : DatabaseDialogFragment() {
|
||||
private lateinit var notesTextLayoutView: TextInputLayout
|
||||
private lateinit var notesTextView: TextView
|
||||
private lateinit var expirationView: DateTimeEditFieldView
|
||||
private lateinit var searchableContainerView: TextInputLayout
|
||||
private lateinit var searchableView: InheritedCompletionView
|
||||
private lateinit var autoTypeContainerView: ViewGroup
|
||||
private lateinit var autoTypeInheritedView: InheritedCompletionView
|
||||
private lateinit var autoTypeSequenceView: TextView
|
||||
private lateinit var tagsContainerView: TextInputLayout
|
||||
private lateinit var tagsCompletionView: TagsCompletionView
|
||||
private var tagsAdapter: FilteredArrayAdapter<String>? = null
|
||||
|
||||
@@ -120,11 +124,28 @@ class GroupEditDialogFragment : DatabaseDialogFragment() {
|
||||
}
|
||||
mPopulateIconMethod?.invoke(iconButtonView, mGroupInfo.icon)
|
||||
|
||||
searchableContainerView.visibility = if (database?.allowCustomSearchableGroup() == true) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
|
||||
if (database?.allowAutoType() == true) {
|
||||
autoTypeContainerView.visibility = View.VISIBLE
|
||||
} else {
|
||||
autoTypeContainerView.visibility = View.GONE
|
||||
}
|
||||
|
||||
tagsAdapter = TagsProposalAdapter(requireContext(), database?.tagPool)
|
||||
tagsCompletionView.apply {
|
||||
threshold = 1
|
||||
setAdapter(tagsAdapter)
|
||||
}
|
||||
tagsContainerView.visibility = if (database?.allowTags() == true) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
@@ -136,9 +157,12 @@ class GroupEditDialogFragment : DatabaseDialogFragment() {
|
||||
notesTextLayoutView = root.findViewById(R.id.group_edit_note_container)
|
||||
notesTextView = root.findViewById(R.id.group_edit_note)
|
||||
expirationView = root.findViewById(R.id.group_edit_expiration)
|
||||
searchableContainerView = root.findViewById(R.id.group_edit_searchable_container)
|
||||
searchableView = root.findViewById(R.id.group_edit_searchable)
|
||||
autoTypeContainerView = root.findViewById(R.id.group_edit_auto_type_container)
|
||||
autoTypeInheritedView = root.findViewById(R.id.group_edit_auto_type_inherited)
|
||||
autoTypeSequenceView = root.findViewById(R.id.group_edit_auto_type_sequence)
|
||||
tagsContainerView = root.findViewById(R.id.group_tags_label)
|
||||
tagsCompletionView = root.findViewById(R.id.group_tags_completion_view)
|
||||
|
||||
// Retrieve the textColor to tint the icon
|
||||
|
||||
@@ -1261,6 +1261,14 @@ class Database {
|
||||
return mDatabaseKDBX != null
|
||||
}
|
||||
|
||||
fun allowAutoType(): Boolean {
|
||||
return mDatabaseKDBX != null
|
||||
}
|
||||
|
||||
fun allowTags(): Boolean {
|
||||
return mDatabaseKDBX != null
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove oldest history for each entry if more than max items or max memory
|
||||
*/
|
||||
|
||||
@@ -435,7 +435,7 @@ class Group : Node, GroupVersionedInterface<Group, Entry> {
|
||||
}
|
||||
|
||||
var searchable: Boolean?
|
||||
get() = groupKDBX?.enableSearching
|
||||
get() = if (groupKDB != null) true else groupKDBX?.enableSearching
|
||||
set(value) {
|
||||
groupKDBX?.enableSearching = value
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
android:id="@+id/group_edit_expiration"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- TODO Auto-type -->
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/group_edit_searchable_container"
|
||||
style="@style/KeepassDXStyle.TextInputLayout.ExposedMenu"
|
||||
@@ -78,32 +77,39 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="none" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/group_edit_auto_type_inherited_container"
|
||||
style="@style/KeepassDXStyle.TextInputLayout.ExposedMenu"
|
||||
android:visibility="gone"
|
||||
android:hint="@string/auto_type"
|
||||
<!-- TODO Auto-type -->
|
||||
<LinearLayout
|
||||
android:id="@+id/group_edit_auto_type_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.kunzisoft.keepass.view.InheritedCompletionView
|
||||
android:id="@+id/group_edit_auto_type_inherited"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/group_edit_auto_type_inherited_container"
|
||||
style="@style/KeepassDXStyle.TextInputLayout.ExposedMenu"
|
||||
android:visibility="gone"
|
||||
android:hint="@string/auto_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="none" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/group_edit_auto_type_sequence_container"
|
||||
android:visibility="gone"
|
||||
android:hint="@string/auto_type_sequence"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/group_edit_auto_type_sequence"
|
||||
android:layout_height="wrap_content">
|
||||
<com.kunzisoft.keepass.view.InheritedCompletionView
|
||||
android:id="@+id/group_edit_auto_type_inherited"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="none" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/group_edit_auto_type_sequence_container"
|
||||
android:visibility="gone"
|
||||
android:hint="@string/auto_type_sequence"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"/>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
android:layout_height="wrap_content">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/group_edit_auto_type_sequence"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"/>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/group_tags_label"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user