// #sijapp cond.if modules_TOUCH is "true"#
 protected void stylusXMoved(TouchState state) {
   if (getWidth() / 2 < Math.abs(state.fromX - state.x)) {
     boolean isTrue = state.fromX < state.x;
     int currentModel = 0;
     if (Options.getBoolean(Options.OPTION_CL_HIDE_OFFLINE)) currentModel = 1;
     if (((RosterContent) content).getModel() == getUpdater().getChatModel()) currentModel = 2;
     currentModel = (currentModel + 3 + (isTrue ? -1 : +1)) % 3;
     switch (currentModel) {
       case 0:
         Options.setBoolean(Options.OPTION_CL_HIDE_OFFLINE, false);
         updateOfflineStatus();
         Options.safeSave();
         break;
       case 1:
         Options.setBoolean(Options.OPTION_CL_HIDE_OFFLINE, true);
         updateOfflineStatus();
         Options.safeSave();
         break;
       case 2:
         ((RosterContent) content).setModel(getUpdater().getChatModel());
         break;
     }
     updateTitle();
     Jimm.getJimm().getCL().activate();
   }
 }
Beispiel #2
0
 public void addChatMenuItems(MenuModel model) {
   if (isOnline() && !(this instanceof XmppServiceContact)) {
     if (Options.getBoolean(Options.OPTION_ALARM)) {
       model.addItem("wake", USER_MENU_WAKE);
     }
   }
 }
 public void updateOfflineStatus() {
   getUpdater().getModel().hideOffline = Options.getBoolean(Options.OPTION_CL_HIDE_OFFLINE);
   ((RosterContent) content).setModel(getUpdater().getModel());
 }
Beispiel #4
0
  void populateFromContact(
      final RosterItemView rosterItemView, RosterHelper roster, Protocol p, Contact item) {
    if (p == null || item == null) return;
    rosterItemView.itemNameColor = Scheme.getColor(item.getTextTheme());
    rosterItemView.itemNameFont = item.hasChat() ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT;
    rosterItemView.itemName =
        (item.subcontactsS() == 0)
            ? item.getText()
            : item.getText() + " (" + item.subcontactsS() + ")";

    String statusMessage = roster.getStatusMessage(p, item);
    rosterItemView.itemDescColor = Scheme.getColor(R.attr.contact_status);
    rosterItemView.itemDesc = statusMessage;

    if (Options.getBoolean(JLocale.getString(R.string.pref_users_avatars))) {
      AvatarCache.getInstance()
          .load(
              item.getUserId(),
              item.avatarHash,
              item.getText(),
              new AvatarCache.OnImageLoadListener() {
                @Override
                public void onLoad(Bitmap avatar) {
                  rosterItemView.itemFirstImage = avatar;
                  rosterItemView.repaint();
                }
              });
      rosterItemView.avatarBorderColor = Contact.getStatusColor(item.getStatusIndex());
    }
    // Icon icStatus = item.getLeftIcon(p);
    // if (icStatus != null)
    //    rosterItemView.itemSecondImage = icStatus.getImage().getBitmap();
    if (item.isTyping()) {
      rosterItemView.itemSecondImage = Message.getIcon(Message.ICON_TYPE);
    } else {
      Drawable icMess = ChatHistory.instance.getUnreadMessageIcon(item);
      if (icMess != null) {
        if (icMess == SawimResources.PERSONAL_MESSAGE_ICON) {
          icMess = icMess.getConstantState().newDrawable();
          icMess.setColorFilter(
              Scheme.getColor(R.attr.personal_unread_message), PorterDuff.Mode.MULTIPLY);
        } else {
          icMess = icMess.getConstantState().newDrawable();
          icMess.setColorFilter(Scheme.getColor(R.attr.unread_message), PorterDuff.Mode.MULTIPLY);
        }
        rosterItemView.itemSecondImage = icMess;
      }
    }

    if (item.getXStatusIndex() != XStatusInfo.XSTATUS_NONE) {
      XStatusInfo xStatusInfo = p.getXStatusInfo();
      if (xStatusInfo != null)
        rosterItemView.itemThirdImage =
            xStatusInfo.getIcon(item.getXStatusIndex()).getImage().getBitmap();
    }

    if (!item.isTemp()) {
      if (item.isAuth()) {
        int privacyList = -1;
        if (item.inIgnoreList()) {
          privacyList = 0;
        } else if (item.inInvisibleList()) {
          privacyList = 1;
        } else if (item.inVisibleList()) {
          privacyList = 2;
        }
        if (privacyList != -1)
          rosterItemView.itemThirdImage =
              Contact.serverListsIcons.iconAt(privacyList).getImage().getBitmap();
      } else {
        rosterItemView.itemFourthImage = SawimResources.AUTH_ICON.getBitmap();
      }
    }

    Icon icClient = (null != p.clientInfo) ? p.clientInfo.getIcon(item.clientIndex) : null;
    if (icClient != null && !SawimApplication.hideIconsClient)
      rosterItemView.itemSixthImage = icClient.getImage().getBitmap();
  }