コード例 #1
0
  private void sendTextMessage(String messageToSend) {
    LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
    boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();

    if (chatRoom != null
        && messageToSend != null
        && messageToSend.length() > 0
        && isNetworkReachable) {
      LinphoneChatMessage chatMessage = chatRoom.createLinphoneChatMessage(messageToSend);
      chatRoom.sendMessage(chatMessage, this);

      if (LinphoneActivity.isInstanciated()) {
        LinphoneActivity.instance().onMessageSent(sipUri, messageToSend);
      }

      adapter.refreshHistory();
      adapter.notifyDataSetChanged();

      Log.i("Sent message current status: " + chatMessage.getStatus());
      scrollToEnd();
    } else if (!isNetworkReachable && LinphoneActivity.isInstanciated()) {
      LinphoneActivity.instance()
          .displayCustomToast(getString(R.string.error_network_unreachable), Toast.LENGTH_LONG);
    }
  }
コード例 #2
0
  public boolean onScale(CompatibilityScaleGestureDetector detector) {

    Log.i("================videoSize===001==");

    mZoomFactor *= detector.getScaleFactor();
    // Don't let the object get too small or too large.
    // Zoom to make the video fill the screen vertically
    float portraitZoomFactor =
        ((float) mVideoView.getHeight()) / (float) ((3 * mVideoView.getWidth()) / 4);
    // Zoom to make the video fill the screen horizontally
    float landscapeZoomFactor =
        ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4);
    mZoomFactor =
        Math.max(0.1f, Math.min(mZoomFactor, Math.max(portraitZoomFactor, landscapeZoomFactor)));

    LinphoneCall currentCall = LinphoneManager.getLc().getCurrentCall();
    if (currentCall != null) {
      currentCall.zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
      return true;
    }
    return false;
  }
コード例 #3
0
ファイル: ChatFragment.java プロジェクト: hrsyah1970/SIPTKI
  private void sendTextMessage(String messageToSend) {
    LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
    boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();

    if (chatRoom != null
        && messageToSend != null
        && messageToSend.length() > 0
        && isNetworkReachable) {
      LinphoneChatMessage message = chatRoom.createLinphoneChatMessage(messageToSend);
      message.setListener(this);
      chatRoom.sendChatMessage(message);

      if (LinphoneActivity.isInstanciated()) {
        LinphoneActivity.instance().onMessageSent(sipUri, messageToSend);
      }

      invalidate();
      Log.i("Sent message current status: " + message.getStatus());
    } else if (!isNetworkReachable && LinphoneActivity.isInstanciated()) {
      LinphoneActivity.instance()
          .displayCustomToast(getString(R.string.error_network_unreachable), Toast.LENGTH_LONG);
    }
  }
コード例 #4
0
  @Override
  public boolean onDoubleTap(MotionEvent e) {
    if (LinphoneUtils.isCallEstablished(LinphoneManager.getLc().getCurrentCall())) {
      Log.i("================videoSize===002==");
      if (mZoomFactor == 1.f) {
        // Zoom to make the video fill the screen vertically
        float portraitZoomFactor =
            ((float) mVideoView.getHeight()) / (float) ((3 * mVideoView.getWidth()) / 4);
        // Zoom to make the video fill the screen horizontally
        float landscapeZoomFactor =
            ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4);

        mZoomFactor = Math.max(portraitZoomFactor, landscapeZoomFactor);
      } else {
        resetZoom();
      }

      LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
      return true;
    }

    return false;
  }