Fixed selectable item background

pull/152/head
M66B 7 years ago
parent 7b81d8df1c
commit 5946904ee2

@ -58,7 +58,7 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
ViewHolder(View itemView) { ViewHolder(View itemView) {
super(itemView); super(itemView);
this.itemView = itemView; this.itemView = itemView.findViewById(R.id.clItem);
tvName = itemView.findViewById(R.id.tvName); tvName = itemView.findViewById(R.id.tvName);
} }

@ -80,7 +80,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
ViewHolder(View itemView) { ViewHolder(View itemView) {
super(itemView); super(itemView);
this.itemView = itemView; this.itemView = itemView.findViewById(R.id.clItem);
ivDelete = itemView.findViewById(R.id.ivDelete); ivDelete = itemView.findViewById(R.id.ivDelete);
tvName = itemView.findViewById(R.id.tvName); tvName = itemView.findViewById(R.id.tvName);
tvType = itemView.findViewById(R.id.tvType); tvType = itemView.findViewById(R.id.tvType);

@ -63,7 +63,7 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
ViewHolder(View itemView) { ViewHolder(View itemView) {
super(itemView); super(itemView);
this.itemView = itemView; this.itemView = itemView.findViewById(R.id.clItem);
image = itemView.findViewById(R.id.image); image = itemView.findViewById(R.id.image);
caption = itemView.findViewById(R.id.caption); caption = itemView.findViewById(R.id.caption);
} }

@ -1,12 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:attr/selectableItemBackground" /> <item android:drawable="@color/darkColorItemSelected" android:state_activated="true" />
<item>
<selector>
<item
android:drawable="@color/darkColorItemSelected"
android:state_activated="true" />
<item android:drawable="@android:color/transparent" /> <item android:drawable="@android:color/transparent" />
</selector> </selector>
</item>
</layer-list>

@ -1,12 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:attr/selectableItemBackground" /> <item android:drawable="@color/lightColorItemSelected" android:state_activated="true" />
<item>
<selector>
<item
android:drawable="@color/lightColorItemSelected"
android:state_activated="true" />
<item android:drawable="@android:color/transparent" /> <item android:drawable="@android:color/transparent" />
</selector> </selector>
</item>
</layer-list>

@ -8,7 +8,8 @@
android:id="@+id/clItem" android:id="@+id/clItem"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/drawableItemBackground"> android:background="?attr/drawableItemBackground"
android:foreground="?attr/selectableItemBackground">
<View <View
android:id="@+id/vwColor" android:id="@+id/vwColor"

@ -1,9 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="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">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/drawableItemBackground"
android:foreground="?attr/selectableItemBackground">
<TextView <TextView
android:id="@+id/tvName" android:id="@+id/tvName"
android:layout_width="0dp" android:layout_width="0dp"
@ -28,4 +35,5 @@
android:background="?attr/colorSeparator" android:background="?attr/colorSeparator"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvName" /> app:layout_constraintTop_toBottomOf="@id/tvName" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

@ -1,10 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clItem"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp" android:background="?attr/drawableItemBackground"
android:layout_marginBottom="6dp"> android:foreground="?attr/selectableItemBackground"
android:paddingTop="6dp"
android:paddingBottom="6dp">
<ImageView <ImageView
android:id="@+id/ivDelete" android:id="@+id/ivDelete"
@ -108,4 +115,5 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDebug" /> app:layout_constraintTop_toBottomOf="@id/tvDebug" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

@ -8,7 +8,8 @@
android:id="@+id/clItem" android:id="@+id/clItem"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/drawableItemBackground"> android:background="?attr/drawableItemBackground"
android:foreground="?attr/selectableItemBackground">
<View <View
android:id="@+id/vwColor" android:id="@+id/vwColor"

@ -8,7 +8,8 @@
android:id="@+id/clItem" android:id="@+id/clItem"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/drawableItemBackground"> android:background="?attr/drawableItemBackground"
android:foreground="?attr/selectableItemBackground">
<View <View
android:id="@+id/vwColor" android:id="@+id/vwColor"

@ -1,8 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clItem"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/drawableItemBackground"
android:foreground="?attr/selectableItemBackground"
android:padding="6dp"> android:padding="6dp">
<ImageView <ImageView
@ -26,4 +33,5 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/image" /> app:layout_constraintTop_toBottomOf="@id/image" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

@ -11,7 +11,8 @@
android:background="?attr/drawableItemBackground" android:background="?attr/drawableItemBackground"
android:descendantFocusability="beforeDescendants" android:descendantFocusability="beforeDescendants"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true"> android:focusableInTouchMode="true"
android:foreground="?attr/selectableItemBackground">
<TextView <TextView
android:id="@+id/tvDay" android:id="@+id/tvDay"

@ -11,7 +11,8 @@
android:background="?attr/drawableItemBackground" android:background="?attr/drawableItemBackground"
android:descendantFocusability="beforeDescendants" android:descendantFocusability="beforeDescendants"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true"> android:focusableInTouchMode="true"
android:foreground="?attr/selectableItemBackground">
<TextView <TextView
android:id="@+id/tvDay" android:id="@+id/tvDay"

@ -8,8 +8,9 @@
android:id="@+id/clItem" android:id="@+id/clItem"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="3dp" android:foreground="?attr/selectableItemBackground"
android:layout_marginBottom="3dp"> android:paddingTop="3dp"
android:paddingBottom="3dp">
<TextView <TextView
android:id="@+id/tvFolder" android:id="@+id/tvFolder"

@ -8,7 +8,8 @@
android:id="@+id/clItem" android:id="@+id/clItem"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/drawableItemBackground"> android:background="?attr/drawableItemBackground"
android:foreground="?attr/selectableItemBackground">
<TextView <TextView
android:id="@+id/tvName" android:id="@+id/tvName"

Loading…
Cancel
Save