use of com.android.camera.IconListPreference in project android_packages_apps_Camera by CyanogenMod.
the class ListPrefSettingPopup method initialize.
public void initialize(ListPreference preference) {
mPreference = preference;
Context context = getContext();
CharSequence[] entries = mPreference.getEntries();
int[] iconIds = null;
if (preference instanceof IconListPreference) {
iconIds = ((IconListPreference) mPreference).getImageIds();
if (iconIds == null) {
iconIds = ((IconListPreference) mPreference).getLargeIconIds();
}
}
// Set title.
mTitle.setText(mPreference.getTitle());
// Prepare the ListView.
ArrayList<HashMap<String, Object>> listItem = new ArrayList<HashMap<String, Object>>();
for (int i = 0; i < entries.length; ++i) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("text", entries[i].toString());
if (iconIds != null)
map.put("image", iconIds[i]);
listItem.add(map);
}
SimpleAdapter listItemAdapter = new ListPrefSettingAdapter(context, listItem, R.layout.setting_item, new String[] { "text", "image" }, new int[] { R.id.text, R.id.image });
((ListView) mSettingList).setAdapter(listItemAdapter);
((ListView) mSettingList).setOnItemClickListener(this);
reloadPreference();
}
Aggregations