Java Code Examples for android.widget.SimpleAdapter#setViewBinder()
The following examples show how to use
android.widget.SimpleAdapter#setViewBinder() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AlertList.java From xDrip-Experimental with GNU General Public License v3.0 | 6 votes |
void FillLists() { // We use a - sign to tell that this text should be stiked through SimpleAdapter.ViewBinder vb = new SimpleAdapter.ViewBinder() { public boolean setViewValue(View view, Object data, String textRepresentation) { TextView tv = (TextView) view; tv.setText(textRepresentation.substring(1)); if(textRepresentation.substring(0, 1).equals("-")) { tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } return true; } }; ArrayList<HashMap<String, String>> feedList; feedList = createAlertsMap(false); SimpleAdapter simpleAdapterLow = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent}); simpleAdapterLow.setViewBinder(vb); listViewLow.setAdapter(simpleAdapterLow); feedList = createAlertsMap(true); SimpleAdapter simpleAdapterHigh = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent}); simpleAdapterHigh.setViewBinder(vb); listViewHigh.setAdapter(simpleAdapterHigh); }
Example 2
Source File: PlaceDetailsActivity.java From solutions-mobile-shopping-assistant-backend-java with Apache License 2.0 | 6 votes |
/** * Creates ListAdapter populated with recommendation information. * * @param recommendations the list of recommendations used to populate the adapter. * @return an adapter populated with recommendation information. */ private ListAdapter createRecommendationsListAdapter(List<Recommendation> recommendations) { List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); for (Recommendation recommendation : recommendations) { Map<String, Object> map = new HashMap<String, Object>(); map.put("productImage", recommendation.getImageUrl()); map.put("recommendationTitle", recommendation.getTitle()); map.put("recommendationDetails", recommendation.getDescription()); data.add(map); } SimpleAdapter adapter = new SimpleAdapter(PlaceDetailsActivity.this, data, R.layout.offer_item, new String[] {"productImage", "recommendationTitle", "recommendationDetails"}, new int[] {R.id.offer_Image, R.id.offer_name, R.id.offer_description}); adapter.setViewBinder(new ImageUrlViewBinder(R.id.offer_Image)); return adapter; }
Example 3
Source File: PlaceDetailsActivity.java From solutions-mobile-shopping-assistant-backend-java with Apache License 2.0 | 6 votes |
/** * Creates ListAdapter populated with offer information. * * @param offers the list of offers used to populate the adapter. * @return an adapter populated with offer information. */ private ListAdapter createOfferListAdapter(List<Offer> offers) { List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); for (Offer offer : offers) { Map<String, Object> map = new HashMap<String, Object>(); map.put("offerIcon", offer.getImageUrl()); map.put("offerTitle", offer.getTitle()); map.put("offerDetails", offer.getDescription()); data.add(map); } SimpleAdapter adapter = new SimpleAdapter(PlaceDetailsActivity.this, data, R.layout.offer_item, new String[] {"offerIcon", "offerTitle", "offerDetails"}, new int[] {R.id.offer_Image, R.id.offer_name, R.id.offer_description}); adapter.setViewBinder(new ImageUrlViewBinder(R.id.offer_Image)); return adapter; }
Example 4
Source File: PlaceDetailsActivity.java From solutions-mobile-shopping-assistant-backend-java with Apache License 2.0 | 6 votes |
/** * Creates ListAdapter populated with recommendation information. * * @param recommendations the list of recommendations used to populate the adapter. * @return an adapter populated with recommendation information. */ private ListAdapter createRecommendationsListAdapter(List<Recommendation> recommendations) { List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); for (Recommendation recommendation : recommendations) { Map<String, Object> map = new HashMap<String, Object>(); map.put("productImage", recommendation.getImageUrl()); map.put("recommendationTitle", recommendation.getTitle()); map.put("recommendationDetails", recommendation.getDescription()); data.add(map); } SimpleAdapter adapter = new SimpleAdapter(PlaceDetailsActivity.this, data, R.layout.offer_item, new String[] {"productImage", "recommendationTitle", "recommendationDetails"}, new int[] {R.id.offer_Image, R.id.offer_name, R.id.offer_description}); adapter.setViewBinder(new ImageUrlViewBinder(R.id.offer_Image)); return adapter; }
Example 5
Source File: PlaceDetailsActivity.java From solutions-mobile-shopping-assistant-backend-java with Apache License 2.0 | 6 votes |
/** * Creates ListAdapter populated with offer information. * * @param offers the list of offers used to populate the adapter. * @return an adapter populated with offer information. */ private ListAdapter createOfferListAdapter(List<Offer> offers) { List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); for (Offer offer : offers) { Map<String, Object> map = new HashMap<String, Object>(); map.put("offerIcon", offer.getImageUrl()); map.put("offerTitle", offer.getTitle()); map.put("offerDetails", offer.getDescription()); data.add(map); } SimpleAdapter adapter = new SimpleAdapter(PlaceDetailsActivity.this, data, R.layout.offer_item, new String[] {"offerIcon", "offerTitle", "offerDetails"}, new int[] {R.id.offer_Image, R.id.offer_name, R.id.offer_description}); adapter.setViewBinder(new ImageUrlViewBinder(R.id.offer_Image)); return adapter; }
Example 6
Source File: PlaceDetailsActivity.java From solutions-mobile-shopping-assistant-android-client with Apache License 2.0 | 6 votes |
/** * Creates ListAdapter populated with recommendation information. * * @param recommendations the list of recommendations used to populate the adapter. * @return an adapter populated with recommendation information. */ private ListAdapter createRecommendationsListAdapter(List<Recommendation> recommendations) { List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); for (Recommendation recommendation : recommendations) { Map<String, Object> map = new HashMap<String, Object>(); map.put("productImage", recommendation.getImageUrl()); map.put("recommendationTitle", recommendation.getTitle()); map.put("recommendationDetails", recommendation.getDescription()); data.add(map); } SimpleAdapter adapter = new SimpleAdapter(PlaceDetailsActivity.this, data, R.layout.offer_item, new String[] {"productImage", "recommendationTitle", "recommendationDetails"}, new int[] {R.id.offer_Image, R.id.offer_name, R.id.offer_description}); adapter.setViewBinder(new ImageUrlViewBinder(R.id.offer_Image)); return adapter; }
Example 7
Source File: PlaceDetailsActivity.java From solutions-mobile-shopping-assistant-android-client with Apache License 2.0 | 6 votes |
/** * Creates ListAdapter populated with offer information. * * @param offers the list of offers used to populate the adapter. * @return an adapter populated with offer information. */ private ListAdapter createOfferListAdapter(List<Offer> offers) { List<Map<String, Object>> data = new ArrayList<Map<String, Object>>(); for (Offer offer : offers) { Map<String, Object> map = new HashMap<String, Object>(); map.put("offerIcon", offer.getImageUrl()); map.put("offerTitle", offer.getTitle()); map.put("offerDetails", offer.getDescription()); data.add(map); } SimpleAdapter adapter = new SimpleAdapter(PlaceDetailsActivity.this, data, R.layout.offer_item, new String[] {"offerIcon", "offerTitle", "offerDetails"}, new int[] {R.id.offer_Image, R.id.offer_name, R.id.offer_description}); adapter.setViewBinder(new ImageUrlViewBinder(R.id.offer_Image)); return adapter; }
Example 8
Source File: PlaceDetailsActivity.java From MobileShoppingAssistant-sample with Apache License 2.0 | 6 votes |
/** * Creates ListAdapter populated with recommendation information. * @param recommendations the list of recommendations used to populate * the adapter. * @return an adapter populated with recommendation information. */ private ListAdapter createRecommendationsListAdapter( final List<Recommendation> recommendations) { List<Map<String, Object>> data = new ArrayList<>(); for (Recommendation recommendation : recommendations) { Map<String, Object> map = new HashMap<>(); map.put("productImage", recommendation.getImageUrl()); map.put("recommendationTitle", recommendation.getTitle()); map.put("recommendationDetails", recommendation.getDescription()); data.add(map); } SimpleAdapter adapter = new SimpleAdapter(PlaceDetailsActivity.this, data, R.layout.offer_item, new String[]{"productImage", "recommendationTitle", "recommendationDetails"}, new int[]{R.id.offer_Image, R.id.offer_name, R.id.offer_description}); adapter.setViewBinder(new ImageUrlViewBinder(R.id.offer_Image)); return adapter; }
Example 9
Source File: PlaceDetailsActivity.java From MobileShoppingAssistant-sample with Apache License 2.0 | 6 votes |
/** * Creates ListAdapter populated with offer information. * @param offers the list of offers used to populate the adapter. * @return an adapter populated with offer information. */ private ListAdapter createOfferListAdapter(final List<Offer> offers) { List<Map<String, Object>> data = new ArrayList<>(); for (Offer offer : offers) { Map<String, Object> map = new HashMap<>(); map.put("offerIcon", offer.getImageUrl()); map.put("offerTitle", offer.getTitle()); map.put("offerDetails", offer.getDescription()); data.add(map); } SimpleAdapter adapter = new SimpleAdapter(PlaceDetailsActivity.this, data, R.layout.offer_item, new String[]{"offerIcon", "offerTitle", "offerDetails"}, new int[]{R.id.offer_Image, R.id.offer_name, R.id.offer_description}); adapter.setViewBinder(new ImageUrlViewBinder(R.id.offer_Image)); return adapter; }
Example 10
Source File: HCActivity.java From styT with Apache License 2.0 | 6 votes |
public void initAdapter() { items = new ArrayList<Map<String, Object>>(); //实例化一个适配器 adapter = new SimpleAdapter(HCActivity.this, items, R.layout.hc_list_item, new String[]{"imageItem", "fileName", "delay", "filePath"}, new int[]{R.id.image_item, R.id.hc_tv_filename, R.id.tv_delay} ); list.setAdapter(adapter); adapter.setViewBinder(new ViewBinder() { @Override public boolean setViewValue(View p1, Object p2, String p3) { if (p1 instanceof ImageView && p2 instanceof Bitmap) { ImageView iv = (ImageView) p1; iv.setImageBitmap((Bitmap) p2); return true; } else return false; } }); }
Example 11
Source File: AlertList.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
void FillLists() { // We use a - sign to tell that this text should be stiked through SimpleAdapter.ViewBinder vb = new SimpleAdapter.ViewBinder() { public boolean setViewValue(View view, Object data, String textRepresentation) { TextView tv = (TextView) view; tv.setText(textRepresentation.substring(1)); if (textRepresentation.substring(0, 1).equals("-")) { tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } return true; } }; ArrayList<HashMap<String, String>> feedList; feedList = createAlertsMap(false); SimpleAdapter simpleAdapterLow = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent}); simpleAdapterLow.setViewBinder(vb); listViewLow.setAdapter(simpleAdapterLow); feedList = createAlertsMap(true); SimpleAdapter simpleAdapterHigh = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent}); simpleAdapterHigh.setViewBinder(vb); listViewHigh.setAdapter(simpleAdapterHigh); }
Example 12
Source File: AlertList.java From xDrip with GNU General Public License v3.0 | 6 votes |
void FillLists() { // We use a - sign to tell that this text should be stiked through SimpleAdapter.ViewBinder vb = new SimpleAdapter.ViewBinder() { public boolean setViewValue(View view, Object data, String textRepresentation) { TextView tv = (TextView) view; tv.setText(textRepresentation.substring(1)); if (textRepresentation.substring(0, 1).equals("-")) { tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } return true; } }; ArrayList<HashMap<String, String>> feedList; feedList = createAlertsMap(false); SimpleAdapter simpleAdapterLow = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent}); simpleAdapterLow.setViewBinder(vb); listViewLow.setAdapter(simpleAdapterLow); feedList = createAlertsMap(true); SimpleAdapter simpleAdapterHigh = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent}); simpleAdapterHigh.setViewBinder(vb); listViewHigh.setAdapter(simpleAdapterHigh); }
Example 13
Source File: ContactDetailFragment.java From haxsync with GNU General Public License v2.0 | 5 votes |
private void refreshJoinedList(){ joined = ContactUtil.getMergedContacts(getActivity(), rawID); String[] from = new String[] {"name", "icon"}; int[] to = new int[] {R.id.label, R.id.icon}; SimpleAdapter adapter = new SimpleAdapter(getActivity(), joined, R.layout.list_row, from, to); adapter.setViewBinder(mViewBinder); listView.setAdapter(adapter); }
Example 14
Source File: AddNewsActivity.java From Social with Apache License 2.0 | 5 votes |
@Override protected void onResume() { super.onResume(); StatService.onResume(this);//统计activity页面 if(!TextUtils.isEmpty(pathImage)){ //Toast.makeText(this,pathImage,Toast.LENGTH_LONG).show(); Log.d("onResume", "in onResume pathImage = " + pathImage); imageItem.ensureCapacity(imageItem.size()+1); Bitmap addbmp=BitmapFactory.decodeFile(pathImage); HashMap<String, Object> map = new HashMap<String, Object>(); map.put("itemImage", addbmp); imageItem.add(gridviewClickItemPosition,map); simpleAdapter = new SimpleAdapter(this, imageItem, R.layout.griditem_addpic, new String[] { "itemImage"}, new int[] { R.id.imageView1}); simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object data, String textRepresentation) { // TODO Auto-generated method stub if(view instanceof ImageView && data instanceof Bitmap){ ImageView i = (ImageView)view; i.setImageBitmap((Bitmap) data); return true; } return false; } }); gridView1.setAdapter(simpleAdapter); simpleAdapter.notifyDataSetChanged(); //刷新后释放防止手机休眠后自动添加 pathImage = null; } }
Example 15
Source File: AddRecruitActivity.java From Social with Apache License 2.0 | 5 votes |
@Override protected void onResume() { super.onResume(); StatService.onResume(this);//统计activity页面 if(!TextUtils.isEmpty(pathImage)){ imageItem.ensureCapacity(imageItem.size()+1); Bitmap addbmp=BitmapFactory.decodeFile(pathImage); HashMap<String, Object> map = new HashMap<String, Object>(); map.put("itemImage", addbmp); imageItem.add(gridviewClickItemPosition, map); simpleAdapter = new SimpleAdapter(this, imageItem, R.layout.griditem_addpic, new String[] { "itemImage"}, new int[] { R.id.imageView1}); simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object data, String textRepresentation) { // TODO Auto-generated method stub if(view instanceof ImageView && data instanceof Bitmap){ ImageView i = (ImageView)view; i.setImageBitmap((Bitmap) data); return true; } return false; } }); gridView1.setAdapter(simpleAdapter); simpleAdapter.notifyDataSetChanged(); //刷新后释放防止手机休眠后自动添加 pathImage = null; } }
Example 16
Source File: MineFragment.java From Social with Apache License 2.0 | 5 votes |
@Override public void onResume() { super.onResume(); StatService.onResume(this); if(!TextUtils.isEmpty(pathImage)){ try { imageItem.ensureCapacity(imageItem.size()+1); Bitmap addbmp= ImageUtil.revitionImageSize(pathImage); byte[] bytes = CommentUtil.Bitmap2Bytes(addbmp); HashMap<String, Object> map = new HashMap<String, Object>(); map.put("itemImage", addbmp); imageItem.add(gridviewClickItemPosition, map); //addPhowoWall addPhotoWall(gridviewClickItemPosition,bytes); simpleAdapter = new SimpleAdapter(getActivity(), imageItem, R.layout.griditem_addpic, new String[] { "itemImage"}, new int[] { R.id.imageView1}); simpleAdapter.setViewBinder(new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object data, String textRepresentation) { // TODO Auto-generated method stub if(view instanceof ImageView && data instanceof Bitmap){ ImageView i = (ImageView)view; i.setImageBitmap((Bitmap) data); return true; } return false; } }); gridView1.setAdapter(simpleAdapter); simpleAdapter.notifyDataSetChanged(); //刷新后释放防止手机休眠后自动添加 pathImage = null; }catch (IOException e){ e.printStackTrace(); } } }
Example 17
Source File: HCActivity.java From stynico with MIT License | 5 votes |
public void initAdapter() { items = new ArrayList<Map<String,Object>>(); //实例化一个适配器 adapter = new SimpleAdapter(HCActivity.this, items, R.layout.hc_list_item, new String[]{"imageItem", "fileName","delay","filePath"}, new int[]{R.id.image_item, R.id.hc_tv_filename,R.id.tv_delay} ); list.setAdapter(adapter); adapter.setViewBinder(new ViewBinder(){ @Override public boolean setViewValue(View p1, Object p2, String p3) { if (p1 instanceof ImageView && p2 instanceof Bitmap) { ImageView iv = (ImageView) p1; iv.setImageBitmap((Bitmap) p2); return true; } else return false; } }); }
Example 18
Source File: MainActivity.java From AppCrawler with Apache License 2.0 | 4 votes |
private boolean refreshAppListView() { // Get installed packages ArrayList<HashMap<String, Object>> appList = new ArrayList<HashMap<String, Object>>(); if (sPkgInfoList == null) { sPkgInfoList = mPkgMgr.getInstalledPackages(0); } for (PackageInfo pkg : sPkgInfoList) { // Skip Ourself if (pkg.packageName.equalsIgnoreCase(getPackageName())) continue; // Skip Android packages if (mCheckBoxHideAndroid.isChecked()) { if (pkg.packageName.contains(PKG_PREFIX_ANDROID)) continue; } // Skip Google packages if (mCheckBoxHideGoogle.isChecked()) { if (pkg.packageName.contains(PKG_PREFIX_GOOGLE)) continue; } HashMap<String, Object> mapApp = new HashMap<String, Object>(); mapApp.put(APP_PKG, pkg.packageName); mapApp.put(APP_NAME, pkg.applicationInfo.loadLabel(mPkgMgr)); mapApp.put(APP_ICON, pkg.applicationInfo.loadIcon(mPkgMgr)); appList.add(mapApp); } // Bind ListView with content adapter SimpleAdapter appAdapter = new SimpleAdapter(this, appList, R.layout.app_list_item, new String[] { APP_NAME, APP_PKG, APP_ICON }, new int[] { R.id.appName, R.id.appPackage, R.id.appIcon }); appAdapter.setViewBinder(new ViewBinder() { public boolean setViewValue(View view, Object data, String textRepresentation) { if (view instanceof ImageView && data instanceof Drawable) { ImageView iv = (ImageView) view; iv.setImageDrawable((Drawable) data); return true; } else return false; } }); mListView.setAdapter(appAdapter); return true; }
Example 19
Source File: CodecsFragment.java From CSipSimple with GNU General Public License v3.0 | 4 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); prefsWrapper = new PreferencesWrapper(getActivity()); useCodecsPerSpeed = SipConfigManager.getPreferenceBooleanValue(getActivity(), SipConfigManager.CODECS_PER_BANDWIDTH); initDatas(); setHasOptionsMenu(true); // Adapter mAdapter = new SimpleAdapter(getActivity(), codecsList, R.layout.codecs_list_item, new String[] { CODEC_NAME, CODEC_NAME, CODEC_PRIORITY }, new int[] { R.id.line1, R.id.AccCheckBoxActive, R.id.entiere_line }); mAdapter.setViewBinder(new ViewBinder() { @Override public boolean setViewValue(View view, Object data, String textRepresentation) { if (view.getId() == R.id.entiere_line) { Log.d(THIS_FILE, "Entiere line is binded "); TextView tv = (TextView) view.findViewById(R.id.line1); ImageView grabber = (ImageView) view.findViewById(R.id.icon); CompoundButton checker = (CompoundButton) view.findViewById(R.id.AccCheckBoxActive); checker.setOnCheckedChangeListener(CodecsFragment.this); if ((Short) data == 0) { tv.setTextColor(Color.GRAY); grabber.setVisibility(View.GONE); checker.setChecked(false); } else { tv.setTextColor(Color.WHITE); grabber.setVisibility(View.VISIBLE); checker.setChecked(true); } return true; }else if(view.getId() == R.id.AccCheckBoxActive) { view.setTag(data); return true; } return false; } }); setListAdapter(mAdapter); registerForContextMenu(getListView()); }