@Override
    public void onOrientationChanged(final int o) {
      if (o == OrientationEventListener.ORIENTATION_UNKNOWN) {
        return;
      }

      int degrees = 270;
      if (o < 45 || o > 315) degrees = 0;
      else if (o < 135) degrees = 90;
      else if (o < 225) degrees = 180;

      if (mAlwaysChangingPhoneAngle == degrees) {
        return;
      }
      mAlwaysChangingPhoneAngle = degrees;

      Log.d("Phone orientation changed to ", degrees);
      int rotation = (360 - degrees) % 360;
      LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
      if (lc != null) {
        lc.setDeviceRotation(rotation);
        LinphoneCall currentCall = lc.getCurrentCall();
        if (currentCall != null
            && currentCall.cameraEnabled()
            && currentCall.getCurrentParamsCopy().getVideoEnabled()) {
          lc.updateCall(currentCall, null);
        }
      }
    }
Exemplo n.º 2
0
  private void hangUp() {
    LinphoneCore lc = LinphoneManager.getLc();
    LinphoneCall currentCall = lc.getCurrentCall();

    if (currentCall != null) {
      lc.terminateCall(currentCall);
    } else if (lc.isInConference()) {
      lc.terminateConference();
    } else {
      lc.terminateAllCalls();
    }
  }
Exemplo n.º 3
0
  @Override
  public void onResume() {
    super.onResume();

    LinphoneCore lc = RedfoxManager.getLcIfManagerNotDestroyedOrNull();
    if (lc != null) {
      LinphoneCall call = lc.getCurrentCall();
      if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) {
        // We are obviously connected
        if (lc.getDefaultProxyConfig() == null) {
          statusLed.setImageResource(R.drawable.led_disconnected);
          statusText.setText(getString(R.string.no_account));
        } else {
          statusLed.setImageResource(
              getStatusIconResource(lc.getDefaultProxyConfig().getState(), true));
          statusText.setText(getStatusIconText(lc.getDefaultProxyConfig().getState()));
        }
      }
    } else {
      statusText.setVisibility(View.VISIBLE);
    }
  }