Esempio n. 1
0
 /** 更新 */
 public void updatePragram() {
   if (list_1 != null && TSetting.getWeekDay != DateUtils.getDateToInt()) {
     list_1.clear();
     list_1 = null;
     list_2.clear();
     list_2 = null;
     list_3.clear();
     list_3 = null;
     list_4.clear();
     list_4 = null;
   }
   new InitData().execute();
 }
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;
 }