Add UI indicator for folders

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya
2019-11-04 12:08:13 +05:30
parent ed02961315
commit be47f13d75
3 changed files with 23 additions and 2 deletions

View File

@@ -10,11 +10,9 @@ import android.view.ViewGroup
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import androidx.recyclerview.widget.RecyclerView
import com.zeapo.pwdstore.R
import com.zeapo.pwdstore.utils.PasswordItem
import com.zeapo.pwdstore.widget.MultiselectableLinearLayout
import java.util.ArrayList
import java.util.TreeSet
@@ -82,11 +80,13 @@ abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList<P
if (pass.type == PasswordItem.TYPE_CATEGORY) {
holder.type.visibility = View.GONE
holder.typeImage.setImageResource(R.drawable.ic_folder_tinted_24dp)
holder.folderIndicator.visibility = View.VISIBLE
} 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.folderIndicator.visibility = View.GONE
}
holder.view.setOnClickListener(getOnClickListener(holder, pass))
@@ -122,5 +122,6 @@ abstract class EntryRecyclerAdapter internal constructor(val values: ArrayList<P
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 folderIndicator: AppCompatImageView = view.findViewById(R.id.folder_indicator)
}
}

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/passwordIconColor">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M8.59,16.59L13.17,12 8.59,7.41 10,6l6,6 -6,6 -1.41,-1.41z"/>
</vector>

View File

@@ -47,6 +47,16 @@
app:layout_constraintTop_toBottomOf="@id/type"
tools:text="FILE_NAME" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/folder_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@drawable/ic_keyboard_arrow_right_24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.zeapo.pwdstore.widget.MultiselectableLinearLayout>