Skip to content

Commit 45911f4

Browse files
committed
Reformatted with Android Studio
1 parent 6ebd6b6 commit 45911f4

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

android/src/main/java/com/twiliorn/library/CustomTwilioVideoView.java

+50-50
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public class CustomTwilioVideoView extends View implements LifecycleEventListene
197197
private IntentFilter intentFilter;
198198
private BecomingNoisyReceiver myNoisyAudioStreamReceiver;
199199

200-
// Dedicated thread and handler for messages received from a RemoteDataTrack
200+
// Dedicated thread and handler for messages received from a RemoteDataTrack
201201
private final HandlerThread dataTrackMessageThread =
202202
new HandlerThread(DATA_TRACK_MESSAGE_THREAD_NAME);
203203
private Handler dataTrackMessageThreadHandler;
@@ -230,10 +230,10 @@ public CustomTwilioVideoView(ThemedReactContext context) {
230230
intentFilter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
231231

232232
// Create the local data track
233-
// localDataTrack = LocalDataTrack.create(this);
234-
localDataTrack = LocalDataTrack.create(getContext());
233+
// localDataTrack = LocalDataTrack.create(this);
234+
localDataTrack = LocalDataTrack.create(getContext());
235235

236-
// Start the thread where data messages are received
236+
// Start the thread where data messages are received
237237
dataTrackMessageThread.start();
238238
dataTrackMessageThreadHandler = new Handler(dataTrackMessageThread.getLooper());
239239

@@ -433,7 +433,7 @@ public void connectToRoomWrapper(
433433
boolean dominantSpeakerEnabled,
434434
boolean maintainVideoTrackInBackground,
435435
String cameraType
436-
) {
436+
) {
437437
this.roomName = roomName;
438438
this.accessToken = accessToken;
439439
this.enableRemoteAudio = enableRemoteAudio;
@@ -451,7 +451,7 @@ public void connectToRoomWrapper(
451451
Log.d("RNTwilioVideo", "Failed to create local video");
452452
// No need to connect to room if video creation failed
453453
return;
454-
}
454+
}
455455
} else {
456456
isVideoEnabled = false;
457457
}
@@ -480,18 +480,18 @@ public void connectToRoom() {
480480

481481
//LocalDataTrack localDataTrack = LocalDataTrack.create(getContext());
482482

483-
if (localDataTrack != null) {
483+
if (localDataTrack != null) {
484484
connectOptionsBuilder.dataTracks(Collections.singletonList(localDataTrack));
485485
}
486486

487487
connectOptionsBuilder.enableDominantSpeaker(this.dominantSpeakerEnabled);
488488

489-
if (enableNetworkQualityReporting) {
490-
connectOptionsBuilder.enableNetworkQuality(true);
491-
connectOptionsBuilder.networkQualityConfiguration(new NetworkQualityConfiguration(
492-
NetworkQualityVerbosity.NETWORK_QUALITY_VERBOSITY_MINIMAL,
493-
NetworkQualityVerbosity.NETWORK_QUALITY_VERBOSITY_MINIMAL));
494-
}
489+
if (enableNetworkQualityReporting) {
490+
connectOptionsBuilder.enableNetworkQuality(true);
491+
connectOptionsBuilder.networkQualityConfiguration(new NetworkQualityConfiguration(
492+
NetworkQualityVerbosity.NETWORK_QUALITY_VERBOSITY_MINIMAL,
493+
NetworkQualityVerbosity.NETWORK_QUALITY_VERBOSITY_MINIMAL));
494+
}
495495

496496
room = Video.connect(getContext(), connectOptionsBuilder.build(), roomListener());
497497
}
@@ -586,10 +586,10 @@ public void disconnect() {
586586

587587
// ===== SEND STRING ON DATA TRACK ======================================================================
588588
public void sendString(String message) {
589-
if (localDataTrack != null) {
590-
localDataTrack.send(message);
591-
}
589+
if (localDataTrack != null) {
590+
localDataTrack.send(message);
592591
}
592+
}
593593

594594
private static boolean isCurrentCameraSourceBackFacing() {
595595
return cameraCapturer != null && cameraCapturer.getCameraId() == backFacingDevice;
@@ -619,7 +619,7 @@ public void switchCamera() {
619619
}
620620

621621
public void toggleVideo(boolean enabled) {
622-
isVideoEnabled = enabled;
622+
isVideoEnabled = enabled;
623623

624624
if (cameraCapturer == null && enabled) {
625625
String fallbackCameraType = cameraType == null ? CustomTwilioVideoView.FRONT_CAMERA_TYPE : cameraType;
@@ -640,13 +640,13 @@ public void toggleVideo(boolean enabled) {
640640
}
641641
}
642642

643-
public void toggleSoundSetup(boolean speaker){
644-
AudioManager audioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
645-
if(speaker){
646-
audioManager.setSpeakerphoneOn(true);
647-
} else {
648-
audioManager.setSpeakerphoneOn(false);
649-
}
643+
public void toggleSoundSetup(boolean speaker) {
644+
AudioManager audioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
645+
if (speaker) {
646+
audioManager.setSpeakerphoneOn(true);
647+
} else {
648+
audioManager.setSpeakerphoneOn(false);
649+
}
650650
}
651651

652652
public void toggleAudio(boolean enabled) {
@@ -661,7 +661,7 @@ public void toggleAudio(boolean enabled) {
661661

662662
public void toggleBluetoothHeadset(boolean enabled) {
663663
AudioManager audioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
664-
if(enabled){
664+
if (enabled) {
665665
audioManager.startBluetoothSco();
666666
} else {
667667
audioManager.stopBluetoothSco();
@@ -671,9 +671,9 @@ public void toggleBluetoothHeadset(boolean enabled) {
671671
public void toggleRemoteAudio(boolean enabled) {
672672
if (room != null) {
673673
for (RemoteParticipant rp : room.getRemoteParticipants()) {
674-
for(AudioTrackPublication at : rp.getAudioTracks()) {
675-
if(at.getAudioTrack() != null) {
676-
((RemoteAudioTrack)at.getAudioTrack()).enablePlayback(enabled);
674+
for (AudioTrackPublication at : rp.getAudioTracks()) {
675+
if (at.getAudioTrack() != null) {
676+
((RemoteAudioTrack) at.getAudioTrack()).enablePlayback(enabled);
677677
}
678678
}
679679
}
@@ -865,12 +865,12 @@ public void onDisconnected(Room room, TwilioException e) {
865865
WritableMap event = new WritableNativeMap();
866866

867867
if (localParticipant != null) {
868-
event.putString("participant", localParticipant.getIdentity());
868+
event.putString("participant", localParticipant.getIdentity());
869869
}
870870
event.putString("roomName", room.getName());
871871
event.putString("roomSid", room.getSid());
872872
if (e != null) {
873-
event.putString("error", e.getMessage());
873+
event.putString("error", e.getMessage());
874874
}
875875
pushEvent(CustomTwilioVideoView.this, ON_DISCONNECTED, event);
876876

@@ -941,16 +941,16 @@ private void addParticipant(Room room, RemoteParticipant remoteParticipant) {
941941
remoteParticipant.setListener(mediaListener());
942942

943943
for (final RemoteDataTrackPublication remoteDataTrackPublication :
944-
remoteParticipant.getRemoteDataTracks()) {
945-
/*
946-
* Data track messages are received on the thread that calls setListener. Post the
947-
* invocation of setting the listener onto our dedicated data track message thread.
948-
*/
949-
if (remoteDataTrackPublication.isTrackSubscribed()) {
950-
dataTrackMessageThreadHandler.post(() -> addRemoteDataTrack(remoteParticipant,
951-
remoteDataTrackPublication.getRemoteDataTrack()));
952-
}
953-
}
944+
remoteParticipant.getRemoteDataTracks()) {
945+
/*
946+
* Data track messages are received on the thread that calls setListener. Post the
947+
* invocation of setting the listener onto our dedicated data track message thread.
948+
*/
949+
if (remoteDataTrackPublication.isTrackSubscribed()) {
950+
dataTrackMessageThreadHandler.post(() -> addRemoteDataTrack(remoteParticipant,
951+
remoteDataTrackPublication.getRemoteDataTrack()));
952+
}
953+
}
954954
}
955955

956956
/*
@@ -977,15 +977,15 @@ private RemoteParticipant.Listener mediaListener() {
977977
return new RemoteParticipant.Listener() {
978978
@Override
979979
public void onAudioTrackSubscribed(RemoteParticipant participant, RemoteAudioTrackPublication publication, RemoteAudioTrack audioTrack) {
980-
audioTrack.enablePlayback(enableRemoteAudio);
981-
WritableMap event = buildParticipantVideoEvent(participant, publication);
982-
pushEvent(CustomTwilioVideoView.this, ON_PARTICIPANT_ADDED_AUDIO_TRACK, event);
980+
audioTrack.enablePlayback(enableRemoteAudio);
981+
WritableMap event = buildParticipantVideoEvent(participant, publication);
982+
pushEvent(CustomTwilioVideoView.this, ON_PARTICIPANT_ADDED_AUDIO_TRACK, event);
983983
}
984984

985985
@Override
986986
public void onAudioTrackUnsubscribed(RemoteParticipant participant, RemoteAudioTrackPublication publication, RemoteAudioTrack audioTrack) {
987-
WritableMap event = buildParticipantVideoEvent(participant, publication);
988-
pushEvent(CustomTwilioVideoView.this, ON_PARTICIPANT_REMOVED_AUDIO_TRACK, event);
987+
WritableMap event = buildParticipantVideoEvent(participant, publication);
988+
pushEvent(CustomTwilioVideoView.this, ON_PARTICIPANT_REMOVED_AUDIO_TRACK, event);
989989
}
990990

991991
@Override
@@ -1004,15 +1004,15 @@ public void onAudioTrackUnpublished(RemoteParticipant participant, RemoteAudioTr
10041004

10051005
@Override
10061006
public void onDataTrackSubscribed(RemoteParticipant remoteParticipant, RemoteDataTrackPublication remoteDataTrackPublication, RemoteDataTrack remoteDataTrack) {
1007-
WritableMap event = buildParticipantDataEvent(remoteParticipant, remoteDataTrackPublication);
1008-
pushEvent(CustomTwilioVideoView.this, ON_PARTICIPANT_ADDED_DATA_TRACK, event);
1009-
dataTrackMessageThreadHandler.post(() -> addRemoteDataTrack(remoteParticipant, remoteDataTrack));
1007+
WritableMap event = buildParticipantDataEvent(remoteParticipant, remoteDataTrackPublication);
1008+
pushEvent(CustomTwilioVideoView.this, ON_PARTICIPANT_ADDED_DATA_TRACK, event);
1009+
dataTrackMessageThreadHandler.post(() -> addRemoteDataTrack(remoteParticipant, remoteDataTrack));
10101010
}
10111011

10121012
@Override
10131013
public void onDataTrackUnsubscribed(RemoteParticipant remoteParticipant, RemoteDataTrackPublication remoteDataTrackPublication, RemoteDataTrack remoteDataTrack) {
1014-
WritableMap event = buildParticipantDataEvent(remoteParticipant, remoteDataTrackPublication);
1015-
pushEvent(CustomTwilioVideoView.this, ON_PARTICIPANT_REMOVED_DATA_TRACK, event);
1014+
WritableMap event = buildParticipantDataEvent(remoteParticipant, remoteDataTrackPublication);
1015+
pushEvent(CustomTwilioVideoView.this, ON_PARTICIPANT_REMOVED_DATA_TRACK, event);
10161016
}
10171017

10181018
@Override

0 commit comments

Comments
 (0)