コード例 #1
0
 protected void handleImage(List<AdInfo> adinfos) {
   DisplayImageOptions options;
   if (UtilsTools.hasDiskCache()) {
     options = new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true).build();
   } else {
     options = new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(false).build();
   }
   Log.i(TAG, "source infos size : " + adinfos.size());
   for (AdInfo adinfo : adinfos) {
     Log.i(TAG, "source url : " + adinfo.getPic_url());
     changeImagePos(adinfo);
     ImageSize targetSize =
         new ImageSize(
             mContext.getResources().getInteger(R.integer.ad_target_image_width),
             mContext.getResources().getInteger(R.integer.ad_target_image_height));
     final int t = adinfo.getDismiss_time();
     ImageLoader.getInstance()
         .loadImage(
             adinfo.getPic_url(),
             targetSize,
             options,
             new SimpleImageLoadingListener() {
               @Override
               public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                 mAdView.setImageBitmap(loadedImage);
                 mRefreshHandler.removeMessages(DISMISS_AD);
                 mRefreshHandler.sendEmptyMessageDelayed(DISMISS_AD, t);
                 if (mB != null && loadedImage != mB) {
                   mB.recycle();
                 }
                 mB = loadedImage;
               }
             });
   }
 }
コード例 #2
0
  @SuppressLint("InflateParams")
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      convertView = LayoutInflater.from(mContext).inflate(R.layout.schedule_list_item, null);
    }

    TextView startTimeTxt = (TextView) convertView.findViewById(R.id.schedule_time);
    TextView durationTxt = (TextView) convertView.findViewById(R.id.schedule_duration);
    TextView channelNumTxt = (TextView) convertView.findViewById(R.id.schedule_channelnum);
    TextView channelNameTxt = (TextView) convertView.findViewById(R.id.schedule_channelname);
    TextView epgNameTxt = (TextView) convertView.findViewById(R.id.schedule_epgname);
    ImageView mscheduleicon = (ImageView) convertView.findViewById(R.id.schedule_type);

    startTimeTxt.setText(UtilsTools.formatDate(mData.get(position).getStartTime(), "MM/dd HH:mm"));
    durationTxt.setText(
        (mData.get(position).getEndTime() - mData.get(position).getStartTime()) / (1000 * 60)
            + " "
            + mContext.getString(R.string.schedule_str_time_minute));
    channelNumTxt.setText(mData.get(position).getChannelNum());
    channelNameTxt.setText(mData.get(position).getServiceType());
    epgNameTxt.setText(mData.get(position).getProgramName());
    int type = mData.get(position).getEventTimerType();
    if (type == EnumEventTimerType.EPG_EVENT_REMIDER.ordinal()) {
      mscheduleicon.setImageResource(R.drawable.menu_icon_time);
    } else {
      mscheduleicon.setImageResource(R.drawable.pvr_schedule_icon);
    }
    return convertView;
  }