mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Add group info dialog #1177
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
KeePassDX(3.1.0)
|
KeePassDX(3.1.0)
|
||||||
* Add breadcrumb
|
* Add breadcrumb
|
||||||
* Add path in search results #1148
|
* Add path in search results #1148
|
||||||
|
* Add group info dialog #1177
|
||||||
|
|
||||||
KeePassDX(3.0.4)
|
KeePassDX(3.0.4)
|
||||||
* Fix autofill inline bugs #1173 #1165
|
* Fix autofill inline bugs #1173 #1165
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import androidx.core.view.isVisible
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.kunzisoft.keepass.R
|
import com.kunzisoft.keepass.R
|
||||||
import com.kunzisoft.keepass.activities.dialogs.*
|
import com.kunzisoft.keepass.activities.dialogs.*
|
||||||
import com.kunzisoft.keepass.activities.fragments.GroupFragment
|
import com.kunzisoft.keepass.activities.dialogs.NodesFragment
|
||||||
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
|
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
|
||||||
import com.kunzisoft.keepass.activities.helpers.SpecialMode
|
import com.kunzisoft.keepass.activities.helpers.SpecialMode
|
||||||
import com.kunzisoft.keepass.activities.legacy.DatabaseLockActivity
|
import com.kunzisoft.keepass.activities.legacy.DatabaseLockActivity
|
||||||
@@ -76,9 +76,9 @@ import org.joda.time.DateTime
|
|||||||
class GroupActivity : DatabaseLockActivity(),
|
class GroupActivity : DatabaseLockActivity(),
|
||||||
DatePickerDialog.OnDateSetListener,
|
DatePickerDialog.OnDateSetListener,
|
||||||
TimePickerDialog.OnTimeSetListener,
|
TimePickerDialog.OnTimeSetListener,
|
||||||
GroupFragment.NodeClickListener,
|
NodesFragment.NodeClickListener,
|
||||||
GroupFragment.NodesActionMenuListener,
|
NodesFragment.NodesActionMenuListener,
|
||||||
GroupFragment.OnScrollListener,
|
NodesFragment.OnScrollListener,
|
||||||
SortDialogFragment.SortSelectionListener {
|
SortDialogFragment.SortSelectionListener {
|
||||||
|
|
||||||
// Views
|
// Views
|
||||||
@@ -103,7 +103,7 @@ class GroupActivity : DatabaseLockActivity(),
|
|||||||
|
|
||||||
private var mBreadcrumbAdapter: BreadcrumbAdapter? = null
|
private var mBreadcrumbAdapter: BreadcrumbAdapter? = null
|
||||||
|
|
||||||
private var mGroupFragment: GroupFragment? = null
|
private var mNodesFragment: NodesFragment? = null
|
||||||
private var mRecyclingBinEnabled = false
|
private var mRecyclingBinEnabled = false
|
||||||
private var mRecyclingBinIsCurrentGroup = false
|
private var mRecyclingBinIsCurrentGroup = false
|
||||||
private var mRequestStartupSearch = true
|
private var mRequestStartupSearch = true
|
||||||
@@ -164,8 +164,15 @@ class GroupActivity : DatabaseLockActivity(),
|
|||||||
// Open group on breadcrumb click
|
// Open group on breadcrumb click
|
||||||
onItemClickListener = { node, _ ->
|
onItemClickListener = { node, _ ->
|
||||||
finishNodeAction()
|
finishNodeAction()
|
||||||
mDatabase?.let { database ->
|
// If last item
|
||||||
onNodeClick(database, node)
|
val currentGroup = mCurrentGroup
|
||||||
|
if (currentGroup != null && node == currentGroup) {
|
||||||
|
GroupDialogFragment.launch(currentGroup.getGroupInfo())
|
||||||
|
.show(supportFragmentManager, "group_fragment")
|
||||||
|
} else {
|
||||||
|
mDatabase?.let { database ->
|
||||||
|
onNodeClick(database, node)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,15 +208,15 @@ class GroupActivity : DatabaseLockActivity(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the fragment with the list
|
// Initialize the fragment with the list
|
||||||
mGroupFragment =
|
mNodesFragment =
|
||||||
supportFragmentManager.findFragmentByTag(GROUP_FRAGMENT_TAG) as GroupFragment?
|
supportFragmentManager.findFragmentByTag(GROUP_FRAGMENT_TAG) as NodesFragment?
|
||||||
if (mGroupFragment == null)
|
if (mNodesFragment == null)
|
||||||
mGroupFragment = GroupFragment()
|
mNodesFragment = NodesFragment()
|
||||||
|
|
||||||
// Attach fragment to content view
|
// Attach fragment to content view
|
||||||
supportFragmentManager.beginTransaction().replace(
|
supportFragmentManager.beginTransaction().replace(
|
||||||
R.id.nodes_list_fragment_container,
|
R.id.nodes_list_fragment_container,
|
||||||
mGroupFragment!!,
|
mNodesFragment!!,
|
||||||
GROUP_FRAGMENT_TAG
|
GROUP_FRAGMENT_TAG
|
||||||
).commit()
|
).commit()
|
||||||
|
|
||||||
@@ -245,7 +252,7 @@ class GroupActivity : DatabaseLockActivity(),
|
|||||||
mDatabase?.let { database ->
|
mDatabase?.let { database ->
|
||||||
EntrySelectionHelper.doSpecialAction(intent,
|
EntrySelectionHelper.doSpecialAction(intent,
|
||||||
{
|
{
|
||||||
mGroupFragment?.mEntryActivityResultLauncher?.let { resultLauncher ->
|
mNodesFragment?.mEntryActivityResultLauncher?.let { resultLauncher ->
|
||||||
EntryEditActivity.launchToCreate(
|
EntryEditActivity.launchToCreate(
|
||||||
this@GroupActivity,
|
this@GroupActivity,
|
||||||
database,
|
database,
|
||||||
@@ -601,7 +608,7 @@ class GroupActivity : DatabaseLockActivity(),
|
|||||||
val entryVersioned = node as Entry
|
val entryVersioned = node as Entry
|
||||||
EntrySelectionHelper.doSpecialAction(intent,
|
EntrySelectionHelper.doSpecialAction(intent,
|
||||||
{
|
{
|
||||||
mGroupFragment?.mEntryActivityResultLauncher?.let { resultLauncher ->
|
mNodesFragment?.mEntryActivityResultLauncher?.let { resultLauncher ->
|
||||||
EntryActivity.launch(
|
EntryActivity.launch(
|
||||||
this@GroupActivity,
|
this@GroupActivity,
|
||||||
database,
|
database,
|
||||||
@@ -762,7 +769,7 @@ class GroupActivity : DatabaseLockActivity(),
|
|||||||
): Boolean {
|
): Boolean {
|
||||||
if (nodes.isNotEmpty()) {
|
if (nodes.isNotEmpty()) {
|
||||||
if (actionNodeMode == null || toolbarAction?.getSupportActionModeCallback() == null) {
|
if (actionNodeMode == null || toolbarAction?.getSupportActionModeCallback() == null) {
|
||||||
mGroupFragment?.actionNodesCallback(
|
mNodesFragment?.actionNodesCallback(
|
||||||
database,
|
database,
|
||||||
nodes,
|
nodes,
|
||||||
this
|
this
|
||||||
@@ -806,7 +813,7 @@ class GroupActivity : DatabaseLockActivity(),
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Type.ENTRY -> {
|
Type.ENTRY -> {
|
||||||
mGroupFragment?.mEntryActivityResultLauncher?.let { resultLauncher ->
|
mNodesFragment?.mEntryActivityResultLauncher?.let { resultLauncher ->
|
||||||
EntryEditActivity.launchToUpdate(
|
EntryEditActivity.launchToUpdate(
|
||||||
this@GroupActivity,
|
this@GroupActivity,
|
||||||
database,
|
database,
|
||||||
@@ -842,17 +849,17 @@ class GroupActivity : DatabaseLockActivity(),
|
|||||||
|
|
||||||
override fun onPasteMenuClick(
|
override fun onPasteMenuClick(
|
||||||
database: Database,
|
database: Database,
|
||||||
pasteMode: GroupFragment.PasteMode?,
|
pasteMode: NodesFragment.PasteMode?,
|
||||||
nodes: List<Node>
|
nodes: List<Node>
|
||||||
): Boolean {
|
): Boolean {
|
||||||
when (pasteMode) {
|
when (pasteMode) {
|
||||||
GroupFragment.PasteMode.PASTE_FROM_COPY -> {
|
NodesFragment.PasteMode.PASTE_FROM_COPY -> {
|
||||||
// Copy
|
// Copy
|
||||||
mCurrentGroup?.let { newParent ->
|
mCurrentGroup?.let { newParent ->
|
||||||
copyNodes(nodes, newParent)
|
copyNodes(nodes, newParent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GroupFragment.PasteMode.PASTE_FROM_MOVE -> {
|
NodesFragment.PasteMode.PASTE_FROM_MOVE -> {
|
||||||
// Move
|
// Move
|
||||||
mCurrentGroup?.let { newParent ->
|
mCurrentGroup?.let { newParent ->
|
||||||
moveNodes(nodes, newParent)
|
moveNodes(nodes, newParent)
|
||||||
@@ -1053,7 +1060,7 @@ class GroupActivity : DatabaseLockActivity(),
|
|||||||
sortNodeEnum: SortNodeEnum,
|
sortNodeEnum: SortNodeEnum,
|
||||||
sortNodeParameters: SortNodeEnum.SortNodeParameters
|
sortNodeParameters: SortNodeEnum.SortNodeParameters
|
||||||
) {
|
) {
|
||||||
mGroupFragment?.onSortSelected(sortNodeEnum, sortNodeParameters)
|
mNodesFragment?.onSortSelected(sortNodeEnum, sortNodeParameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun startActivity(intent: Intent) {
|
override fun startActivity(intent: Intent) {
|
||||||
@@ -1092,7 +1099,7 @@ class GroupActivity : DatabaseLockActivity(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
if (mGroupFragment?.nodeActionSelectionMode == true) {
|
if (mNodesFragment?.nodeActionSelectionMode == true) {
|
||||||
finishNodeAction()
|
finishNodeAction()
|
||||||
} else {
|
} else {
|
||||||
// Normal way when we are not in root
|
// Normal way when we are not in root
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2021 Jeremy Jamet / Kunzisoft.
|
||||||
|
*
|
||||||
|
* This file is part of KeePassDX.
|
||||||
|
*
|
||||||
|
* KeePassDX is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* KeePassDX is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with KeePassDX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.kunzisoft.keepass.activities.dialogs
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import com.kunzisoft.keepass.R
|
||||||
|
import com.kunzisoft.keepass.database.element.Database
|
||||||
|
import com.kunzisoft.keepass.database.element.icon.IconImage
|
||||||
|
import com.kunzisoft.keepass.model.GroupInfo
|
||||||
|
import com.kunzisoft.keepass.view.DateTimeFieldView
|
||||||
|
|
||||||
|
class GroupDialogFragment : DatabaseDialogFragment() {
|
||||||
|
|
||||||
|
private var mPopulateIconMethod: ((ImageView, IconImage) -> Unit)? = null
|
||||||
|
private var mGroupInfo = GroupInfo()
|
||||||
|
|
||||||
|
private lateinit var iconView: ImageView
|
||||||
|
private var mIconColor: Int = 0
|
||||||
|
private lateinit var nameTextView: TextView
|
||||||
|
private lateinit var notesTextLabelView: TextView
|
||||||
|
private lateinit var notesTextView: TextView
|
||||||
|
private lateinit var expirationView: DateTimeFieldView
|
||||||
|
private lateinit var creationView: TextView
|
||||||
|
private lateinit var modificationView: TextView
|
||||||
|
|
||||||
|
override fun onDatabaseRetrieved(database: Database?) {
|
||||||
|
super.onDatabaseRetrieved(database)
|
||||||
|
mPopulateIconMethod = { imageView, icon ->
|
||||||
|
database?.iconDrawableFactory?.assignDatabaseIcon(imageView, icon, mIconColor)
|
||||||
|
}
|
||||||
|
mPopulateIconMethod?.invoke(iconView, mGroupInfo.icon)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
activity?.let { activity ->
|
||||||
|
val root = activity.layoutInflater.inflate(R.layout.fragment_group, null)
|
||||||
|
iconView = root.findViewById(R.id.group_icon)
|
||||||
|
nameTextView = root.findViewById(R.id.group_name)
|
||||||
|
notesTextLabelView = root.findViewById(R.id.group_note_label)
|
||||||
|
notesTextView = root.findViewById(R.id.group_note)
|
||||||
|
expirationView = root.findViewById(R.id.group_expiration)
|
||||||
|
creationView = root.findViewById(R.id.group_created)
|
||||||
|
modificationView = root.findViewById(R.id.group_modified)
|
||||||
|
|
||||||
|
// Retrieve the textColor to tint the icon
|
||||||
|
val ta = activity.theme.obtainStyledAttributes(intArrayOf(R.attr.colorAccent))
|
||||||
|
mIconColor = ta.getColor(0, Color.WHITE)
|
||||||
|
ta.recycle()
|
||||||
|
|
||||||
|
if (savedInstanceState != null
|
||||||
|
&& savedInstanceState.containsKey(KEY_GROUP_INFO)) {
|
||||||
|
mGroupInfo = savedInstanceState.getParcelable(KEY_GROUP_INFO) ?: mGroupInfo
|
||||||
|
} else {
|
||||||
|
arguments?.apply {
|
||||||
|
if (containsKey(KEY_GROUP_INFO)) {
|
||||||
|
mGroupInfo = getParcelable(KEY_GROUP_INFO) ?: mGroupInfo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// populate info in views
|
||||||
|
nameTextView.text = mGroupInfo.title
|
||||||
|
val notes = mGroupInfo.notes
|
||||||
|
if (notes == null || notes.isEmpty()) {
|
||||||
|
notesTextLabelView.visibility = View.GONE
|
||||||
|
notesTextView.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
notesTextView.text = notes
|
||||||
|
notesTextLabelView.visibility = View.VISIBLE
|
||||||
|
notesTextView.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
expirationView.activation = mGroupInfo.expires
|
||||||
|
expirationView.dateTime = mGroupInfo.expiryTime
|
||||||
|
creationView.text = mGroupInfo.creationTime.getDateTimeString(resources)
|
||||||
|
modificationView.text = mGroupInfo.lastModificationTime.getDateTimeString(resources)
|
||||||
|
|
||||||
|
val builder = AlertDialog.Builder(activity)
|
||||||
|
builder.setView(root)
|
||||||
|
.setPositiveButton(android.R.string.ok){ _, _ ->
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
return builder.create()
|
||||||
|
}
|
||||||
|
return super.onCreateDialog(savedInstanceState)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
outState.putParcelable(KEY_GROUP_INFO, mGroupInfo)
|
||||||
|
super.onSaveInstanceState(outState)
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Error(val isError: Boolean, val messageId: Int?)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val KEY_GROUP_INFO = "KEY_GROUP_INFO"
|
||||||
|
|
||||||
|
fun launch(groupInfo: GroupInfo): GroupDialogFragment {
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putParcelable(KEY_GROUP_INFO, groupInfo)
|
||||||
|
val fragment = GroupDialogFragment()
|
||||||
|
fragment.arguments = bundle
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,10 +17,9 @@
|
|||||||
* along with KeePassDX. If not, see <http://www.gnu.org/licenses/>.
|
* along with KeePassDX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.kunzisoft.keepass.activities.fragments
|
package com.kunzisoft.keepass.activities.dialogs
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.*
|
import android.view.*
|
||||||
@@ -31,29 +30,28 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE
|
import androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE
|
||||||
import com.kunzisoft.keepass.R
|
import com.kunzisoft.keepass.R
|
||||||
import com.kunzisoft.keepass.activities.EntryEditActivity
|
import com.kunzisoft.keepass.activities.EntryEditActivity
|
||||||
import com.kunzisoft.keepass.activities.dialogs.SortDialogFragment
|
import com.kunzisoft.keepass.activities.fragments.DatabaseFragment
|
||||||
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
|
import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper
|
||||||
import com.kunzisoft.keepass.activities.helpers.SpecialMode
|
import com.kunzisoft.keepass.activities.helpers.SpecialMode
|
||||||
import com.kunzisoft.keepass.adapters.NodeAdapter
|
import com.kunzisoft.keepass.adapters.NodesAdapter
|
||||||
import com.kunzisoft.keepass.database.element.Database
|
import com.kunzisoft.keepass.database.element.Database
|
||||||
import com.kunzisoft.keepass.database.element.Group
|
import com.kunzisoft.keepass.database.element.Group
|
||||||
import com.kunzisoft.keepass.database.element.SortNodeEnum
|
import com.kunzisoft.keepass.database.element.SortNodeEnum
|
||||||
import com.kunzisoft.keepass.database.element.node.Node
|
import com.kunzisoft.keepass.database.element.node.Node
|
||||||
import com.kunzisoft.keepass.database.element.node.NodeId
|
|
||||||
import com.kunzisoft.keepass.database.element.node.Type
|
import com.kunzisoft.keepass.database.element.node.Type
|
||||||
import com.kunzisoft.keepass.settings.PreferencesUtil
|
import com.kunzisoft.keepass.settings.PreferencesUtil
|
||||||
import com.kunzisoft.keepass.tasks.ActionRunnable
|
import com.kunzisoft.keepass.tasks.ActionRunnable
|
||||||
import com.kunzisoft.keepass.viewmodels.GroupViewModel
|
import com.kunzisoft.keepass.viewmodels.GroupViewModel
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class GroupFragment : DatabaseFragment(), SortDialogFragment.SortSelectionListener {
|
class NodesFragment : DatabaseFragment(), SortDialogFragment.SortSelectionListener {
|
||||||
|
|
||||||
private var nodeClickListener: NodeClickListener? = null
|
private var nodeClickListener: NodeClickListener? = null
|
||||||
private var onScrollListener: OnScrollListener? = null
|
private var onScrollListener: OnScrollListener? = null
|
||||||
|
|
||||||
private var mNodesRecyclerView: RecyclerView? = null
|
private var mNodesRecyclerView: RecyclerView? = null
|
||||||
private var mLayoutManager: LinearLayoutManager? = null
|
private var mLayoutManager: LinearLayoutManager? = null
|
||||||
private var mAdapter: NodeAdapter? = null
|
private var mAdapter: NodesAdapter? = null
|
||||||
|
|
||||||
private val mGroupViewModel: GroupViewModel by activityViewModels()
|
private val mGroupViewModel: GroupViewModel by activityViewModels()
|
||||||
|
|
||||||
@@ -107,7 +105,7 @@ class GroupFragment : DatabaseFragment(), SortDialogFragment.SortSelectionListen
|
|||||||
} catch (e: ClassCastException) {
|
} catch (e: ClassCastException) {
|
||||||
// The activity doesn't implement the interface, throw exception
|
// The activity doesn't implement the interface, throw exception
|
||||||
throw ClassCastException(context.toString()
|
throw ClassCastException(context.toString()
|
||||||
+ " must implement " + NodeAdapter.NodeClickCallback::class.java.name)
|
+ " must implement " + NodesAdapter.NodeClickCallback::class.java.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -115,7 +113,8 @@ class GroupFragment : DatabaseFragment(), SortDialogFragment.SortSelectionListen
|
|||||||
} catch (e: ClassCastException) {
|
} catch (e: ClassCastException) {
|
||||||
onScrollListener = null
|
onScrollListener = null
|
||||||
// Context menu can be omit
|
// Context menu can be omit
|
||||||
Log.w(TAG, context.toString()
|
Log.w(
|
||||||
|
TAG, context.toString()
|
||||||
+ " must implement " + RecyclerView.OnScrollListener::class.java.name)
|
+ " must implement " + RecyclerView.OnScrollListener::class.java.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,8 +137,8 @@ class GroupFragment : DatabaseFragment(), SortDialogFragment.SortSelectionListen
|
|||||||
|
|
||||||
contextThemed?.let { context ->
|
contextThemed?.let { context ->
|
||||||
database?.let { database ->
|
database?.let { database ->
|
||||||
mAdapter = NodeAdapter(context, database).apply {
|
mAdapter = NodesAdapter(context, database).apply {
|
||||||
setOnNodeClickListener(object : NodeAdapter.NodeClickCallback {
|
setOnNodeClickListener(object : NodesAdapter.NodeClickCallback {
|
||||||
override fun onNodeClick(database: Database, node: Node) {
|
override fun onNodeClick(database: Database, node: Node) {
|
||||||
if (nodeActionSelectionMode) {
|
if (nodeActionSelectionMode) {
|
||||||
if (listActionNodes.contains(node)) {
|
if (listActionNodes.contains(node)) {
|
||||||
@@ -195,7 +194,7 @@ class GroupFragment : DatabaseFragment(), SortDialogFragment.SortSelectionListen
|
|||||||
super.onCreateView(inflater, container, savedInstanceState)
|
super.onCreateView(inflater, container, savedInstanceState)
|
||||||
// To apply theme
|
// To apply theme
|
||||||
return inflater.cloneInContext(contextThemed)
|
return inflater.cloneInContext(contextThemed)
|
||||||
.inflate(R.layout.fragment_group, container, false)
|
.inflate(R.layout.fragment_nodes, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
@@ -448,6 +447,6 @@ class GroupFragment : DatabaseFragment(), SortDialogFragment.SortSelectionListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val TAG = GroupFragment::class.java.name
|
private val TAG = NodesFragment::class.java.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,9 +55,9 @@ import java.util.*
|
|||||||
* Create node list adapter with contextMenu or not
|
* Create node list adapter with contextMenu or not
|
||||||
* @param context Context to use
|
* @param context Context to use
|
||||||
*/
|
*/
|
||||||
class NodeAdapter (private val context: Context,
|
class NodesAdapter (private val context: Context,
|
||||||
private val database: Database)
|
private val database: Database)
|
||||||
: RecyclerView.Adapter<NodeAdapter.NodeViewHolder>() {
|
: RecyclerView.Adapter<NodesAdapter.NodeViewHolder>() {
|
||||||
|
|
||||||
private var mNodeComparator: Comparator<NodeVersionedInterface<Group>>? = null
|
private var mNodeComparator: Comparator<NodeVersionedInterface<Group>>? = null
|
||||||
private val mNodeSortedListCallback: NodeSortedListCallback
|
private val mNodeSortedListCallback: NodeSortedListCallback
|
||||||
@@ -169,6 +169,7 @@ class NodeAdapter (private val context: Context,
|
|||||||
&& 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.notes == newItem.notes
|
||||||
}
|
}
|
||||||
return typeContentTheSame
|
return typeContentTheSame
|
||||||
&& oldItem.nodeId == newItem.nodeId
|
&& oldItem.nodeId == newItem.nodeId
|
||||||
@@ -522,6 +523,6 @@ class NodeAdapter (private val context: Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val TAG = NodeAdapter::class.java.name
|
private val TAG = NodesAdapter::class.java.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright 2019 Jeremy Jamet / Kunzisoft.
|
Copyright 2019 Jeremy Jamet / Kunzisoft.
|
||||||
|
|
||||||
This file is part of KeePassDX.
|
This file is part of KeePassDX.
|
||||||
|
|
||||||
KeePassDX is free software: you can redistribute it and/or modify
|
KeePassDX is free software: you can redistribute it and/or modify
|
||||||
@@ -17,38 +17,104 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with KeePassDX. If not, see <http://www.gnu.org/licenses/>.
|
along with KeePassDX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<FrameLayout
|
<androidx.core.widget.NestedScrollView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/nodes_list"
|
<LinearLayout
|
||||||
android:contentDescription="@string/content_description_node_children"
|
android:orientation="vertical"
|
||||||
android:scrollbars="vertical"
|
android:layout_width="match_parent"
|
||||||
android:scrollbarStyle="insideOverlay"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:importantForAutofill="noExcludeDescendants">
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="?android:attr/windowBackground"
|
<FrameLayout
|
||||||
android:paddingBottom="?attr/actionBarSize"
|
android:layout_width="match_parent"
|
||||||
android:clipToPadding="false" />
|
android:layout_height="wrap_content"
|
||||||
<LinearLayout
|
android:background="?attr/colorPrimary">
|
||||||
android:id="@+id/not_found_container"
|
<LinearLayout
|
||||||
android:layout_gravity="center"
|
android:id="@+id/title_block"
|
||||||
android:orientation="vertical"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:orientation="vertical"
|
||||||
android:visibility="gone">
|
android:padding="@dimen/default_margin"
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
android:background="@drawable/background_repeat"
|
||||||
android:id="@+id/not_found_img"
|
android:gravity="center"
|
||||||
android:layout_width="wrap_content"
|
style="@style/KeepassDXStyle.TextAppearance.Default">
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
<!-- Icon -->
|
||||||
android:src="@drawable/img_not_found"/>
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
<TextView
|
android:id="@+id/group_icon"
|
||||||
android:id="@+id/not_found_text"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_gravity="center"
|
||||||
android:text="@string/no_results"/>
|
android:layout_margin="@dimen/default_margin"
|
||||||
</LinearLayout>
|
android:src="@drawable/ic_blank_32dp"
|
||||||
</FrameLayout>
|
style="@style/KeepassDXStyle.Icon"/>
|
||||||
|
|
||||||
|
<!-- Name -->
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/group_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
style="@style/KeepassDXStyle.Expanded.Title" />
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/default_margin"
|
||||||
|
tools:targetApi="o">
|
||||||
|
|
||||||
|
<!-- Note -->
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/group_note_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/entry_notes"
|
||||||
|
style="@style/KeepassDXStyle.TextAppearance.LabelTextStyle" />
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/group_note"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="textMultiLine"
|
||||||
|
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
|
||||||
|
|
||||||
|
<!-- Expiration -->
|
||||||
|
<com.kunzisoft.keepass.view.DateTimeFieldView
|
||||||
|
android:id="@+id/group_expiration"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<!-- Created -->
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/group_created_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/entry_created"
|
||||||
|
style="@style/KeepassDXStyle.TextAppearance.LabelTextStyle" />
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/group_created"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
|
||||||
|
|
||||||
|
<!-- Modified -->
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/group_modified_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/entry_modified"
|
||||||
|
style="@style/KeepassDXStyle.TextAppearance.LabelTextStyle" />
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/group_modified"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/KeepassDXStyle.TextAppearance.TextEntryItem" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|||||||
54
app/src/main/res/layout/fragment_nodes.xml
Normal file
54
app/src/main/res/layout/fragment_nodes.xml
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2019 Jeremy Jamet / Kunzisoft.
|
||||||
|
|
||||||
|
This file is part of KeePassDX.
|
||||||
|
|
||||||
|
KeePassDX is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
KeePassDX is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with KeePassDX. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<FrameLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/nodes_list"
|
||||||
|
android:contentDescription="@string/content_description_node_children"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
android:scrollbarStyle="insideOverlay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?android:attr/windowBackground"
|
||||||
|
android:paddingBottom="?attr/actionBarSize"
|
||||||
|
android:clipToPadding="false" />
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/not_found_container"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone">
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/not_found_img"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:src="@drawable/img_not_found"/>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/not_found_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/no_results"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
* Add breadcrumb
|
* Add breadcrumb
|
||||||
* Add path in search results #1148
|
* Add path in search results #1148
|
||||||
|
* Add group info dialog #1177
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
* Ajout d'un fil d'ariane
|
* Ajout d'un fil d'ariane
|
||||||
* Ajout du chemin pour les résultats de recherche #1148
|
* Ajout du chemin pour les résultats de recherche #1148
|
||||||
|
* Ajout d'un dialogue pour les informations de groupe #1177
|
||||||
Reference in New Issue
Block a user