aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java27
-rw-r--r--app/src/main/res/layout/password_recycler_view.xml6
-rw-r--r--app/src/main/res/layout/password_row_layout.xml72
3 files changed, 57 insertions, 48 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
index 45dd0d0b..3f240515 100644
--- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
+++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java
@@ -71,19 +71,18 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl
holder.name.setText(pass.toString());
int sdk = android.os.Build.VERSION.SDK_INT;
+ holder.type.setText(pass.getFullPathName());
if (pass.getType() == PasswordItem.TYPE_CATEGORY) {
- holder.type.setText(pass.getFullPathName());
- holder.card.setCardBackgroundColor(activity.getResources().getColor(R.color.deep_orange_400));
+ holder.card.setCardBackgroundColor(activity.getResources().getColor(R.color.blue_grey_200));
} else {
- holder.type.setText(pass.getFullPathName());
- holder.card.setCardBackgroundColor(activity.getResources().getColor(R.color.blue_grey_400));
+ holder.card.setCardBackgroundColor(activity.getResources().getColor(R.color.blue_grey_50));
}
holder.view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mActionMode != null) {
- toggleSelection(holder.getAdapterPosition(), holder.card, pass.getType());
+ toggleSelection(holder, holder.getAdapterPosition(), holder.card, pass.getType());
if (selectedItems.isEmpty()) {
mActionMode.finish();
} else if (selectedItems.size() == 1 && !canEdit) {
@@ -107,7 +106,7 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl
if (mActionMode != null) {
return false;
}
- toggleSelection(holder.getAdapterPosition(), holder.card, pass.getType());
+ toggleSelection(holder, holder.getAdapterPosition(), holder.card, pass.getType());
canEdit = pass.getType() == PasswordItem.TYPE_PASSWORD;
// Start the CAB using the ActionMode.Callback
mActionMode = activity.startSupportActionMode(mActionModeCallback);
@@ -205,21 +204,19 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl
updateSelectedItems(position, selectedItems);
}
- public void toggleSelection(int position, CardView card, char type) {
+ public void toggleSelection(ViewHolder holder, int position, CardView card, char type) {
if (!selectedItems.remove(position)) {
selectedItems.add(position);
if (type == PasswordItem.TYPE_CATEGORY) {
- card.setCardBackgroundColor(activity.getResources().getColor(R.color.deep_orange_200));
- }
- else {
- card.setCardBackgroundColor(activity.getResources().getColor(R.color.blue_grey_200));
+ card.setCardBackgroundColor(activity.getResources().getColor(R.color.blue_grey_100));
+ } else {
+ card.setCardBackgroundColor(activity.getResources().getColor(R.color.blue_grey_100));
}
} else {
if (type == PasswordItem.TYPE_CATEGORY) {
- card.setCardBackgroundColor(activity.getResources().getColor(R.color.deep_orange_400));
- }
- else {
- card.setCardBackgroundColor(activity.getResources().getColor(R.color.blue_grey_400));
+ card.setCardBackgroundColor(activity.getResources().getColor(R.color.blue_grey_200));
+ } else {
+ card.setCardBackgroundColor(activity.getResources().getColor(R.color.blue_grey_50));
}
}
}
diff --git a/app/src/main/res/layout/password_recycler_view.xml b/app/src/main/res/layout/password_recycler_view.xml
index 1b922a17..15a49597 100644
--- a/app/src/main/res/layout/password_recycler_view.xml
+++ b/app/src/main/res/layout/password_recycler_view.xml
@@ -11,11 +11,7 @@
android:id="@+id/pass_recycler"
android:scrollbars="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingBottom="@dimen/activity_vertical_margin"/>
+ android:layout_height="match_parent"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
diff --git a/app/src/main/res/layout/password_row_layout.xml b/app/src/main/res/layout/password_row_layout.xml
index 2ad69762..61c089df 100644
--- a/app/src/main/res/layout/password_row_layout.xml
+++ b/app/src/main/res/layout/password_row_layout.xml
@@ -1,40 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="4dp"
- android:layout_marginBottom="4dp">
+ android:layout_marginBottom="0dp"
+ android:layout_marginLeft="8dp"
+ android:layout_marginRight="8dp"
+ android:layout_marginTop="0dp">
- <android.support.v7.widget.CardView
- xmlns:card_view="http://schemas.android.com/apk/res-auto"
+ <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/password_card"
- android:layout_gravity="center"
+ style="@style/CardView.Light"
android:layout_width="match_parent"
- android:layout_height="60dp"
- card_view:contentPaddingTop="4dp"
- card_view:contentPaddingLeft="4dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
card_view:cardCornerRadius="4dp"
- card_view:cardElevation="3dp"
- card_view:cardBackgroundColor="@color/light_blue_50">
+ card_view:cardElevation="4dp"
+ card_view:cardUseCompatPadding="true"
+ card_view:contentPaddingLeft="4dp"
+ card_view:contentPaddingTop="4dp">
- <TextView
- android:id="@+id/type"
- android:text="TYPE"
+ <RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textColor="@android:color/white"
- android:textStyle="italic"
- android:maxLines="1" />
- <TextView
- android:id="@+id/label"
- android:text="FILE_NAME"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
android:padding="8dp"
- android:textColor="@android:color/white"
- android:textStyle="bold" />
- </android.support.v7.widget.CardView>
- </LinearLayout> \ No newline at end of file
+ android:gravity="left">
+
+ <TextView
+ android:id="@+id/type"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:alpha="0.5"
+ android:maxLines="1"
+ android:ellipsize="start"
+ android:text="TYPE"
+ android:textSize="14dp"
+ android:textColor="@android:color/black"
+ android:layout_alignParentTop="true"
+ android:layout_alignLeft="@+id/label"
+ android:layout_alignStart="@+id/label" />
+
+ <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="18dp"
+ android:layout_below="@+id/type"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true" />
+ </RelativeLayout>
+ </android.support.v7.widget.CardView>
+</LinearLayout> \ No newline at end of file