// Generates int of money amount spent on connection protected int generateCostSum(int in, int out, boolean thisSession) { int cost = 0; int costOf1M = Options.getInt(Options.OPTION_COST_OF_1M) * 100; int costPacketLength = Math.max(Options.getInt(Options.OPTION_COST_PACKET_LENGTH), 1); long packets = 0; if (0 != in) { packets += (in + costPacketLength - 1) / costPacketLength; } if (0 != out) { packets += (out + costPacketLength - 1) / costPacketLength; } cost += (int) (packets * costPacketLength * costOf1M / (1024 * 1024)); if (!usedToday() && (0 != sessionInTraffic) && (0 == costPerDaySum)) { costPerDaySum = costPerDaySum + Options.getInt(Options.OPTION_COST_PER_DAY); lastTimeUsed.setTime(new Date().getTime()); } return cost + costPerDaySum; }
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(); } } }
// Play a sound notification private int getNotificationMode(int notType) { switch (notType) { case NOTIFY_MESSAGE: return Options.getInt(Options.OPTION_MESS_NOTIF_MODE); case NOTIFY_ONLINE: return Options.getInt(Options.OPTION_ONLINE_NOTIF_MODE); case NOTIFY_OFFLINE: // offline sound return Options.getInt(Options.OPTION_OFFLINE_NOTIF_MODE); // offline sound case NOTIFY_TYPING: return Options.getInt(Options.OPTION_TYPING_MODES); // typing case NOTIFY_MULTIMESSAGE: return 0; case NOTIFY_OTHER: // other sound return Options.getInt(Options.OPTION_OTHER_NOTIF_MODE); // other sound } return 0; }
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; }
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; } }
public OptionsEye(MagicEye magicEye) { eye = magicEye; Jimm.setDisplay(fillList(Options.getInt(Options.OPTION_MAGIC_EYE))); }
public static boolean getBooleanValue(int key) { return (Options.getInt(Options.OPTION_MAGIC_EYE) & key) != 0; }
public static long localTimeToGmtTime(long localTime) { return localTime - Options.getInt(Options.OPTION_GMT_OFFSET) * 3600L; }
public static long gmtTimeToLocalTime(long gmtTime) { return gmtTime + Options.getInt(Options.OPTION_GMT_OFFSET) * 3600L; }