mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
New icon selection style and fix views
This commit is contained in:
@@ -752,9 +752,7 @@ class GroupActivity : LockingActivity(),
|
||||
icon: PwIcon?) {
|
||||
val database = App.currentDatabase
|
||||
|
||||
if (name.isNullOrEmpty() || icon == null)
|
||||
Toast.makeText(this, R.string.error_no_name, Toast.LENGTH_LONG).show()
|
||||
else {
|
||||
if (name != null && name.isNotEmpty() && icon != null) {
|
||||
when (action) {
|
||||
GroupEditDialogFragment.EditGroupDialogAction.CREATION -> {
|
||||
// If group creation
|
||||
|
||||
@@ -23,8 +23,10 @@ import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.support.design.widget.TextInputLayout
|
||||
import android.support.v4.app.DialogFragment
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.widget.Button
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.kunzisoft.keepass.R
|
||||
@@ -46,6 +48,8 @@ class GroupEditDialogFragment : DialogFragment(), IconPickerDialogFragment.IconP
|
||||
private var nameGroup: String? = null
|
||||
private var iconGroup: PwIcon? = null
|
||||
|
||||
private var nameTextLayoutView: TextInputLayout? = null
|
||||
private var nameTextView: TextView? = null
|
||||
private var iconButtonView: ImageView? = null
|
||||
private var iconColor: Int = 0
|
||||
|
||||
@@ -76,11 +80,12 @@ class GroupEditDialogFragment : DialogFragment(), IconPickerDialogFragment.IconP
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
activity?.let { activity ->
|
||||
val root = activity.layoutInflater.inflate(R.layout.group_edit, null)
|
||||
val nameField = root?.findViewById<TextView>(R.id.group_edit_name)
|
||||
nameTextLayoutView = root?.findViewById(R.id.group_edit_name_container)
|
||||
nameTextView = root?.findViewById(R.id.group_edit_name)
|
||||
iconButtonView = root?.findViewById(R.id.group_edit_icon_button)
|
||||
|
||||
// Retrieve the textColor to tint the icon
|
||||
val ta = activity.theme.obtainStyledAttributes(intArrayOf(android.R.attr.textColorPrimary))
|
||||
val ta = activity.theme.obtainStyledAttributes(intArrayOf(android.R.attr.textColor))
|
||||
iconColor = ta.getColor(0, Color.WHITE)
|
||||
ta.recycle()
|
||||
|
||||
@@ -111,27 +116,18 @@ class GroupEditDialogFragment : DialogFragment(), IconPickerDialogFragment.IconP
|
||||
}
|
||||
|
||||
// populate the name
|
||||
nameField?.text = nameGroup
|
||||
nameTextView?.text = nameGroup
|
||||
// populate the icon
|
||||
assignIconView()
|
||||
|
||||
val builder = AlertDialog.Builder(activity)
|
||||
builder.setView(root)
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
editGroupListener?.approveEditGroup(
|
||||
editGroupDialogAction,
|
||||
nameField?.text.toString(),
|
||||
iconGroup)
|
||||
|
||||
this@GroupEditDialogFragment.dialog.cancel()
|
||||
}
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.setNegativeButton(R.string.cancel) { _, _ ->
|
||||
editGroupListener?.cancelEditGroup(
|
||||
editGroupDialogAction,
|
||||
nameField?.text.toString(),
|
||||
nameTextView?.text?.toString(),
|
||||
iconGroup)
|
||||
|
||||
this@GroupEditDialogFragment.dialog.cancel()
|
||||
}
|
||||
|
||||
iconButtonView?.setOnClickListener { _ ->
|
||||
@@ -145,6 +141,25 @@ class GroupEditDialogFragment : DialogFragment(), IconPickerDialogFragment.IconP
|
||||
return super.onCreateDialog(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
// To prevent auto dismiss
|
||||
val d = dialog as AlertDialog?
|
||||
if (d != null) {
|
||||
val positiveButton = d.getButton(Dialog.BUTTON_POSITIVE) as Button
|
||||
positiveButton.setOnClickListener {
|
||||
if (isValid()) {
|
||||
editGroupListener?.approveEditGroup(
|
||||
editGroupDialogAction,
|
||||
nameTextView?.text?.toString(),
|
||||
iconGroup)
|
||||
d.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun assignIconView() {
|
||||
if (mDatabase?.drawFactory != null && iconGroup != null) {
|
||||
iconButtonView?.assignDatabaseIcon(mDatabase?.drawFactory!!, iconGroup!!, iconColor)
|
||||
@@ -163,6 +178,14 @@ class GroupEditDialogFragment : DialogFragment(), IconPickerDialogFragment.IconP
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
private fun isValid(): Boolean {
|
||||
if (nameTextView?.text?.toString()?.isNotEmpty() != true) {
|
||||
nameTextLayoutView?.error = getString(R.string.error_no_name)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
interface EditGroupListener {
|
||||
fun approveEditGroup(action: EditGroupDialogAction?, name: String?, icon: PwIcon?)
|
||||
fun cancelEditGroup(action: EditGroupDialogAction?, name: String?, icon: PwIcon?)
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.kunzisoft.keepass.database.SortNodeEnum
|
||||
import com.kunzisoft.keepass.database.element.*
|
||||
import com.kunzisoft.keepass.icons.assignDatabaseIcon
|
||||
import com.kunzisoft.keepass.settings.PreferencesUtil
|
||||
import com.kunzisoft.keepass.utils.Util
|
||||
|
||||
class NodeAdapter
|
||||
/**
|
||||
@@ -43,7 +42,7 @@ class NodeAdapter
|
||||
* @param context Context to use
|
||||
*/
|
||||
(private val context: Context, private val menuInflater: MenuInflater)
|
||||
: RecyclerView.Adapter<NodeAdapter.BasicViewHolder>() {
|
||||
: RecyclerView.Adapter<NodeAdapter.NodeViewHolder>() {
|
||||
|
||||
private val nodeSortedList: SortedList<NodeVersioned>
|
||||
private val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||
@@ -188,51 +187,47 @@ class NodeAdapter
|
||||
return nodeSortedList.get(position).type.ordinal
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BasicViewHolder {
|
||||
val basicViewHolder: BasicViewHolder
|
||||
val view: View
|
||||
if (viewType == Type.GROUP.ordinal) {
|
||||
view = inflater.inflate(R.layout.list_nodes_group, parent, false)
|
||||
basicViewHolder = GroupViewHolder(view)
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NodeViewHolder {
|
||||
val view: View = if (viewType == Type.GROUP.ordinal) {
|
||||
inflater.inflate(R.layout.list_nodes_group, parent, false)
|
||||
} else {
|
||||
view = inflater.inflate(R.layout.list_nodes_entry, parent, false)
|
||||
basicViewHolder = EntryViewHolder(view)
|
||||
inflater.inflate(R.layout.list_nodes_entry, parent, false)
|
||||
}
|
||||
return basicViewHolder
|
||||
return NodeViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: BasicViewHolder, position: Int) {
|
||||
override fun onBindViewHolder(holder: NodeViewHolder, position: Int) {
|
||||
val subNode = nodeSortedList.get(position)
|
||||
// Assign image
|
||||
val iconColor = when (subNode.type) {
|
||||
Type.GROUP -> iconGroupColor
|
||||
Type.ENTRY -> iconEntryColor
|
||||
}
|
||||
holder.icon?.assignDatabaseIcon(mDatabase.drawFactory, subNode.icon, iconColor)
|
||||
holder.icon.assignDatabaseIcon(mDatabase.drawFactory, subNode.icon, iconColor)
|
||||
// Assign text
|
||||
holder.text?.text = subNode.title
|
||||
holder.text.text = subNode.title
|
||||
// Assign click
|
||||
holder.container?.setOnClickListener { nodeClickCallback?.onNodeClick(subNode) }
|
||||
holder.container.setOnClickListener { nodeClickCallback?.onNodeClick(subNode) }
|
||||
// Context menu
|
||||
if (activateContextMenu) {
|
||||
holder.container?.setOnCreateContextMenuListener(
|
||||
holder.container.setOnCreateContextMenuListener(
|
||||
ContextMenuBuilder(menuInflater, subNode, readOnly, isASearchResult, nodeMenuListener))
|
||||
}
|
||||
|
||||
// Add username
|
||||
holder.subText?.text = ""
|
||||
holder.subText?.visibility = View.GONE
|
||||
holder.subText.text = ""
|
||||
holder.subText.visibility = View.GONE
|
||||
if (subNode.type == Type.ENTRY) {
|
||||
val entry = subNode as EntryVersioned
|
||||
|
||||
mDatabase.startManageEntry(entry)
|
||||
|
||||
holder.text?.text = entry.getVisualTitle()
|
||||
holder.text.text = entry.getVisualTitle()
|
||||
|
||||
val username = entry.username
|
||||
if (showUserNames && username.isNotEmpty()) {
|
||||
holder.subText?.visibility = View.VISIBLE
|
||||
holder.subText?.text = username
|
||||
holder.subText.visibility = View.VISIBLE
|
||||
holder.subText.text = username
|
||||
}
|
||||
|
||||
mDatabase.stopManageEntry(entry)
|
||||
@@ -240,10 +235,10 @@ class NodeAdapter
|
||||
|
||||
// Assign image and text size
|
||||
// Relative size of the icon
|
||||
holder.icon?.layoutParams?.height = iconSize.toInt()
|
||||
holder.icon?.layoutParams?.width = iconSize.toInt()
|
||||
holder.text?.textSize = textSize
|
||||
holder.subText?.textSize = subtextSize
|
||||
holder.icon.layoutParams?.height = iconSize.toInt()
|
||||
holder.icon.layoutParams?.width = iconSize.toInt()
|
||||
holder.text.textSize = textSize
|
||||
holder.subText.textSize = subtextSize
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
@@ -356,33 +351,11 @@ class NodeAdapter
|
||||
}
|
||||
}
|
||||
|
||||
abstract class BasicViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
|
||||
var container: View? = null
|
||||
var icon: ImageView? = null
|
||||
var text: TextView? = null
|
||||
var subText: TextView? = null
|
||||
}
|
||||
|
||||
|
||||
internal class GroupViewHolder(itemView: View) : BasicViewHolder(itemView) {
|
||||
|
||||
init {
|
||||
container = itemView.findViewById(R.id.group_container)
|
||||
icon = itemView.findViewById(R.id.group_icon)
|
||||
text = itemView.findViewById(R.id.group_text)
|
||||
subText = itemView.findViewById(R.id.group_subtext)
|
||||
}
|
||||
}
|
||||
|
||||
internal class EntryViewHolder(itemView: View) : BasicViewHolder(itemView) {
|
||||
|
||||
init {
|
||||
container = itemView.findViewById(R.id.entry_container)
|
||||
icon = itemView.findViewById(R.id.entry_icon)
|
||||
text = itemView.findViewById(R.id.entry_text)
|
||||
subText = itemView.findViewById(R.id.entry_subtext)
|
||||
}
|
||||
class NodeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
var container: View = itemView.findViewById(R.id.node_container)
|
||||
var icon: ImageView = itemView.findViewById(R.id.node_icon)
|
||||
var text: TextView = itemView.findViewById(R.id.node_text)
|
||||
var subText: TextView = itemView.findViewById(R.id.node_subtext)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -56,7 +56,7 @@ class EntryEditContentsView @JvmOverloads constructor(context: Context, attrs: A
|
||||
addNewFieldView = findViewById(R.id.entry_edit_add_new_field)
|
||||
|
||||
// Retrieve the textColor to tint the icon
|
||||
val taIconColor = context.theme.obtainStyledAttributes(intArrayOf(android.R.attr.textColorPrimary))
|
||||
val taIconColor = context.theme.obtainStyledAttributes(intArrayOf(android.R.attr.textColor))
|
||||
iconColor = taIconColor.getColor(0, Color.WHITE)
|
||||
taIconColor.recycle()
|
||||
}
|
||||
|
||||
18
app/src/main/res/drawable-v21/image_button_background.xml
Normal file
18
app/src/main/res/drawable-v21/image_button_background.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:color="@color/white"
|
||||
tools:targetApi="lollipop">
|
||||
<item>
|
||||
<shape
|
||||
android:shape="oval">
|
||||
<stroke android:color="?attr/colorAccent" android:width="2dp"/>
|
||||
<padding
|
||||
android:left="12dp"
|
||||
android:right="12dp"
|
||||
android:top="12dp"
|
||||
android:bottom="12dp"/>
|
||||
<solid android:color="@color/transparent"/>
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
||||
15
app/src/main/res/drawable/image_button_background.xml
Normal file
15
app/src/main/res/drawable/image_button_background.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape
|
||||
android:shape="oval">
|
||||
<stroke android:color="@color/orange" android:width="2dp"/>
|
||||
<padding
|
||||
android:left="12dp"
|
||||
android:right="12dp"
|
||||
android:top="12dp"
|
||||
android:bottom="12dp"/>
|
||||
<solid android:color="@color/transparent"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -40,8 +40,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginRight="@dimen/fab_menu_margin"
|
||||
android:layout_marginEnd="@dimen/fab_menu_margin"
|
||||
android:layout_marginRight="@dimen/image_button_margin"
|
||||
android:layout_marginEnd="@dimen/image_button_margin"
|
||||
android:src="@drawable/ic_key_white_24dp"
|
||||
android:tint="?attr/colorAccentCompat"
|
||||
android:theme="@style/KeepassDXStyle.Fab.White"
|
||||
@@ -71,8 +71,8 @@
|
||||
android:id="@+id/fab_add_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/fab_menu_margin"
|
||||
android:layout_marginEnd="@dimen/fab_menu_margin"
|
||||
android:layout_marginRight="@dimen/image_button_margin"
|
||||
android:layout_marginEnd="@dimen/image_button_margin"
|
||||
android:src="@drawable/ic_folder_white_24dp"
|
||||
android:tint="?attr/colorAccentCompat"
|
||||
android:theme="@style/KeepassDXStyle.Fab.White"
|
||||
|
||||
@@ -37,13 +37,13 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/toolbar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintWidth_percent="@dimen/content_percent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<com.kunzisoft.keepass.view.EntryEditContentsView
|
||||
android:id="@+id/entry_edit_contents"
|
||||
android:padding="@dimen/default_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
@@ -17,28 +17,32 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<LinearLayout
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:padding="@dimen/default_margin"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<android.support.v7.widget.AppCompatImageButton
|
||||
android:id="@+id/entry_edit_icon_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="4dp"
|
||||
android:src="@drawable/ic_blank_32dp"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
<!-- Title -->
|
||||
<RelativeLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/entry_edit_container_title"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toLeftOf="@+id/entry_edit_icon_button"
|
||||
android:layout_toStartOf="@+id/entry_edit_icon_button">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<android.support.v7.widget.AppCompatEditText
|
||||
android:id="@+id/entry_edit_title"
|
||||
@@ -47,19 +51,8 @@
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:hint="@string/entry_title"/>
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageButton
|
||||
android:id="@+id/entry_edit_icon_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="4dp"
|
||||
android:src="@drawable/ic_blank_32dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- Username -->
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -180,4 +173,6 @@
|
||||
android:tint="?attr/colorAccent"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
@@ -17,30 +17,36 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:padding="@dimen/default_margin"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/default_margin"
|
||||
android:importantForAutofill="noExcludeDescendants"
|
||||
tools:targetApi="o">
|
||||
<android.support.v7.widget.AppCompatImageButton
|
||||
android:id="@+id/group_edit_icon_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_blank_32dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"/>
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/default_margin"
|
||||
android:src="@drawable/ic_blank_32dp"/>
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/group_edit_name_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.v7.widget.AppCompatEditText
|
||||
android:id="@+id/group_edit_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:layout_toLeftOf="@+id/group_edit_icon_button"
|
||||
android:layout_toStartOf="@+id/group_edit_icon_button"
|
||||
android:inputType="text"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:hint="@string/hint_group_name"/>
|
||||
</RelativeLayout>
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -17,21 +17,23 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/entry_container"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/node_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?android:attr/selectableItemBackground" >
|
||||
<android.support.v7.widget.AppCompatImageView android:id="@+id/entry_icon"
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/node_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginLeft="@dimen/default_margin"
|
||||
android:layout_marginStart="@dimen/default_margin"
|
||||
android:layout_marginRight="@dimen/default_margin"
|
||||
android:layout_marginEnd="@dimen/default_margin"
|
||||
android:layout_marginLeft="@dimen/image_list_margin"
|
||||
android:layout_marginStart="@dimen/image_list_margin"
|
||||
android:layout_marginRight="@dimen/image_list_margin"
|
||||
android:layout_marginEnd="@dimen/image_list_margin"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
@@ -45,17 +47,17 @@
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_toRightOf="@+id/entry_icon"
|
||||
android:layout_toEndOf="@+id/entry_icon">
|
||||
android:layout_toRightOf="@+id/node_icon"
|
||||
android:layout_toEndOf="@+id/node_icon">
|
||||
<TextView
|
||||
android:id="@+id/entry_text"
|
||||
android:id="@+id/node_text"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:lines="1"
|
||||
android:singleLine="true"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Default" /> <!-- style override -->
|
||||
<TextView
|
||||
android:id="@+id/entry_subtext"
|
||||
android:id="@+id/node_subtext"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="-4dp"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@@ -22,7 +23,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/no_results"/>
|
||||
</LinearLayout>
|
||||
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/nodes_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with KeePass DX. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/group_container"
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/node_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?android:attr/selectableItemBackground" >
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/group_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -35,38 +35,41 @@
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView android:id="@+id/group_icon"
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/node_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginRight="@dimen/default_margin"
|
||||
android:layout_marginEnd="@dimen/default_margin"
|
||||
android:layout_marginLeft="@dimen/image_list_margin"
|
||||
android:layout_marginStart="@dimen/image_list_margin"
|
||||
android:layout_marginRight="@dimen/image_list_margin"
|
||||
android:layout_marginEnd="@dimen/image_list_margin"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@+id/group_arrow"
|
||||
android:layout_toEndOf="@+id/group_arrow" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerVertical="true"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:layout_toRightOf="@+id/group_icon"
|
||||
android:layout_toEndOf="@+id/group_icon">
|
||||
<TextView android:id="@+id/group_text"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_toRightOf="@+id/node_icon"
|
||||
android:layout_toEndOf="@+id/node_icon">
|
||||
<TextView
|
||||
android:id="@+id/node_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:lines="1"
|
||||
android:singleLine="true"
|
||||
style="@style/KeepassDXStyle.TextAppearance.Title" /> <!-- style override -->
|
||||
<TextView android:id="@+id/group_subtext"
|
||||
<TextView
|
||||
android:id="@+id/node_subtext"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
|
||||
@@ -72,16 +72,18 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginStart="@dimen/list_margin"
|
||||
android:layout_marginEnd="@dimen/list_margin">
|
||||
<android.support.v7.widget.AppCompatImageView android:id="@+id/icon"
|
||||
android:layout_marginStart="6dp"
|
||||
android:layout_marginEnd="6dp">
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:scaleType="fitXY" />
|
||||
<android.support.v7.widget.AppCompatTextView android:id="@+id/group_name"
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:id="@+id/group_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
|
||||
@@ -1,31 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<dimen name="list_margin">5dp</dimen>
|
||||
<dimen name="default_margin">12dp</dimen>
|
||||
<dimen name="button_margin">5dp</dimen>
|
||||
<dimen name="fab_menu_margin">8dp</dimen>
|
||||
<dimen name="margin_tiny">4dp</dimen>
|
||||
<dimen name="margin_small">8dp</dimen>
|
||||
<dimen name="margin_medium">16dp</dimen>
|
||||
<dimen name="margin_large">32dp</dimen>
|
||||
<dimen name="margin_huge">64dp</dimen>
|
||||
|
||||
<dimen name="icon_size">32dp</dimen>
|
||||
|
||||
<dimen name="content_percent">0.5</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -1,29 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<dimen name="list_margin">5dp</dimen>
|
||||
<dimen name="default_margin">12dp</dimen>
|
||||
<dimen name="button_margin">5dp</dimen>
|
||||
<dimen name="fab_menu_margin">8dp</dimen>
|
||||
<dimen name="margin_tiny">4dp</dimen>
|
||||
<dimen name="margin_small">8dp</dimen>
|
||||
<dimen name="margin_medium">16dp</dimen>
|
||||
<dimen name="margin_large">32dp</dimen>
|
||||
<dimen name="margin_huge">64dp</dimen>
|
||||
<dimen name="default_margin">18dp</dimen>
|
||||
<dimen name="image_button_margin">8dp</dimen>
|
||||
<dimen name="image_list_margin">12dp</dimen>
|
||||
<dimen name="button_margin">6dp</dimen>
|
||||
|
||||
<dimen name="icon_size">32dp</dimen>
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
<item name="android:buttonStyle">@style/KeepassDXStyle.Button</item>
|
||||
<item name="buttonStyle">@style/KeepassDXStyle.Button</item>
|
||||
|
||||
<item name="android:imageButtonStyle">@style/KeepassDXStyle.ImageButton</item>
|
||||
<item name="imageButtonStyle">@style/KeepassDXStyle.ImageButton</item>
|
||||
|
||||
<item name="android:checkboxStyle">@style/KeepassDXStyle.CheckBox</item>
|
||||
|
||||
<item name="colorPrimary">@color/green</item>
|
||||
@@ -88,6 +91,9 @@
|
||||
<item name="android:buttonStyle">@style/KeepassDXStyle.Button</item>
|
||||
<item name="buttonStyle">@style/KeepassDXStyle.Button</item>
|
||||
|
||||
<item name="android:imageButtonStyle">@style/KeepassDXStyle.ImageButton</item>
|
||||
<item name="imageButtonStyle">@style/KeepassDXStyle.ImageButton</item>
|
||||
|
||||
<item name="android:checkboxStyle">@style/KeepassDXStyle.CheckBox</item>
|
||||
|
||||
<item name="colorPrimary">@color/green</item>
|
||||
@@ -256,6 +262,11 @@
|
||||
<item name="android:background">@drawable/button_background_primary</item>
|
||||
<item name="android:gravity">center</item>
|
||||
</style>
|
||||
<style name="KeepassDXStyle.ImageButton" parent="KeepassDXStyle.Light.v21">
|
||||
<item name="android:colorForeground">?attr/textColorInverse</item>
|
||||
<item name="android:background">@drawable/image_button_background</item>
|
||||
<item name="android:gravity">center</item>
|
||||
</style>
|
||||
|
||||
<!-- FAB -->
|
||||
<style name="KeepassDXStyle.v21.Fab" parent="Theme.AppCompat" />
|
||||
|
||||
Reference in New Issue
Block a user