diff options
author | Harsh Shandilya <msfjarvis@gmail.com> | 2019-11-16 12:08:31 +0530 |
---|---|---|
committer | Aditya Wasan <adityawasan55@gmail.com> | 2019-11-16 12:08:31 +0530 |
commit | 1d081b9054d0310e27c830b71506cfe08aad9f9a (patch) | |
tree | 163ef0c719bb0b7cf5dd1c17bfc65ebec81c8522 | |
parent | de9a201587bfefc9fed8adba3db5a0a2e9557fde (diff) |
Tweak password row layout some more (#567)
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/ui/adapters/EntryRecyclerAdapter.kt | 14 | ||||
-rw-r--r-- | app/src/main/res/layout/password_row_layout.xml | 16 |
2 files changed, 9 insertions, 21 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 893ece62..6ddfa777 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 @@ -5,6 +5,8 @@ package com.zeapo.pwdstore.ui.adapters import android.content.SharedPreferences +import android.text.SpannableString +import android.text.style.RelativeSizeSpan import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -84,7 +86,6 @@ abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList<P val showHidden = settings?.getBoolean("show_hidden_folders", false) ?: false holder.name.text = pass.toString() if (pass.type == PasswordItem.TYPE_CATEGORY) { - holder.type.visibility = View.GONE holder.typeImage.setImageResource(R.drawable.ic_multiple_files_24dp) holder.folderIndicator.visibility = View.VISIBLE val children = pass.file.listFiles { pathname -> @@ -97,15 +98,15 @@ abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList<P } } else { holder.typeImage.setImageResource(R.drawable.ic_action_secure_24dp) - holder.name.text = pass.toString() - holder.type.visibility = View.VISIBLE - holder.type.text = pass.fullPathToParent.replace("(^/)|(/$)".toRegex(), "") + val parentPath = pass.fullPathToParent.replace("(^/)|(/$)".toRegex(), "") + val source = "$parentPath\n$pass" + val spannable = SpannableString(source) + spannable.setSpan(RelativeSizeSpan(0.7f), 0, parentPath.length, 0) + holder.name.text = spannable holder.childCount.visibility = View.GONE holder.folderIndicator.visibility = View.GONE } - holder.view.setOnClickListener(getOnClickListener(holder, pass)) - holder.view.setOnLongClickListener(getOnLongClickListener(holder, pass)) // after removal, everything is rebound for some reason; views are shuffled? @@ -135,7 +136,6 @@ abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList<P */ class ViewHolder(val view: View) : RecyclerView.ViewHolder(view) { val name: AppCompatTextView = view.findViewById(R.id.label) - val type: AppCompatTextView = view.findViewById(R.id.type) val typeImage: AppCompatImageView = view.findViewById(R.id.type_image) val childCount: AppCompatTextView = view.findViewById(R.id.child_count) val folderIndicator: AppCompatImageView = view.findViewById(R.id.folder_indicator) diff --git a/app/src/main/res/layout/password_row_layout.xml b/app/src/main/res/layout/password_row_layout.xml index 916f874f..4339e019 100644 --- a/app/src/main/res/layout/password_row_layout.xml +++ b/app/src/main/res/layout/password_row_layout.xml @@ -21,27 +21,15 @@ tools:src="@drawable/ic_multiple_files_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_gravity="bottom" android:textColor="?android:attr/textColor" android:textSize="18sp" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toEndOf="@id/type_image" - app:layout_constraintTop_toBottomOf="@id/type" - app:layout_constraintBottom_toBottomOf="@id/type_image" + app:layout_constraintTop_toTopOf="parent" tools:text="FILE_NAME" /> <androidx.appcompat.widget.AppCompatTextView |