当前位置: 首页>>代码示例>>Java>>正文


Java SimpleAdapter.setViewBinder方法代码示例

本文整理汇总了Java中android.widget.SimpleAdapter.setViewBinder方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleAdapter.setViewBinder方法的具体用法?Java SimpleAdapter.setViewBinder怎么用?Java SimpleAdapter.setViewBinder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.SimpleAdapter的用法示例。


在下文中一共展示了SimpleAdapter.setViewBinder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FillLists

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
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);
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:xDrip-Experimental,代码行数:26,代码来源:AlertList.java

示例2: FillLists

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
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);
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:26,代码来源:AlertList.java

示例3: displayGrid

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
void displayGrid() {
	SimpleAdapter adapter = new SimpleAdapter(this, imageDirectoryMaps,
			R.layout.imagegrid_cell,
			new String[] {"thumbnailURI"},
			new int[] {R.id.grid_image});
       adapter.setViewBinder(new SimpleAdapter.ViewBinder() {
           @Override
           public boolean setViewValue(View view, Object data, String textRepresentation) {
               Uri imageUri = (Uri)data;
               imageLoader.loadImageIntoViewAsync(bitmapCache, imageUri, (ImageView)view, CELL_WIDTH, CELL_HEIGHT, getResources());
               return true;
           }
       });
	gridView.setAdapter(adapter);

	// show text message if no images available
	View noImagesView = findViewById(R.id.noImagesTextView);
	noImagesView.setVisibility(imageDirectoryMaps.size()>0 ? View.GONE : View.VISIBLE);

	System.gc(); // seems to avoid OutOfMemoryErrors when selecting image after deleting earlier image
}
 
开发者ID:dozingcat,项目名称:WireGoggles,代码行数:22,代码来源:ImageListActivity.java

示例4: createOfferListAdapter

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:googlearchive,项目名称:MobileShoppingAssistant-sample,代码行数:25,代码来源:PlaceDetailsActivity.java

示例5: createRecommendationsListAdapter

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:googlearchive,项目名称:MobileShoppingAssistant-sample,代码行数:29,代码来源:PlaceDetailsActivity.java

示例6: onPostExecute

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
protected void onPostExecute(ArrayList<HashMap<String, Object>> result) {
    if (result.isEmpty()) {
        String err = getResources().getString(R.string.noApp);
        Toast.makeText(AppSearchActivity.this, err, Toast.LENGTH_SHORT).show();
    }

    SimpleAdapter simpleAdapter = new SimpleAdapter(AppSearchActivity.this, result,
        R.layout.item, new String[]{"appName", "packageId", "appIcon"},
        new int[]{R.id.app_name, R.id.package_id, R.id.icon}
    );
    mAppLv.setAdapter(simpleAdapter);
    simpleAdapter.setViewBinder(new SimpleAdapter.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;
            }
        }
    });
}
 
开发者ID:renhui,项目名称:android_career,代码行数:24,代码来源:AppSearchActivity.java

示例7: initAdapter

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
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;

	}
    });
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:29,代码来源:HCActivity.java

示例8: onAttach

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
@Override
public void onAttach(Activity activity) {
  super.onAttach(activity);
  ArrayList<Map<String, ExoAccount>> data = new ArrayList<Map<String, ExoAccount>>(accounts.size());
  for (ExoAccount account : accounts) {
    Map<String, ExoAccount> map = new HashMap<String, ExoAccount>();
    map.put("ACCOUNT_DATA", account);
    data.add(map);
  }
  String[] from = { "ACCOUNT_DATA" };
  int[] to = new int[] { R.id.share_account_item_layout };
  SimpleAdapter adapter = new SimpleAdapter(activity, data, R.layout.share_extension_account_item, from, to);
  adapter.setViewBinder(this);
  setListAdapter(adapter);
}
 
开发者ID:paristote,项目名称:mobile-android-studio,代码行数:16,代码来源:AccountsFragment.java

示例9: onActivityCreated

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
@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());
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:53,代码来源:CodecsFragment.java

示例10: refreshAppListView

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
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;
    }
 
开发者ID:Eaway,项目名称:AppCrawler,代码行数:59,代码来源:MainActivity.java


注:本文中的android.widget.SimpleAdapter.setViewBinder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。