diff options
author | Joakim Lundborg <joakim.lundborg@gmail.com> | 2018-09-25 20:54:06 +0200 |
---|---|---|
committer | حسين <zidhussein@gmail.com> | 2018-09-25 19:54:06 +0100 |
commit | e1dfbd0c99bae9ed599d1826d8292e06410dd587 (patch) | |
tree | 811ebda89b49b5b9df83f506a42e0bc91b5fced2 | |
parent | eea0e68dda1eb7248c6d458f52baeedb318b466a (diff) |
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.
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/utils/EntryRecyclerAdapter.java | 3 | ||||
-rw-r--r-- | app/src/main/res/layout/password_row_layout.xml | 88 |
2 files changed, 50 insertions, 41 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/EntryRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/EntryRecyclerAdapter.java index f1d2c36b..b43b2e2d 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/EntryRecyclerAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/EntryRecyclerAdapter.java @@ -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)); diff --git a/app/src/main/res/layout/password_row_layout.xml b/app/src/main/res/layout/password_row_layout.xml index 85f8838d..824366e7 100644 --- a/app/src/main/res/layout/password_row_layout.xml +++ b/app/src/main/res/layout/password_row_layout.xml @@ -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" /> - - <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" /> + 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> + </RelativeLayout> </LinearLayout>
\ No newline at end of file |