diff options
author | DSIW <dsiw@dsiw-it.de> | 2016-06-10 04:49:35 +0200 |
---|---|---|
committer | DSIW <dsiw@dsiw-it.de> | 2016-06-10 04:50:56 +0200 |
commit | 0e700ce21b042030f41d3c488807afb925461f08 (patch) | |
tree | f40909c11af720c3c3a4c4bc4707c29bdf0d045e /app/src/main/java | |
parent | 09f12c81c12ed1993446e98779661d25ced42ad3 (diff) |
Add icons to list item
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java | 13 |
1 files changed, 12 insertions, 1 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 af9a6776..e1b33e2a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java +++ b/app/src/main/java/com/zeapo/pwdstore/utils/PasswordRecyclerAdapter.java @@ -1,5 +1,6 @@ package com.zeapo.pwdstore.utils; +import android.os.Build; import android.support.v7.view.ActionMode; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; @@ -8,6 +9,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.TextView; import com.zeapo.pwdstore.PasswordFragment; @@ -35,12 +37,14 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl public View view; public TextView name; public TextView type; + public ImageView typeImage; public ViewHolder(View v) { super(v); view = v; name = (TextView) view.findViewById(R.id.label); type = (TextView) view.findViewById(R.id.type); + typeImage = (ImageView) view.findViewById(R.id.type_image); } } @@ -67,7 +71,14 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl public void onBindViewHolder(final ViewHolder holder, int position) { final PasswordItem pass = values.get(position); holder.name.setText(pass.toString()); - int sdk = android.os.Build.VERSION.SDK_INT; + 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()); + } + int sdk = Build.VERSION.SDK_INT; holder.type.setText(pass.getFullPathName()); if (pass.getType() == PasswordItem.TYPE_CATEGORY) { |