1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-27 18:30:09 +00:00

Fixed flickering

This commit is contained in:
M66B 2017-09-19 11:14:57 +02:00
parent 94b30e0fdd
commit c493a4e3fa

View file

@ -267,7 +267,12 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> 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<Rule> listRule) {
@ -1002,6 +1007,12 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> 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();