コード例 #1
0
 /**
  *
  *
  * <pre>加载数据</pre>
  */
 private void initDatas() {
   if (load_type == FIRST_LOAD) {
     isFirstLoad();
   }
   if (load_type == PAGE_NEXT_LOAD) {
     isPageNext();
   }
   if (load_type == REFRESH_PULL) {
     isPullToRefresh();
   }
   if (NetWorkUtils.checkNetWork(context)) {
     newsList_temp =
         controller.getNewsListFromNet(
             pageIndex,
             pageSize,
             NewsConfigure.list_news_min_id,
             NewsConfigure.list_news_max_id,
             NewsConfigure.COLUMN_REPORT,
             0,
             show_full);
   } else newsList_temp = controller.getNewsListFromFile(NewsConfigure.COLUMN_REPORT);
   if (newsList_temp != null && newsList_temp.size() > 0) {
     if (load_type == FIRST_LOAD) {
       NewsConfigure.list_news_count = newsList_temp.size();
       sendMessage(FIRST_LOAD);
     }
     if (load_type == PAGE_NEXT_LOAD) {
       sendMessage(PAGE_NEXT_LOAD);
     }
     if (load_type == REFRESH_PULL) {
       sendMessage(REFRESH_PULL);
     }
   } else {
     if (load_type == FIRST_LOAD) {
       newsList_temp = controller.getNewsListFromFile(NewsConfigure.COLUMN_REPORT);
       if (newsList_temp != null && newsList_temp.size() > 0) {
         NewsConfigure.list_report_count = newsList_temp.size();
         sendMessage(FIRST_LOAD);
       } else sendMessage(FIRST_REQUEST_ERROR);
     }
     if (load_type == PAGE_NEXT_LOAD) {
       sendMessage(PAGE_NEXT_REQUEST_ERROR);
     }
     if (load_type == REFRESH_PULL) {
       sendMessage(REFRESH_REQUEST_ERROR);
     }
   }
 }
コード例 #2
0
 /* (non-Javadoc)
  * @see java.lang.Runnable#run()
  */
 @Override
 public void run() {
   // TODO Auto-generated method stub
   ++pageIndex;
   newsList_temp =
       controller.getNewsListFromNet(
           pageIndex,
           10,
           NewsConfigure.list_news_min_id,
           NewsConfigure.list_news_max_id,
           NewsConfigure.COLUMN_REPORT,
           0,
           0);
   if (newsList_temp != null) {
     nextPageHandler.sendEmptyMessage(LOADING_NEXT_PAGE);
   } else {
     nextPageHandler.sendEmptyMessage(LOADING_NEXT_PAGE_ERROR);
   }
 }