diff options
author | DSIW <dsiw@dsiw-it.de> | 2016-06-10 03:13:09 +0200 |
---|---|---|
committer | DSIW <dsiw@dsiw-it.de> | 2016-06-10 03:13:09 +0200 |
commit | b36d082b9f91c4fe6e9c360fe5e2fe914c88589b (patch) | |
tree | 86eddc6ce448680d92607277aa3fef8c7899ee92 /app/src/main/java | |
parent | f6f0576cafab9ecc747bba9b4b9fdbf1961efc92 (diff) |
Restyle password cards
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java | 27 |
1 files changed, 12 insertions, 15 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)); } } } |