Esempio n. 1
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   ViewHolder viewHolder;
   if (convertView == null) {
     viewHolder = new ViewHolder();
     convertView = inflater.inflate(R.layout.listview_item, null);
     viewHolder.live_title = (TextView) convertView.findViewById(R.id.item_title);
     viewHolder.live_content = (TextView) convertView.findViewById(R.id.item_conten);
     convertView.setTag(viewHolder);
   } else {
     viewHolder = (ViewHolder) convertView.getTag();
   }
   TypeLive typeLive = listItems.get(position);
   viewHolder.live_title.setText(typeLive.getLive_title());
   viewHolder.live_content.setText(typeLive.getLive_content());
   return convertView;
 }
Esempio n. 2
0
 @Override
 protected Void doInBackground(Void... paramArrayOfVoid) {
   try {
     if (list_1 == null) {
       LivePragram livePragram = new LivePragram();
       TypePragrams typePragrams = null;
       for (int i = 0; i < 4; i++) {
         TypeLive live = listItems.get(i);
         String url = live.getLive_pragram_url() + weekDay + ".html";
         switch (i) {
           case 0:
             list_1 = livePragram.ParsePragram(url);
             typePragrams = list_1.get(0);
             listItems.get(i).setLive_content(typePragrams.getTitle());
             break;
           case 1:
             list_2 = livePragram.ParsePragram(url);
             typePragrams = list_2.get(0);
             listItems.get(i).setLive_content(typePragrams.getTitle());
             break;
           case 2:
             list_3 = livePragram.ParsePragram(url);
             typePragrams = list_3.get(0);
             listItems.get(i).setLive_content(typePragrams.getTitle());
             break;
           case 3:
             list_4 = livePragram.ParsePragram(url);
             typePragrams = list_4.get(0);
             listItems.get(i).setLive_content(typePragrams.getTitle());
             break;
         }
       }
     } else {
       int cur_time = DateUtils.getDateToInt();
       int count = list_1.size();
       for (int i = 1; i < count; i++) {
         Date curr = DateUtils.getStringToDate(list_1.get(i).getTime().trim());
         int cur = DateUtils.getDateToInt(curr);
         if (cur_time < cur) {
           listItems.get(0).setLive_content(list_1.get(i - 1).getTitle());
           break;
         }
       }
       count = list_2.size();
       for (int i = 1; i < count; i++) {
         Date curr = DateUtils.getStringToDate(list_2.get(i).getTime().trim());
         int cur = DateUtils.getDateToInt(curr);
         if (cur_time < cur) {
           listItems.get(1).setLive_content(list_2.get(i - 1).getTitle());
           break;
         }
       }
       count = list_3.size();
       for (int i = 1; i < count; i++) {
         Date curr = DateUtils.getStringToDate(list_3.get(i).getTime().trim());
         int cur = DateUtils.getDateToInt(curr);
         if (cur_time < cur) {
           listItems.get(2).setLive_content(list_3.get(i - 1).getTitle());
           break;
         }
       }
       count = list_4.size();
       for (int i = 1; i < count; i++) {
         Date curr = DateUtils.getStringToDate(list_4.get(i).getTime().trim());
         int cur = DateUtils.getDateToInt(curr);
         if (cur_time < cur) {
           listItems.get(3).setLive_content(list_4.get(i - 1).getTitle());
           break;
         }
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }