use of android.widget.SimpleAdapter in project android_packages_apps_Camera by CyanogenMod.
the class EffectSettingPopup method initialize.
public void initialize(IconListPreference preference) {
mPreference = preference;
Context context = getContext();
CharSequence[] entries = mPreference.getEntries();
CharSequence[] entryValues = mPreference.getEntryValues();
int[] iconIds = mPreference.getImageIds();
if (iconIds == null) {
iconIds = mPreference.getLargeIconIds();
}
// Set title.
mTitle.setText(mPreference.getTitle());
for (int i = 0; i < entries.length; ++i) {
String value = entryValues[i].toString();
// no effect, skip it.
if (value.equals(mNoEffect))
continue;
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("value", value);
map.put("text", entries[i].toString());
if (iconIds != null)
map.put("image", iconIds[i]);
if (value.startsWith("goofy_face")) {
mSillyFacesItem.add(map);
} else if (value.startsWith("backdropper")) {
mBackgroundItem.add(map);
}
}
boolean hasSillyFaces = mSillyFacesItem.size() > 0;
boolean hasBackground = mBackgroundItem.size() > 0;
// Initialize goofy face if it is supported.
if (hasSillyFaces) {
findViewById(R.id.effect_silly_faces_title).setVisibility(View.VISIBLE);
findViewById(R.id.effect_silly_faces_title_separator).setVisibility(View.VISIBLE);
mSillyFacesGrid.setVisibility(View.VISIBLE);
SimpleAdapter sillyFacesItemAdapter = new SimpleAdapter(context, mSillyFacesItem, R.layout.effect_setting_item, new String[] { "text", "image" }, new int[] { R.id.text, R.id.image });
mSillyFacesGrid.setAdapter(sillyFacesItemAdapter);
mSillyFacesGrid.setOnItemClickListener(this);
}
if (hasSillyFaces && hasBackground) {
findViewById(R.id.effect_background_separator).setVisibility(View.VISIBLE);
}
// Initialize background replacer if it is supported.
if (hasBackground) {
findViewById(R.id.effect_background_title).setVisibility(View.VISIBLE);
findViewById(R.id.effect_background_title_separator).setVisibility(View.VISIBLE);
mBackgroundGrid.setVisibility(View.VISIBLE);
SimpleAdapter backgroundItemAdapter = new SimpleAdapter(context, mBackgroundItem, R.layout.effect_setting_item, new String[] { "text", "image" }, new int[] { R.id.text, R.id.image });
mBackgroundGrid.setAdapter(backgroundItemAdapter);
mBackgroundGrid.setOnItemClickListener(this);
}
reloadPreference();
}
use of android.widget.SimpleAdapter 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();
}
use of android.widget.SimpleAdapter in project httpclient by pixmob.
the class SampleList method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String path = intent.getStringExtra("com.example.android.apis.Path");
if (path == null) {
path = "";
}
setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
getListView().setTextFilterEnabled(true);
}
use of android.widget.SimpleAdapter in project Android by WilliamYi96.
the class MainActivity method init.
//初始化
void init() {
btnSet.setBackgroundColor(Color.LTGRAY);
//orm初始化
ormHelper = new DBHelperORM(this);
dao = ormHelper.getUserDao();
//sql初始化
//1.创建工具类对象
sqlHelper = new DBHelperSQL(this);
//2.取得可读写的数据库对象
dbRead = sqlHelper.getReadableDatabase();
dbWrite = sqlHelper.getWritableDatabase();
//取得数据库中所有数据
List<User> userList = getUserList();
ArrayList<HashMap<String, String>> items = new ArrayList<HashMap<String, String>>();
if (userList != null) {
for (int i = 0; i < userList.size(); i++) {
User user = userList.get(i);
HashMap<String, String> map = new HashMap<String, String>();
map.put(KEY_DATA_NAME, user.getName());
map.put(KEY_DATA_TIME, user.getTime());
map.put(KEY_DATA_TYPE, user.getType());
map.put(KEY_DATA_URL, user.getURL());
map.put(KEY_DATA_REMARKS, user.getRemarks());
map.put(KEY_DATA_ID, user.getId() + "");
items.add(map);
}
}
adapter = new SimpleAdapter(this, items, R.layout.list_main_activity_item, new String[] { KEY_DATA_NAME, KEY_DATA_TIME, KEY_DATA_TYPE, KEY_DATA_URL, KEY_DATA_REMARKS }, new int[] { R.id.tvName, R.id.tvTime, R.id.tvType, R.id.tvURL, R.id.tvRemarks });
lv.setAdapter(adapter);
}
use of android.widget.SimpleAdapter in project android_frameworks_base by ResurrectionRemix.
the class VectorDrawableTest method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String path = intent.getStringExtra("com.android.test.hwui.Path");
if (path == null) {
path = "";
}
setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
getListView().setTextFilterEnabled(true);
}
Aggregations