Clean paths (#425)

* Clean path display
This removes slashes from end of directories in the label, and the start
and end slash of the item headline.

* Item icon alignment
Change icon alignment to bottom, which makes the display look cleaner
when there is no path.
This commit is contained in:
Joakim Lundborg 2018-09-25 20:54:06 +02:00 committed by حسين
parent eea0e68dda
commit e1dfbd0c99
2 changed files with 49 additions and 40 deletions

View File

@ -101,13 +101,12 @@ public abstract class EntryRecyclerAdapter extends RecyclerView.Adapter<EntryRec
holder.name.setText(pass.toString());
if (pass.getType() == PasswordItem.TYPE_CATEGORY) {
holder.typeImage.setImageResource(R.drawable.ic_folder_grey600_24dp);
holder.name.setText(pass.toString() + "/");
} else {
holder.typeImage.setImageResource(R.drawable.ic_action_secure);
holder.name.setText(pass.toString());
}
holder.type.setText(pass.getFullPathToParent());
holder.type.setText(pass.getFullPathToParent().replaceAll("(^/)|(/$)", ""));
holder.view.setOnClickListener(getOnClickListener(holder, pass));

View File

@ -14,46 +14,56 @@
android:paddingRight="16dp"
android:gravity="start">
<ImageView
android:layout_width="40dp"
android:layout_height="32dp"
android:id="@+id/type_image"
android:src="@drawable/ic_folder_grey600_24dp"
android:contentDescription="@string/folder_icon_hint"
android:alpha="0.5"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:paddingRight="8dp"
android:paddingEnd="8dp"
tools:ignore="RtlSymmetry" />
<TextView
android:id="@+id/type"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="start"
android:text="TYPE"
android:textSize="14sp"
android:textColor="@color/grey_500"
android:layout_alignTop="@+id/type_image"
android:layout_toRightOf="@+id/type_image"
android:layout_toEndOf="@+id/type_image"
android:singleLine="true"
tools:ignore="HardcodedText" />
android:orientation="horizontal">
<ImageView
android:id="@+id/type_image"
android:layout_width="80dp"
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:paddingRight="8dp"
android:src="@drawable/ic_folder_grey600_24dp"
tools:ignore="RtlSymmetry" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="bottom"
android:orientation="vertical">
<TextView
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="@color/grey_500"
android:textSize="14sp"
tools:ignore="HardcodedText" />
<TextView
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:color/black"
android:textSize="18sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="FILE_NAME"
android:textColor="@android:color/black"
android:textSize="18sp"
android:layout_below="@+id/type"
android:layout_alignLeft="@+id/type"
android:layout_alignStart="@+id/type"
tools:ignore="HardcodedText" />
</RelativeLayout>
</LinearLayout>