Ejemplo n.º 1
0
 public void showMessage(ControllerEvent event, int type) throws Exception {
   // 判断msgFrame是否visible
   MessageFrame msgFrame = getMessageFrame();
   if (msgFrame.isVisible()) {
     Vovo.exeC(event.getExClass(), event.getExMethod(), event.getParas());
   } else {
     String lccno = (String) event.getParas()[0];
     String key = null;
     if (Constants.MSG_TYPE_FRIEND == type) {
       key = Constants.FRIEND_CHAT_SESSION_PREFIX + lccno;
     } else if (Constants.MSG_TYPE_GROUP == type) {
       key = Constants.GROUP_CHAT_SESSION_PREFIX + lccno;
     }
     List<Object[]> notReadMsg = DataUtil.getNotReadMsg(key);
     Object[] temp = event.getParas();
     if (notReadMsg == null) { // 没有未读信息
       MyTrayIcon trayIcon =
           context.getViewManager().getView(Constants.ViewKey.TRAYICON.toString());
       event.setImage(ImageUtil.getImage(ImageUtil.TRAY_ICON_REC_MSG));
       event.setExClass("chat");
       event.setExMethod("showNotReadMessage");
       event.setParas(new Object[] {key});
       trayIcon.addEvent(event);
     }
     DataUtil.addNotReadMsg(key, temp);
   }
 }
Ejemplo n.º 2
0
 public void showNotReadMessage(String key) {
   List<Object[]> notReadMsg = DataUtil.getNotReadMsg(key);
   if (notReadMsg == null) {
     return;
   }
   for (Object[] paras : notReadMsg) {
     if (key.startsWith(Constants.FRIEND_CHAT_SESSION_PREFIX)) {
       Vovo.exeC("chat", "getFriendMessage", paras);
       try {
         RecentContactManager.getInstance().insertFriendChat((String) paras[0]);
       } catch (IOException e) {
       }
     } else if (key.startsWith(Constants.GROUP_CHAT_SESSION_PREFIX)) {
       Vovo.exeC("groupChat", "getGroupChatMessage", paras);
       try {
         RecentContactManager.getInstance().insertGroupChat((String) paras[0]);
       } catch (IOException e) {
       }
     }
   }
   DataUtil.removeNotReadMsg(key);
 }