mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-20 11:15:02 +01:00
Rename PeerConnectionEvent to ProximitySensorEvent
Proximity sensor events should not have been part of PeerConnectionEvent. However, now that all the peer connection related properties were removed the remaining event can be renamed to something more accurate. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
c8398695f4
commit
5d7b5160b7
@ -64,7 +64,7 @@ import com.nextcloud.talk.data.user.model.User;
|
|||||||
import com.nextcloud.talk.databinding.CallActivityBinding;
|
import com.nextcloud.talk.databinding.CallActivityBinding;
|
||||||
import com.nextcloud.talk.events.ConfigurationChangeEvent;
|
import com.nextcloud.talk.events.ConfigurationChangeEvent;
|
||||||
import com.nextcloud.talk.events.NetworkEvent;
|
import com.nextcloud.talk.events.NetworkEvent;
|
||||||
import com.nextcloud.talk.events.PeerConnectionEvent;
|
import com.nextcloud.talk.events.ProximitySensorEvent;
|
||||||
import com.nextcloud.talk.events.WebSocketCommunicationEvent;
|
import com.nextcloud.talk.events.WebSocketCommunicationEvent;
|
||||||
import com.nextcloud.talk.models.ExternalSignalingServer;
|
import com.nextcloud.talk.models.ExternalSignalingServer;
|
||||||
import com.nextcloud.talk.models.json.capabilities.CapabilitiesOverall;
|
import com.nextcloud.talk.models.json.capabilities.CapabilitiesOverall;
|
||||||
@ -2124,15 +2124,15 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onMessageEvent(PeerConnectionEvent peerConnectionEvent) {
|
public void onMessageEvent(ProximitySensorEvent proximitySensorEvent) {
|
||||||
if (peerConnectionEvent.getPeerConnectionEventType() ==
|
if (proximitySensorEvent.getProximitySensorEventType() ==
|
||||||
PeerConnectionEvent.PeerConnectionEventType.SENSOR_FAR ||
|
ProximitySensorEvent.ProximitySensorEventType.SENSOR_FAR ||
|
||||||
peerConnectionEvent.getPeerConnectionEventType() ==
|
proximitySensorEvent.getProximitySensorEventType() ==
|
||||||
PeerConnectionEvent.PeerConnectionEventType.SENSOR_NEAR) {
|
ProximitySensorEvent.ProximitySensorEventType.SENSOR_NEAR) {
|
||||||
|
|
||||||
if (!isVoiceOnlyCall) {
|
if (!isVoiceOnlyCall) {
|
||||||
boolean enableVideo = peerConnectionEvent.getPeerConnectionEventType() ==
|
boolean enableVideo = proximitySensorEvent.getProximitySensorEventType() ==
|
||||||
PeerConnectionEvent.PeerConnectionEventType.SENSOR_FAR && videoOn;
|
ProximitySensorEvent.ProximitySensorEventType.SENSOR_FAR && videoOn;
|
||||||
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA) &&
|
if (EffortlessPermissions.hasPermissions(this, PERMISSIONS_CAMERA) &&
|
||||||
(currentCallStatus == CallStatus.CONNECTING || isConnectionEstablished()) && videoOn
|
(currentCallStatus == CallStatus.CONNECTING || isConnectionEstablished()) && videoOn
|
||||||
&& enableVideo != localVideoTrack.enabled()) {
|
&& enableVideo != localVideoTrack.enabled()) {
|
||||||
|
@ -20,31 +20,31 @@
|
|||||||
|
|
||||||
package com.nextcloud.talk.events;
|
package com.nextcloud.talk.events;
|
||||||
|
|
||||||
public class PeerConnectionEvent {
|
public class ProximitySensorEvent {
|
||||||
private final PeerConnectionEventType peerConnectionEventType;
|
private final ProximitySensorEventType proximitySensorEventType;
|
||||||
|
|
||||||
public PeerConnectionEvent(PeerConnectionEventType peerConnectionEventType) {
|
public ProximitySensorEvent(ProximitySensorEventType proximitySensorEventType) {
|
||||||
this.peerConnectionEventType = peerConnectionEventType;
|
this.proximitySensorEventType = proximitySensorEventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PeerConnectionEventType getPeerConnectionEventType() {
|
public ProximitySensorEventType getProximitySensorEventType() {
|
||||||
return this.peerConnectionEventType;
|
return this.proximitySensorEventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(final Object o) {
|
public boolean equals(final Object o) {
|
||||||
if (o == this) {
|
if (o == this) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(o instanceof PeerConnectionEvent)) {
|
if (!(o instanceof ProximitySensorEvent)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PeerConnectionEvent other = (PeerConnectionEvent) o;
|
final ProximitySensorEvent other = (ProximitySensorEvent) o;
|
||||||
if (!other.canEqual((Object) this)) {
|
if (!other.canEqual((Object) this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Object this$peerConnectionEventType = this.getPeerConnectionEventType();
|
final Object this$proximitySensorEventType = this.getProximitySensorEventType();
|
||||||
final Object other$peerConnectionEventType = other.getPeerConnectionEventType();
|
final Object other$proximitySensorEventType = other.getProximitySensorEventType();
|
||||||
if (this$peerConnectionEventType == null ? other$peerConnectionEventType != null : !this$peerConnectionEventType.equals(other$peerConnectionEventType)) {
|
if (this$proximitySensorEventType == null ? other$proximitySensorEventType != null : !this$proximitySensorEventType.equals(other$proximitySensorEventType)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,22 +52,22 @@ public class PeerConnectionEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canEqual(final Object other) {
|
protected boolean canEqual(final Object other) {
|
||||||
return other instanceof PeerConnectionEvent;
|
return other instanceof ProximitySensorEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int PRIME = 59;
|
final int PRIME = 59;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
final Object $peerConnectionEventType = this.getPeerConnectionEventType();
|
final Object $proximitySensorEventType = this.getProximitySensorEventType();
|
||||||
result = result * PRIME + ($peerConnectionEventType == null ? 43 : $peerConnectionEventType.hashCode());
|
result = result * PRIME + ($proximitySensorEventType == null ? 43 : $proximitySensorEventType.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "PeerConnectionEvent(peerConnectionEventType=" + this.getPeerConnectionEventType() + ")";
|
return "ProximitySensorEvent(proximitySensorEventType=" + this.getProximitySensorEventType() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PeerConnectionEventType {
|
public enum ProximitySensorEventType {
|
||||||
SENSOR_FAR, SENSOR_NEAR
|
SENSOR_FAR, SENSOR_NEAR
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -43,7 +43,7 @@ import android.media.AudioDeviceInfo;
|
|||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.nextcloud.talk.events.PeerConnectionEvent;
|
import com.nextcloud.talk.events.ProximitySensorEvent;
|
||||||
import com.nextcloud.talk.utils.power.PowerManagerUtils;
|
import com.nextcloud.talk.utils.power.PowerManagerUtils;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@ -136,13 +136,13 @@ public class WebRtcAudioManager {
|
|||||||
setAudioDeviceInternal(AudioDevice.EARPIECE);
|
setAudioDeviceInternal(AudioDevice.EARPIECE);
|
||||||
Log.d(TAG, "switched to EARPIECE because userSelectedAudioDevice was SPEAKER_PHONE and proximity=near");
|
Log.d(TAG, "switched to EARPIECE because userSelectedAudioDevice was SPEAKER_PHONE and proximity=near");
|
||||||
|
|
||||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.SENSOR_NEAR));
|
EventBus.getDefault().post(new ProximitySensorEvent(ProximitySensorEvent.ProximitySensorEventType.SENSOR_NEAR));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setAudioDeviceInternal(WebRtcAudioManager.AudioDevice.SPEAKER_PHONE);
|
setAudioDeviceInternal(WebRtcAudioManager.AudioDevice.SPEAKER_PHONE);
|
||||||
Log.d(TAG, "switched to SPEAKER_PHONE because userSelectedAudioDevice was SPEAKER_PHONE and proximity=far");
|
Log.d(TAG, "switched to SPEAKER_PHONE because userSelectedAudioDevice was SPEAKER_PHONE and proximity=far");
|
||||||
|
|
||||||
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.SENSOR_FAR));
|
EventBus.getDefault().post(new ProximitySensorEvent(ProximitySensorEvent.ProximitySensorEventType.SENSOR_FAR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user