mirror of https://github.com/readrops/Readrops.git
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.res.Resources;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -352,17 +351,18 @@ public class MainItemListAdapter extends PagedListAdapter<ItemWithFeed, MainItem
|
|||
|
||||
private void setSelected(boolean selected) {
|
||||
Context context = itemView.getContext();
|
||||
TypedValue outValue = new TypedValue();
|
||||
|
||||
if (selected) {
|
||||
itemView.setBackground(new ColorDrawable(ContextCompat.getColor(context, R.color.selected_background)));
|
||||
context.getTheme().resolveAttribute(
|
||||
android.R.attr.colorControlHighlight, outValue, true);
|
||||
} else {
|
||||
TypedValue outValue = new TypedValue();
|
||||
context.getTheme().resolveAttribute(
|
||||
android.R.attr.selectableItemBackground, outValue, true);
|
||||
}
|
||||
|
||||
itemView.setBackgroundResource(outValue.resourceId);
|
||||
}
|
||||
}
|
||||
|
||||
public ImageView getItemImage() {
|
||||
return binding.itemImage;
|
||||
|
|
|
@ -6,6 +6,4 @@
|
|||
<color name="colorControlNormal">#d7d7d7</color>
|
||||
<color name="colorBackground">#fafafa</color>
|
||||
<color name="textColorPrimary">#000000</color>
|
||||
|
||||
<color name="selected_background">#E0E0E0</color>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue