// linearlayout里有两个TextView
    public View getView(int position, View convertView, ViewGroup parent) {
      AlwaysMarqueeTextView vodvideo_title;
      ImageView vodvideo_cover;
      TextView vodvideo_time, vodvideo_descrpition;

      if (convertView == null) {
        convertView = mInflater.inflate(R.layout.vodvideo_widget_item, null);
      }

      ItemVideoInfo curItem = null;
      if (mMovieParse != null) {
        curItem = mMovieParse.getCurInfo(position);
      }

      vodvideo_cover = (ImageView) convertView.findViewById(R.id.vodvideo_cover);

      if (curItem != null && isExistFile(curItem.getPicPath(0))) {
        Bitmap bm = BitmapFactory.decodeFile(curItem.getPicPath(0));
        Drawable drawable = new BitmapDrawable(bm);
        if (bm == null || drawable == null) {
          vodvideo_cover.setBackgroundResource(R.drawable.video_load);
        } else {
          vodvideo_cover.setBackgroundDrawable(drawable);
        }
      } else {
        vodvideo_cover.setBackgroundResource(R.drawable.video_load);
        mMovieParse.downloadMoviePic(position, getListView());
      }

      vodvideo_title = (AlwaysMarqueeTextView) convertView.findViewById(R.id.vodvideo_title);
      if (curItem != null
          && curItem.getVideoName() != null
          && curItem.getVideoName().length() > 0) {
        vodvideo_title.setText(curItem.getVideoName());
      } else {
        vodvideo_title.setText(R.string.vodvideo_widget_defvideo);
      }

      vodvideo_time = (TextView) convertView.findViewById(R.id.vodvideo_time);
      if (curItem != null
          && curItem.getVideoTime() != null
          && curItem.getVideoTime().length() > 0) {
        vodvideo_time.setText(curItem.movie_time);
      } else {
        vodvideo_time.setText(R.string.vodvideo_widget_deftime);
      }

      vodvideo_descrpition = (TextView) convertView.findViewById(R.id.vodvideo_descrpition);
      if (curItem != null && curItem.getVideoDes() != null && curItem.getVideoDes().length() > 0) {
        vodvideo_descrpition.setText(curItem.getVideoDes());
      } else {
        vodvideo_descrpition.setText(R.string.vodvideo_widget_decript);
      }

      return convertView;
    }
Exemplo n.º 2
0
  public void setDetailData(FilmAndPageInfo info, int index) {
    if (info == null) {
      return;
    }
    if (info.getFilmList() == null) {
      return;
    }
    this.index = index;
    this.info = info;
    this.film = info.getFilmList().get(index);
    leftBtn.requestFocus();
    text_filmName.setText(this.film.getFilmName());
    String str_year = "";
    if (!this.film.getYear().contains("不")) {
      str_year = this.film.getYear() + "年";
    }
    text_year_mins_area_type.setText(
        str_year + "  \t" + this.film.getLongTime() + "分钟" + "  \t" + this.film.getArea());
    text_introduce.setText(this.film.getIntroduction() + this.film.getDescription());
    text_director.setText("导演:" + this.film.getDirector());
    text_actor.setText("主演:" + this.film.getActor());

    text_dl_info.setText(R.string.get_film_info);

    leftBtn.setText(R.string.watch_online);
    middleBtn.setVisibility(View.VISIBLE);
    middleBtn.setText(R.string.download_at_once);
    rightBtn.setText(R.string.cancel);
    setLeftPlayLowRateInfo(info);

    new Thread() {
      public void run() {
        download = F4kDownResourceUtils.getDLstaus(film.getFilmID());
        String localPlay = PropertiesUtil.getProperty(context, "local_play");
        if (Boolean.parseBoolean(localPlay)) {
          /////////////// 测试用
          download = new FilmDownLoad4k();
          download.downType = DownType.FINISH;
          /////////////// 测试用
          if (download != null) {
            Message msg = new Message();
            msg.what = GET_DOWN_SUCCESS;
            msg.obj = download;
            handler.sendMessage(msg);
          } else {
            handler.sendEmptyMessage(GET_DOWN_FAIL);
          }
        } else {
          if (download != null) {
            Message msg = new Message();
            msg.what = GET_DOWN_SUCCESS;
            msg.obj = download;
            handler.sendMessage(msg);
          } else {
            handler.sendEmptyMessage(GET_DOWN_FAIL);
          }
          if (download != null) {
            download = F4kDownResourceUtils.getDLstaus(download);
            Message msg = new Message();
            msg.what = GET_DOWN_SUCCESS;
            msg.obj = download;
            handler.sendMessage(msg);
          }
        }

        Detail detail = MovieManager.GetInstance().getDetailFromMid(film.getMid());
        if (detail != null) {
          Message msg = new Message();
          msg.what = GET_DETAIL_SUCCESS;
          msg.obj = detail;
          handler.sendMessage(msg);
        } else {
          Log.d("get detail fail " + film.getFilmName());
        }
      };
    }.start();
  }