コード例 #1
0
 /**
  * @Title: onEventMainThread @Description: 监听消息接收
  *
  * @param: @param event
  * @return: void
  * @throws
  */
 public void onEventMainThread(ReceiveChatEvent event) {
   boolean isFind = false;
   if (customerServices != null) {
     for (int i = 0; i < customerServices.size(); i++) {
       Long id = customerServices.get(i).getId();
       if (id != null && id == FinanceStocksApp.mAuthInfo.getBindService().getId()) {
         customerServices.set(i, FinanceStocksApp.mAuthInfo.getBindService());
         isFind = true;
       }
     }
     if (!isFind) {
       customerServices.add(FinanceStocksApp.mAuthInfo.getBindService());
     }
   } else {
     customerServices = new ArrayList<UserInfoEO>();
     customerServices.add(FinanceStocksApp.mAuthInfo.getBindService());
   }
   if (listCustomerServices.getAdapter() == null) {
     adapter = new CustomerServiceAdapter();
     adapter.setDatas(customerServices);
     listCustomerServices.setAdapter(adapter);
   } else {
     adapter.setDatas(customerServices);
   }
 }
コード例 #2
0
 /**
  * @Title: onEventMainThread @Description: 系统通知监听
  *
  * @param: @param event
  * @return: void
  * @throws
  */
 public void onEventMainThread(NotifyEvent event) {
   NotificationEO mNotification = event.getNotify();
   boolean isFind = false;
   UserInfoEO mSystem;
   if (customerServices != null) {
     for (int i = 0; i < customerServices.size(); i++) {
       Long id = customerServices.get(i).getId();
       if (id == null) {
         isFind = true;
         mSystem = customerServices.get(i);
         mSystem.setLastMsg(mNotification.getMsg());
         mSystem.setLastMsgTime(mNotification.getCreateTime());
         customerServices.set(i, mSystem);
       }
     }
     if (!isFind) {
       mSystem = new UserInfoEO();
       mSystem.setNickName("系统消息");
       mSystem.setAvatarUrl("drawable://" + R.drawable.head_kf);
       mSystem.setLastMsg(mNotification.getMsg());
       mSystem.setLastMsgTime(mNotification.getCreateTime());
       customerServices.add(mSystem);
     }
   } else {
     customerServices.add(FinanceStocksApp.mAuthInfo.getBindService());
   }
   if (listCustomerServices.getAdapter() == null) {
     adapter = new CustomerServiceAdapter();
     adapter.setDatas(customerServices);
     listCustomerServices.setAdapter(adapter);
   } else {
     adapter.setDatas(customerServices);
   }
 }
コード例 #3
0
 public static void refreshView() {
   UserInfoEO serviceInfo = FinanceStocksApp.mAuthInfo.getBindService();
   if (serviceInfo != null) {
     customerServices.add(serviceInfo);
   }
   adapter.setDatas(customerServices);
 }
コード例 #4
0
 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);
 }