예제 #1
0
 @Override
 protected void onPostExecute(Object result) {
   super.onPostExecute(result);
   if (res != null) {
     if ("00".equals(res.getResponseStatus().getCode())) {
       // Success
       if (res != null && res.getProjects() != null && res.getProjects().size() > 0) {
         if (lvContent.getAdapter() == null) {
           adapter = new MyFreeAdapter(lstInvestments);
           lvContent.setAdapter(adapter);
         } else {
           adapter.setLstMyFree(lstInvestments);
         }
         Utils.setListItemCheck(lvContent, lineCount - 1);
       }
     } else {
       // 服务器异常
       Toast.makeText(
               FinanceStocksApp.getContext(),
               res.getResponseStatus().getMessage(),
               Toast.LENGTH_SHORT)
           .show();
     }
   } else {
     Toast.makeText(
             FinanceStocksApp.getContext(), R.string.network_exception, Toast.LENGTH_SHORT)
         .show();
   }
   mRefreshListView.onRefreshComplete();
 }
예제 #2
0
 @Override
 protected void onPostExecute(Object result) {
   super.onPostExecute(result);
   if (res != null) {
     if (AppConstants.RESPONSE_SUCCESS.equals(res.getResponseStatus().getCode())) {
       // Success
       if (lvContent.getAdapter() == null) {
         adapter = new MyFreeAdapter(lstInvestments);
         lvContent.setAdapter(adapter);
       } else {
         adapter.setLstMyFree(lstInvestments);
       }
     } else if (!AppConstants.ERROR_TOKEN.equals(res.getResponseStatus().getCode())) {
       // 服务器异常
       Toast.makeText(
               FinanceStocksApp.getContext(),
               res.getResponseStatus().getMessage(),
               Toast.LENGTH_SHORT)
           .show();
     }
   } else {
     Toast.makeText(
             FinanceStocksApp.getContext(), R.string.network_exception, Toast.LENGTH_SHORT)
         .show();
   }
   mRefreshListView.onRefreshComplete();
 }
 private void initData() {
   customerServices = new ArrayList<UserInfoEO>();
   if (FinanceStocksApp.isLogin()) {
     List<ChatEO> lstChats = ChatEO.getMsgList(0, AppConstants.PAGESIZE);
     if (lstChats != null && lstChats.size() > 0) {
       UserInfoEO serviceInfo = FinanceStocksApp.mAuthInfo.getBindService();
       if (serviceInfo != null) {
         L.d(TAG, "[Bind ServiceInfo]: " + new Gson().toJson(serviceInfo));
         customerServices.add(serviceInfo);
       }
     }
     List<NotificationEO> lstNotifications =
         NotificationEO.queryNotifyList(0, AppConstants.PAGESIZE);
     if (lstNotifications != null && lstNotifications.size() > 0) {
       NotificationEO mLastNotify = NotificationEO.queryLastNotify();
       if (mLastNotify != null) {
         UserInfoEO mSystem = new UserInfoEO();
         mSystem = new UserInfoEO();
         mSystem.setNickName("系统消息");
         mSystem.setAvatarUrl("drawable://" + R.drawable.head_kf);
         mSystem.setLastMsg(mLastNotify.getMsg());
         mSystem.setLastMsgTime(mLastNotify.getCreateTime());
         customerServices.add(mSystem);
       }
     }
     L.d(TAG, "Customer Service List: " + new Gson().toJson(customerServices));
     if (listCustomerServices.getAdapter() == null) {
       adapter = new CustomerServiceAdapter();
       adapter.setDatas(customerServices);
       listCustomerServices.setAdapter(adapter);
     } else {
       adapter.setDatas(customerServices);
     }
   }
   FinanceStocksApp.params.put(AppConstants.ISSERVICEMSGOPEN_KEY, false);
   FinanceStocksApp.params.put(AppConstants.ISSYSTEMMSGOPEN_KEY, false);
 }