diff --git a/app/src/main/java/eu/faircode/netguard/AdapterRule.java b/app/src/main/java/eu/faircode/netguard/AdapterRule.java index ab62c706..2d60726a 100644 --- a/app/src/main/java/eu/faircode/netguard/AdapterRule.java +++ b/app/src/main/java/eu/faircode/netguard/AdapterRule.java @@ -267,7 +267,12 @@ public class AdapterRule extends RecyclerView.Adapter im colorGrayed = ContextCompat.getColor(context, R.color.colorGrayed); - iconSize = Util.dips2pixels(48, context); + TypedValue typedValue = new TypedValue(); + context.getTheme().resolveAttribute(android.R.attr.listPreferredItemHeight, typedValue, true); + int height = TypedValue.complexToDimensionPixelSize(typedValue.data, context.getResources().getDisplayMetrics()); + this.iconSize = Math.round(height * context.getResources().getDisplayMetrics().density + 0.5f); + + setHasStableIds(true); } public void set(List listRule) { @@ -1002,6 +1007,12 @@ public class AdapterRule extends RecyclerView.Adapter im return new ViewHolder(inflater.inflate(R.layout.rule, parent, false)); } + @Override + public long getItemId(int position) { + Rule rule = listFiltered.get(position); + return rule.info.packageName.hashCode() * 100000L + rule.info.applicationInfo.uid; + } + @Override public int getItemCount() { return listFiltered.size();