示例#1
0
 public void loadImage() {
   int start = mListView.getFirstVisiblePosition();
   int end = mListView.getLastVisiblePosition();
   if (end >= getCount()) {
     end = getCount() - 1;
   }
   syncImageLoader.setLoadLimit(start, end);
   syncImageLoader.unlock();
 }
示例#2
0
        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
          switch (scrollState) {
            case AbsListView.OnScrollListener.SCROLL_STATE_FLING:
              syncImageLoader.lock();
              break;
            case AbsListView.OnScrollListener.SCROLL_STATE_IDLE:
              loadImage();
              break;
            case AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
              syncImageLoader.lock();
              break;

            default:
              break;
          }
        }
示例#3
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   if (convertView == null) {
     convertView = mInflater.inflate(R.layout.food_item, null);
   }
   Food food = mFoodList.get(position);
   convertView.setTag(position);
   ImageView img = (ImageView) convertView.findViewById(R.id.img);
   TextView name = (TextView) convertView.findViewById(R.id.name);
   name.setText(food.getName());
   img.setBackgroundResource(R.drawable.ic_launcher);
   syncImageLoader.loadImage(position, food.getS_photo_url(), imageLoadListener);
   return convertView;
 }