Add icons to list item
|
@ -1,5 +1,6 @@
|
||||||
package com.zeapo.pwdstore.utils;
|
package com.zeapo.pwdstore.utils;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
import android.support.v7.view.ActionMode;
|
import android.support.v7.view.ActionMode;
|
||||||
import android.support.v7.widget.CardView;
|
import android.support.v7.widget.CardView;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
@ -8,6 +9,7 @@ import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.zeapo.pwdstore.PasswordFragment;
|
import com.zeapo.pwdstore.PasswordFragment;
|
||||||
|
@ -35,12 +37,14 @@ public class PasswordRecyclerAdapter extends RecyclerView.Adapter<PasswordRecycl
|
||||||
public View view;
|
public View view;
|
||||||
public TextView name;
|
public TextView name;
|
||||||
public TextView type;
|
public TextView type;
|
||||||
|
public ImageView typeImage;
|
||||||
|
|
||||||
public ViewHolder(View v) {
|
public ViewHolder(View v) {
|
||||||
super(v);
|
super(v);
|
||||||
view = v;
|
view = v;
|
||||||
name = (TextView) view.findViewById(R.id.label);
|
name = (TextView) view.findViewById(R.id.label);
|
||||||
type = (TextView) view.findViewById(R.id.type);
|
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) {
|
public void onBindViewHolder(final ViewHolder holder, int position) {
|
||||||
final PasswordItem pass = values.get(position);
|
final PasswordItem pass = values.get(position);
|
||||||
holder.name.setText(pass.toString());
|
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());
|
holder.type.setText(pass.getFullPathName());
|
||||||
if (pass.getType() == PasswordItem.TYPE_CATEGORY) {
|
if (pass.getType() == PasswordItem.TYPE_CATEGORY) {
|
||||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_action_secure.png
Normal file
After Width: | Height: | Size: 394 B |
BIN
app/src/main/res/drawable-hdpi/ic_folder_grey600_24dp.png
Normal file
After Width: | Height: | Size: 140 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_secure.png
Normal file
After Width: | Height: | Size: 317 B |
BIN
app/src/main/res/drawable-mdpi/ic_folder_grey600_24dp.png
Normal file
After Width: | Height: | Size: 123 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_secure.png
Normal file
After Width: | Height: | Size: 510 B |
BIN
app/src/main/res/drawable-xhdpi/ic_folder_grey600_24dp.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_secure.png
Normal file
After Width: | Height: | Size: 624 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_folder_grey600_24dp.png
Normal file
After Width: | Height: | Size: 259 B |
|
@ -3,30 +3,40 @@
|
||||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="0dp"
|
android:layout_height="wrap_content">
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
android:layout_marginTop="0dp">
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="8dp"
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:paddingLeft="16dp"
|
||||||
|
android:paddingRight="16dp"
|
||||||
android:gravity="left">
|
android:gravity="left">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:id="@+id/type_image"
|
||||||
|
android:src="@drawable/ic_folder_grey600_24dp"
|
||||||
|
android:alpha="0.5"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:paddingRight="8dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/type"
|
android:id="@+id/type"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:alpha="0.5"
|
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:ellipsize="start"
|
android:ellipsize="start"
|
||||||
android:text="TYPE"
|
android:text="TYPE"
|
||||||
android:textSize="14dp"
|
android:textSize="14dp"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@color/grey_500"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignTop="@+id/type_image"
|
||||||
android:layout_alignLeft="@+id/label"
|
android:layout_toRightOf="@+id/type_image"
|
||||||
android:layout_alignStart="@+id/label" />
|
android:layout_toEndOf="@+id/type_image" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/label"
|
android:id="@+id/label"
|
||||||
|
@ -37,8 +47,8 @@
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:textSize="18dp"
|
android:textSize="18dp"
|
||||||
android:layout_below="@+id/type"
|
android:layout_below="@+id/type"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignLeft="@+id/type"
|
||||||
android:layout_alignParentStart="true" />
|
android:layout_alignStart="@+id/type" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|