Use colorControlHighlight value for selected item background
This commit is contained in:
parent
850c739b2b
commit
06c1313664
@ -2,7 +2,6 @@ package com.readrops.app.adapters;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -352,17 +351,18 @@ public class MainItemListAdapter extends PagedListAdapter<ItemWithFeed, MainItem
|
|||||||
|
|
||||||
private void setSelected(boolean selected) {
|
private void setSelected(boolean selected) {
|
||||||
Context context = itemView.getContext();
|
Context context = itemView.getContext();
|
||||||
|
TypedValue outValue = new TypedValue();
|
||||||
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
itemView.setBackground(new ColorDrawable(ContextCompat.getColor(context, R.color.selected_background)));
|
context.getTheme().resolveAttribute(
|
||||||
|
android.R.attr.colorControlHighlight, outValue, true);
|
||||||
} else {
|
} else {
|
||||||
TypedValue outValue = new TypedValue();
|
|
||||||
context.getTheme().resolveAttribute(
|
context.getTheme().resolveAttribute(
|
||||||
android.R.attr.selectableItemBackground, outValue, true);
|
android.R.attr.selectableItemBackground, outValue, true);
|
||||||
|
}
|
||||||
|
|
||||||
itemView.setBackgroundResource(outValue.resourceId);
|
itemView.setBackgroundResource(outValue.resourceId);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public ImageView getItemImage() {
|
public ImageView getItemImage() {
|
||||||
return binding.itemImage;
|
return binding.itemImage;
|
||||||
|
@ -6,6 +6,4 @@
|
|||||||
<color name="colorControlNormal">#d7d7d7</color>
|
<color name="colorControlNormal">#d7d7d7</color>
|
||||||
<color name="colorBackground">#fafafa</color>
|
<color name="colorBackground">#fafafa</color>
|
||||||
<color name="textColorPrimary">#000000</color>
|
<color name="textColorPrimary">#000000</color>
|
||||||
|
|
||||||
<color name="selected_background">#E0E0E0</color>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user