aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2019-11-03 23:42:11 +0530
committerGitHub <noreply@github.com>2019-11-03 23:42:11 +0530
commit6b228a80ef31c34d930b7ad9cd33f684ef55df4a (patch)
treee0a75e9be60d7f4bce3945f021e1d6cde0faca0e /app
parent13a4bf12c3308c57a812406aee527e4a7ce86a25 (diff)
Improve password row UI (#561)
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt7
-rw-r--r--app/src/main/res/layout/password_row_layout.xml72
2 files changed, 34 insertions, 45 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt b/app/src/main/java/com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt
index cfaa0252..9bcb96e4 100644
--- a/app/src/main/java/com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt
@@ -4,7 +4,6 @@
*/
package com.zeapo.pwdstore.ui.adapters
-import android.annotation.SuppressLint
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -77,19 +76,19 @@ abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList<P
}
// Replace the contents of a view (invoked by the layout manager)
- @SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val pass = values[position]
holder.name.text = pass.toString()
if (pass.type == PasswordItem.TYPE_CATEGORY) {
+ holder.type.visibility = View.GONE
holder.typeImage.setImageResource(R.drawable.ic_folder_tinted_24dp)
} else {
holder.typeImage.setImageResource(R.drawable.ic_action_secure)
holder.name.text = pass.toString()
+ holder.type.visibility = View.VISIBLE
+ holder.type.text = pass.fullPathToParent.replace("(^/)|(/$)".toRegex(), "")
}
- holder.type.text = pass.fullPathToParent.replace("(^/)|(/$)".toRegex(), "")
-
holder.view.setOnClickListener(getOnClickListener(holder, pass))
holder.view.setOnLongClickListener(getOnLongClickListener(holder, pass))
diff --git a/app/src/main/res/layout/password_row_layout.xml b/app/src/main/res/layout/password_row_layout.xml
index 71ad8cf4..462df815 100644
--- a/app/src/main/res/layout/password_row_layout.xml
+++ b/app/src/main/res/layout/password_row_layout.xml
@@ -1,62 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<com.zeapo.pwdstore.widget.MultiselectableLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/password_row_background">
- <LinearLayout
+ <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:paddingTop="8dp"
- android:paddingBottom="8dp"
- android:paddingLeft="16dp"
- android:paddingRight="16dp"
- android:gravity="start">
+ android:paddingTop="12dp"
+ android:paddingBottom="12dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/type_image"
- android:layout_width="80dp"
+ android:layout_width="60dp"
android:layout_height="32dp"
android:layout_gravity="bottom"
- android:layout_weight="1"
android:alpha="0.5"
android:contentDescription="@string/folder_icon_hint"
- android:paddingEnd="8dp"
- android:src="@drawable/ic_folder_tinted_24dp"
- tools:ignore="RtlSymmetry" />
-
- <LinearLayout
- android:layout_width="match_parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ tools:src="@drawable/ic_folder_tinted_24dp" />
+
+ <androidx.appcompat.widget.AppCompatTextView
+ android:id="@+id/type"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:ellipsize="start"
+ android:singleLine="true"
+ android:textColor="?android:attr/textColor"
+ android:textSize="14sp"
+ app:layout_constraintStart_toEndOf="@id/type_image"
+ app:layout_constraintTop_toTopOf="parent"
+ tools:text="TYPE" />
+
+ <androidx.appcompat.widget.AppCompatTextView
+ android:id="@+id/label"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_weight="1"
android:layout_gravity="bottom"
- android:orientation="vertical">
-
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@+id/type"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:ellipsize="start"
- android:singleLine="true"
- android:text="TYPE"
- android:textColor="?android:attr/textColor"
- android:textSize="14sp"
- tools:ignore="HardcodedText" />
-
- <androidx.appcompat.widget.AppCompatTextView
- android:id="@+id/label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom"
- android:text="FILE_NAME"
- android:textColor="?android:attr/textColor"
- android:textSize="18sp"
- tools:ignore="HardcodedText" />
-
- </LinearLayout>
+ android:textColor="?android:attr/textColor"
+ android:textSize="18sp"
+ app:layout_constraintStart_toEndOf="@id/type_image"
+ app:layout_constraintTop_toBottomOf="@id/type"
+ tools:text="FILE_NAME" />
- </LinearLayout>
+ </androidx.constraintlayout.widget.ConstraintLayout>
</com.zeapo.pwdstore.widget.MultiselectableLinearLayout> \ No newline at end of file