예제 #1
0
 // #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();
   }
 }
예제 #2
0
 public void addChatMenuItems(MenuModel model) {
   if (isOnline() && !(this instanceof XmppServiceContact)) {
     if (Options.getBoolean(Options.OPTION_ALARM)) {
       model.addItem("wake", USER_MENU_WAKE);
     }
   }
 }
예제 #3
0
파일: Notify.java 프로젝트: fin-nick/fj
 public static void changeSoundMode(boolean showPopup) {
   boolean newValue = !Options.getBoolean(Options.OPTION_SILENT_MODE);
   if (showPopup) {
     PopupWindow.showShadowPopup(
         "Jimm", ResourceBundle.getString(newValue ? "#sound_is_off" : "#sound_is_on"));
   }
   getSound().vibrate(newValue ? 0 : 100);
   getSound().closePlayer();
   Options.setBoolean(Options.OPTION_SILENT_MODE, newValue);
   Options.safeSave();
 }
예제 #4
0
파일: GetVersion.java 프로젝트: fin-nick/fj
 public static void checkUpdates() {
   if (Options.getBoolean(Options.OPTION_CHECK_UPDATES) && !hasNewVersion()) {
     final int today = (int) (System.currentTimeMillis() / (24L * 60 * 60 * 1000));
     final int nextCheck = Options.getInt(Options.OPTION_UPDATE_CHECK_TIME);
     if (nextCheck <= today) {
       new GetVersion(TYPE_DATE).get();
       final int nextDay = today + CHECK_UPDATES_INTERVAL;
       Options.setInt(Options.OPTION_UPDATE_CHECK_TIME, nextDay);
       Options.safeSave();
     }
   }
 }
예제 #5
0
파일: GetVersion.java 프로젝트: fin-nick/fj
 public static boolean showUpdates() {
   if (Options.getBoolean(Options.OPTION_CHECK_UPDATES) && hasNewVersion()) {
     final int today = (int) (System.currentTimeMillis() / (24L * 60 * 60 * 1000));
     final int nextCheck = Options.getInt(Options.OPTION_UPDATE_CHECK_TIME);
     if (nextCheck <= today) {
       final int nextDay = today + SHOW_NEW_VERSION_INTERVAL;
       Options.setInt(Options.OPTION_UPDATE_CHECK_TIME, nextDay);
       Options.safeSave();
       return true;
     }
   }
   return false;
 }
예제 #6
0
파일: Notify.java 프로젝트: fin-nick/fj
 private void playNotify(int notifyType, int volume) {
   String file = files[notifyType];
   // #sijapp cond.if target is "SIEMENS2" #
   if (Options.getBoolean(Options.OPTION_VOLUME_BUGFIX)) {
     this.file = file;
     this.volume = volume;
     if (!play("silence.wav", 100)) {
       this.file = null;
       play(file, volume);
     }
   } else {
     play(file, volume);
   }
   // #sijapp cond.else #
   play(file, volume);
   // #sijapp cond.end #
 }
예제 #7
0
파일: Notify.java 프로젝트: fin-nick/fj
  private void playNotification(int notType) {
    final long now = System.currentTimeMillis();
    if (!isCompulsory(playingType) && isCompulsory(notType)) {
      nextPlayTime = 0;
    }
    if (NOTIFY_ALARM == notType) {
      if (!Options.getBoolean(Options.OPTION_ALARM)) return;
      if (now < nextPlayTime) return;
      nextPlayTime = now + 0; // it is changed
      playingType = notType;
      vibrate(1500);
      if (Options.getBoolean(Options.OPTION_SILENT_MODE)) return;
      playNotify(notType, 100);
      return;
    }

    // #sijapp cond.if modules_MAGIC_EYE is "true" #
    // //eye sound
    if (NOTIFY_EYE == notType) { // eye sound
      if (Options.getBoolean(Options.OPTION_SILENT_MODE)) return; // eye sound
      if (Options.getBoolean(Options.OPTION_EYE_NOTIF)) { // eye sound
        if (!_this.play("eye.wav", 60))
          if (!_this.play("eye.amr", 60)) _this.play("eye.mp3", 60); // eye sound
      } // eye sound
    } // eye sound
    // #sijapp cond.end #
    // //eye sound

    int vibraKind = Options.getInt(Options.OPTION_VIBRATOR);
    if (vibraKind == 2) {
      vibraKind = Jimm.isLocked() ? 1 : 0;
    }
    if ((vibraKind > 0) && ((NOTIFY_MESSAGE == notType) || (NOTIFY_MULTIMESSAGE == notType))) {
      vibrate(Util.strToIntDef(Options.getString(Options.OPTION_VIBRATOR_TIME), 150)); // vibra time
    }

    if (Options.getBoolean(Options.OPTION_SILENT_MODE)) return;
    if (now < nextPlayTime) return;
    nextPlayTime = now + 2000;
    playingType = notType;

    // #sijapp cond.if target is "MIDP2" | target is "MOTOROLA" | target is "SIEMENS2"#
    switch (getNotificationMode(notType)) {
      case 1:
        try {
          switch (notType) {
            case NOTIFY_MESSAGE:
              Manager.playTone(ToneControl.C4, 750, Options.getInt(Options.OPTION_MESS_NOTIF_VOL));
              break;
            case NOTIFY_ONLINE:
            case NOTIFY_OFFLINE: // offline sound
            case NOTIFY_TYPING:
            case NOTIFY_OTHER: // other sound
              Manager.playTone(
                  ToneControl.C4 + 7, 750, Options.getInt(Options.OPTION_ONLINE_NOTIF_VOL));
          }

        } catch (Exception e) {
        }
        break;

      case 2:
        int notifyType = NOTIFY_MESSAGE;
        int volume = 0;
        switch (notType) {
          case NOTIFY_MESSAGE:
            volume = Options.getInt(Options.OPTION_MESS_NOTIF_VOL);
            break;

          case NOTIFY_ONLINE:
            volume = Options.getInt(Options.OPTION_ONLINE_NOTIF_VOL);
            break;

          case NOTIFY_OFFLINE: // offline sound
            volume = Options.getInt(Options.OPTION_OFFLINE_NOTIF_VOL); // offline sound
            break; // offline sound

          case NOTIFY_TYPING:
            volume = Options.getInt(Options.OPTION_TYPING_VOL); // typing
            break;

          case NOTIFY_OTHER: // other sound
            volume = Options.getInt(Options.OPTION_OTHER_NOTIF_VOL); // other sound
            break; // other sound
        }
        playNotify(notType, volume);
        break;
    }
  }
예제 #8
0
 public void updateOfflineStatus() {
   getUpdater().getModel().hideOffline = Options.getBoolean(Options.OPTION_CL_HIDE_OFFLINE);
   ((RosterContent) content).setModel(getUpdater().getModel());
 }
예제 #9
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();
  }