Improve Preference highlighting for Search

- cache hightlight Drawable
- set mPreferenceHighlighted as early as possible

Change-Id: I512d4677e94309175ead22c46b7a78e2aa387e1c
This commit is contained in:
Fabrice Di Meglio
2014-05-21 16:19:41 -07:00
parent bbfaa11cf7
commit 4a2ee7e2b6
2 changed files with 19 additions and 5 deletions

View File

@@ -32,6 +32,7 @@ public class HighlightingFragment extends Fragment {
private String mViewKey;
private boolean mViewHighlighted = false;
private Drawable mHighlightDrawable;
@Override
public void onCreate(Bundle icicle) {
@@ -67,7 +68,10 @@ public class HighlightingFragment extends Fragment {
}
private Drawable getHighlightDrawable() {
return getActivity().getDrawable(R.drawable.preference_highlight);
if (mHighlightDrawable == null) {
mHighlightDrawable = getActivity().getDrawable(R.drawable.preference_highlight);
}
return mHighlightDrawable;
}
private void highlightView(String key) {