Merge "Fix searched item isn't highlighted"

This commit is contained in:
Treehugger Robot
2016-10-13 01:13:41 +00:00
committed by Gerrit Code Review

View File

@@ -757,14 +757,16 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
super.onBindViewHolder(holder, position);
if (position == mHighlightPosition) {
View v = holder.itemView;
if (v.getBackground() != null) {
final int centerX = v.getWidth() / 2;
final int centerY = v.getHeight() / 2;
v.getBackground().setHotspot(centerX, centerY);
}
v.setPressed(true);
v.setPressed(false);
mHighlightPosition = -1;
v.post(() -> {
if (v.getBackground() != null) {
final int centerX = v.getWidth() / 2;
final int centerY = v.getHeight() / 2;
v.getBackground().setHotspot(centerX, centerY);
}
v.setPressed(true);
v.setPressed(false);
mHighlightPosition = -1;
});
}
}
}