mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
Merge pull request #3068 from nextcloud/chore/noid/codeStyle
Fix code style for variable declaration
This commit is contained in:
commit
a7336aedd8
@ -2762,6 +2762,13 @@ public class CallActivity extends CallBaseActivity {
|
||||
|
||||
private class OfferAnswerNickProvider {
|
||||
|
||||
private final WebRtcMessageListener videoWebRtcMessageListener = new WebRtcMessageListener();
|
||||
private final WebRtcMessageListener screenWebRtcMessageListener = new WebRtcMessageListener();
|
||||
|
||||
private final String sessionId;
|
||||
|
||||
private String nick;
|
||||
|
||||
private class WebRtcMessageListener implements SignalingMessageReceiver.WebRtcMessageListener {
|
||||
|
||||
@Override
|
||||
@ -2783,13 +2790,6 @@ public class CallActivity extends CallBaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private final WebRtcMessageListener videoWebRtcMessageListener = new WebRtcMessageListener();
|
||||
private final WebRtcMessageListener screenWebRtcMessageListener = new WebRtcMessageListener();
|
||||
|
||||
private final String sessionId;
|
||||
|
||||
private String nick;
|
||||
|
||||
private OfferAnswerNickProvider(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
@ -14,10 +14,6 @@ import org.webrtc.PeerConnection;
|
||||
|
||||
public class ParticipantDisplayItem {
|
||||
|
||||
public interface Observer {
|
||||
void onChange();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shared handler to receive change notifications from the model on the main thread.
|
||||
*/
|
||||
@ -34,6 +30,19 @@ public class ParticipantDisplayItem {
|
||||
|
||||
private final CallParticipantModel callParticipantModel;
|
||||
|
||||
private String userId;
|
||||
private PeerConnection.IceConnectionState iceConnectionState;
|
||||
private String nick;
|
||||
private String urlForAvatar;
|
||||
private MediaStream mediaStream;
|
||||
private boolean streamEnabled;
|
||||
private boolean isAudioEnabled;
|
||||
private RaisedHand raisedHand;
|
||||
|
||||
public interface Observer {
|
||||
void onChange();
|
||||
}
|
||||
|
||||
private final CallParticipantModel.Observer callParticipantModelObserver = new CallParticipantModel.Observer() {
|
||||
@Override
|
||||
public void onChange() {
|
||||
@ -45,15 +54,6 @@ public class ParticipantDisplayItem {
|
||||
}
|
||||
};
|
||||
|
||||
private String userId;
|
||||
private PeerConnection.IceConnectionState iceConnectionState;
|
||||
private String nick;
|
||||
private String urlForAvatar;
|
||||
private MediaStream mediaStream;
|
||||
private boolean streamEnabled;
|
||||
private boolean isAudioEnabled;
|
||||
private RaisedHand raisedHand;
|
||||
|
||||
public ParticipantDisplayItem(String baseUrl, String defaultGuestNick, EglBase rootEglBase, String streamType,
|
||||
CallParticipantModel callParticipantModel) {
|
||||
this.baseUrl = baseUrl;
|
||||
|
@ -37,6 +37,10 @@ import java.util.Map;
|
||||
*/
|
||||
public class CallParticipantList {
|
||||
|
||||
private final CallParticipantListNotifier callParticipantListNotifier = new CallParticipantListNotifier();
|
||||
|
||||
private final SignalingMessageReceiver signalingMessageReceiver;
|
||||
|
||||
public interface Observer {
|
||||
void onCallParticipantsChanged(Collection<Participant> joined, Collection<Participant> updated,
|
||||
Collection<Participant> left, Collection<Participant> unchanged);
|
||||
@ -142,10 +146,6 @@ public class CallParticipantList {
|
||||
}
|
||||
};
|
||||
|
||||
private final CallParticipantListNotifier callParticipantListNotifier = new CallParticipantListNotifier();
|
||||
|
||||
private final SignalingMessageReceiver signalingMessageReceiver;
|
||||
|
||||
public CallParticipantList(SignalingMessageReceiver signalingMessageReceiver) {
|
||||
this.signalingMessageReceiver = signalingMessageReceiver;
|
||||
this.signalingMessageReceiver.addListener(participantListMessageListener);
|
||||
|
@ -48,6 +48,25 @@ import java.util.Objects;
|
||||
*/
|
||||
public class CallParticipantModel {
|
||||
|
||||
protected final CallParticipantModelNotifier callParticipantModelNotifier = new CallParticipantModelNotifier();
|
||||
|
||||
protected final String sessionId;
|
||||
|
||||
protected Data<String> userId;
|
||||
protected Data<String> nick;
|
||||
|
||||
protected Data<Boolean> internal;
|
||||
|
||||
protected Data<RaisedHand> raisedHand;
|
||||
|
||||
protected Data<PeerConnection.IceConnectionState> iceConnectionState;
|
||||
protected Data<MediaStream> mediaStream;
|
||||
protected Data<Boolean> audioAvailable;
|
||||
protected Data<Boolean> videoAvailable;
|
||||
|
||||
protected Data<PeerConnection.IceConnectionState> screenIceConnectionState;
|
||||
protected Data<MediaStream> screenMediaStream;
|
||||
|
||||
public interface Observer {
|
||||
void onChange();
|
||||
void onReaction(String reaction);
|
||||
@ -72,25 +91,6 @@ public class CallParticipantModel {
|
||||
}
|
||||
}
|
||||
|
||||
protected final CallParticipantModelNotifier callParticipantModelNotifier = new CallParticipantModelNotifier();
|
||||
|
||||
protected final String sessionId;
|
||||
|
||||
protected Data<String> userId;
|
||||
protected Data<String> nick;
|
||||
|
||||
protected Data<Boolean> internal;
|
||||
|
||||
protected Data<RaisedHand> raisedHand;
|
||||
|
||||
protected Data<PeerConnection.IceConnectionState> iceConnectionState;
|
||||
protected Data<MediaStream> mediaStream;
|
||||
protected Data<Boolean> audioAvailable;
|
||||
protected Data<Boolean> videoAvailable;
|
||||
|
||||
protected Data<PeerConnection.IceConnectionState> screenIceConnectionState;
|
||||
protected Data<MediaStream> screenMediaStream;
|
||||
|
||||
public CallParticipantModel(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
|
||||
|
@ -65,37 +65,8 @@ import autodagger.AutoInjector;
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class PeerConnectionWrapper {
|
||||
|
||||
/**
|
||||
* Listener for data channel messages.
|
||||
*
|
||||
* The messages are bound to a specific peer connection, so each listener is expected to handle messages only for
|
||||
* a single peer connection.
|
||||
*
|
||||
* All methods are called on the so called "signaling" thread of WebRTC, which is an internal thread created by the
|
||||
* WebRTC library and NOT the same thread where signaling messages are received.
|
||||
*/
|
||||
public interface DataChannelMessageListener {
|
||||
void onAudioOn();
|
||||
void onAudioOff();
|
||||
void onVideoOn();
|
||||
void onVideoOff();
|
||||
void onNickChanged(String nick);
|
||||
}
|
||||
|
||||
/**
|
||||
* Observer for changes on the peer connection.
|
||||
*
|
||||
* The changes are bound to a specific peer connection, so each observer is expected to handle messages only for
|
||||
* a single peer connection.
|
||||
*
|
||||
* All methods are called on the so called "signaling" thread of WebRTC, which is an internal thread created by the
|
||||
* WebRTC library and NOT the same thread where signaling messages are received.
|
||||
*/
|
||||
public interface PeerConnectionObserver {
|
||||
void onStreamAdded(MediaStream mediaStream);
|
||||
void onStreamRemoved(MediaStream mediaStream);
|
||||
void onIceConnectionStateChanged(PeerConnection.IceConnectionState iceConnectionState);
|
||||
}
|
||||
@Inject
|
||||
Context context;
|
||||
|
||||
private static final String TAG = PeerConnectionWrapper.class.getCanonicalName();
|
||||
|
||||
@ -124,8 +95,37 @@ public class PeerConnectionWrapper {
|
||||
// It is assumed that there will be at most one remote stream at each time.
|
||||
private MediaStream stream;
|
||||
|
||||
@Inject
|
||||
Context context;
|
||||
/**
|
||||
* Listener for data channel messages.
|
||||
* <p>
|
||||
* The messages are bound to a specific peer connection, so each listener is expected to handle messages only for
|
||||
* a single peer connection.
|
||||
* <p>
|
||||
* All methods are called on the so called "signaling" thread of WebRTC, which is an internal thread created by the
|
||||
* WebRTC library and NOT the same thread where signaling messages are received.
|
||||
*/
|
||||
public interface DataChannelMessageListener {
|
||||
void onAudioOn();
|
||||
void onAudioOff();
|
||||
void onVideoOn();
|
||||
void onVideoOff();
|
||||
void onNickChanged(String nick);
|
||||
}
|
||||
|
||||
/**
|
||||
* Observer for changes on the peer connection.
|
||||
* <p>
|
||||
* The changes are bound to a specific peer connection, so each observer is expected to handle messages only for
|
||||
* a single peer connection.
|
||||
* <p>
|
||||
* All methods are called on the so called "signaling" thread of WebRTC, which is an internal thread created by the
|
||||
* WebRTC library and NOT the same thread where signaling messages are received.
|
||||
*/
|
||||
public interface PeerConnectionObserver {
|
||||
void onStreamAdded(MediaStream mediaStream);
|
||||
void onStreamRemoved(MediaStream mediaStream);
|
||||
void onIceConnectionStateChanged(PeerConnection.IceConnectionState iceConnectionState);
|
||||
}
|
||||
|
||||
public PeerConnectionWrapper(PeerConnectionFactory peerConnectionFactory,
|
||||
List<PeerConnection.IceServer> iceServerList,
|
||||
@ -220,7 +220,7 @@ public class PeerConnectionWrapper {
|
||||
|
||||
/**
|
||||
* Adds a listener for data channel messages.
|
||||
*
|
||||
* <p>
|
||||
* A listener is expected to be added only once. If the same listener is added again it will be notified just once.
|
||||
*
|
||||
* @param listener the DataChannelMessageListener
|
||||
@ -235,7 +235,7 @@ public class PeerConnectionWrapper {
|
||||
|
||||
/**
|
||||
* Adds an observer for peer connection changes.
|
||||
*
|
||||
* <p>
|
||||
* An observer is expected to be added only once. If the same observer is added again it will be notified just once.
|
||||
*
|
||||
* @param observer the PeerConnectionObserver
|
||||
|
@ -54,6 +54,18 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
|
||||
public class CallParticipantListExternalSignalingTest {
|
||||
|
||||
private final ParticipantsUpdateParticipantBuilder builder = new ParticipantsUpdateParticipantBuilder();
|
||||
|
||||
private CallParticipantList callParticipantList;
|
||||
private SignalingMessageReceiver.ParticipantListMessageListener participantListMessageListener;
|
||||
|
||||
private CallParticipantList.Observer mockedCallParticipantListObserver;
|
||||
|
||||
private Collection<Participant> expectedJoined;
|
||||
private Collection<Participant> expectedUpdated;
|
||||
private Collection<Participant> expectedLeft;
|
||||
private Collection<Participant> expectedUnchanged;
|
||||
|
||||
private static class ParticipantsUpdateParticipantBuilder {
|
||||
private Participant newUser(long inCall, long lastPing, String sessionId, Participant.ParticipantType type,
|
||||
String userId) {
|
||||
@ -78,18 +90,6 @@ public class CallParticipantListExternalSignalingTest {
|
||||
}
|
||||
}
|
||||
|
||||
private final ParticipantsUpdateParticipantBuilder builder = new ParticipantsUpdateParticipantBuilder();
|
||||
|
||||
private CallParticipantList callParticipantList;
|
||||
private SignalingMessageReceiver.ParticipantListMessageListener participantListMessageListener;
|
||||
|
||||
private CallParticipantList.Observer mockedCallParticipantListObserver;
|
||||
|
||||
private Collection<Participant> expectedJoined;
|
||||
private Collection<Participant> expectedUpdated;
|
||||
private Collection<Participant> expectedLeft;
|
||||
private Collection<Participant> expectedUnchanged;
|
||||
|
||||
// The order of the left participants in some tests depends on how they are internally sorted by the map, so the
|
||||
// list of left participants needs to be checked ignoring the sorting (or, rather, sorting by session ID as in
|
||||
// expectedLeft).
|
||||
|
@ -46,6 +46,18 @@ import static org.mockito.Mockito.verifyNoInteractions;
|
||||
|
||||
public class CallParticipantListInternalSignalingTest {
|
||||
|
||||
private final UsersInRoomParticipantBuilder builder = new UsersInRoomParticipantBuilder();
|
||||
|
||||
private CallParticipantList callParticipantList;
|
||||
private SignalingMessageReceiver.ParticipantListMessageListener participantListMessageListener;
|
||||
|
||||
private CallParticipantList.Observer mockedCallParticipantListObserver;
|
||||
|
||||
private Collection<Participant> expectedJoined;
|
||||
private Collection<Participant> expectedUpdated;
|
||||
private Collection<Participant> expectedLeft;
|
||||
private Collection<Participant> expectedUnchanged;
|
||||
|
||||
private static class UsersInRoomParticipantBuilder {
|
||||
private Participant newUser(long inCall, long lastPing, String sessionId, String userId) {
|
||||
Participant participant = new Participant();
|
||||
@ -67,18 +79,6 @@ public class CallParticipantListInternalSignalingTest {
|
||||
}
|
||||
}
|
||||
|
||||
private final UsersInRoomParticipantBuilder builder = new UsersInRoomParticipantBuilder();
|
||||
|
||||
private CallParticipantList callParticipantList;
|
||||
private SignalingMessageReceiver.ParticipantListMessageListener participantListMessageListener;
|
||||
|
||||
private CallParticipantList.Observer mockedCallParticipantListObserver;
|
||||
|
||||
private Collection<Participant> expectedJoined;
|
||||
private Collection<Participant> expectedUpdated;
|
||||
private Collection<Participant> expectedLeft;
|
||||
private Collection<Participant> expectedUnchanged;
|
||||
|
||||
// The order of the left participants in some tests depends on how they are internally sorted by the map, so the
|
||||
// list of left participants needs to be checked ignoring the sorting (or, rather, sorting by session ID as in
|
||||
// expectedLeft).
|
||||
|
Loading…
Reference in New Issue
Block a user