Ejemplo n.º 1
0
  /**
   * This function save the user option regarding both mute or hang up in the ddbb.
   *
   * @param optionValue
   */
  private void saveMuteOrHangUpOption(boolean optionValue) {

    try {

      ClientDDBB clientDDBB = new ClientDDBB();
      MuteOrHangUp muteOrHangup = clientDDBB.getSelects().selectMuteOrHangUp();
      if (muteOrHangup != null) {

        // If is true, then the hangup option is established
        if (optionValue) {
          muteOrHangup.setHangUp(true);
          ConfigAppValues.setMuteOrHangup(true);
        }
        // If is false, then the mute mode is set to true
        else {
          muteOrHangup.setMute(true);
          ConfigAppValues.setMuteOrHangup(false);
        }

        clientDDBB.getUpdates().insertMuteOrHangUp(muteOrHangup);
        clientDDBB.commit();
      }

      // If MuteOrHangUp object is not created.
      else {
        muteOrHangup = new MuteOrHangUp();
        clientDDBB.getInserts().insertMuteOrHangUp(muteOrHangup);
        clientDDBB.commit();
      }
      clientDDBB.close();

    } catch (Exception e) {
      if (QSLog.DEBUG_E)
        QSLog.e(CLASS_NAME, ExceptionUtils.exceptionTraceToString(e.toString(), e.getStackTrace()));
    }
  }