return mList;
}
+ /** @hide */
+ public boolean hasListView() {
+ if (mList != null) {
+ return true;
+ }
+ View root = getView();
+ if (root == null) {
+ return false;
+ }
+ View rawListView = root.findViewById(android.R.id.list);
+ if (!(rawListView instanceof ListView)) {
+ return false;
+ }
+ mList = (ListView)rawListView;
+ if (mList == null) {
+ return false;
+ }
+ return true;
+ }
+
private void ensureList() {
if (mList != null) {
return;
import java.util.Collections;
import java.util.List;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.preference.Preference.OnPreferenceChangeInternalListener;
import android.view.View;
}
};
- private int mActivatedPosition = -1;
+ private int mHighlightedPosition = -1;
+ private Drawable mHighlightedDrawable;
private static class PreferenceLayout implements Comparable<PreferenceLayout> {
private int resId;
return this.getItem(position).getId();
}
- public void setActivated(int position) {
- mActivatedPosition = position;
+ /**
+ * @hide
+ */
+ public void setHighlighted(int position) {
+ mHighlightedPosition = position;
+ }
+
+ /**
+ * @hide
+ */
+ public void setHighlightedDrawable(Drawable drawable) {
+ mHighlightedDrawable = drawable;
}
public View getView(int position, View convertView, ViewGroup parent) {
convertView = null;
}
View result = preference.getView(convertView, parent);
- result.setActivated(position == mActivatedPosition);
+ if (position == mHighlightedPosition && mHighlightedDrawable != null) {
+ result.setBackgroundDrawable(mHighlightedDrawable);
+ }
return result;
}