From 347f481e327489f9732ff1fa9000f0036223a3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Sang=20Lin?= Date: Tue, 24 Sep 2024 13:19:23 -0700 Subject: [PATCH] Fix lint app --- .../chime/sdkdemo/fragment/MeetingFragment.kt | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/com/amazonaws/services/chime/sdkdemo/fragment/MeetingFragment.kt b/app/src/main/java/com/amazonaws/services/chime/sdkdemo/fragment/MeetingFragment.kt index 5a524920..7ff11bde 100644 --- a/app/src/main/java/com/amazonaws/services/chime/sdkdemo/fragment/MeetingFragment.kt +++ b/app/src/main/java/com/amazonaws/services/chime/sdkdemo/fragment/MeetingFragment.kt @@ -375,7 +375,7 @@ class MeetingFragment : Fragment(), buttonSendChat ) - buttons.forEach { + buttons.iterator().forEach { if (!promoted) { it.alpha = 0.2f it.isClickable = false @@ -491,7 +491,7 @@ class MeetingFragment : Fragment(), private fun setupTab(view: View) { tabLayout = view.findViewById(R.id.tabLayoutMeetingView) - SubTab.values().forEach { + SubTab.values().iterator().forEach { tabLayout.addTab( tabLayout.newTab().setText(it.name).setContentDescription("${it.name} Tab") ) @@ -517,11 +517,11 @@ class MeetingFragment : Fragment(), private fun setVideoSurfaceViewsVisibility(visibility: Int) { meetingModel.localVideoTileState?.setRenderViewVisibility(visibility) - meetingModel.getRemoteVideoTileStates().forEach { it.setRenderViewVisibility(visibility) } + meetingModel.getRemoteVideoTileStates().iterator().forEach { it.setRenderViewVisibility(visibility) } } private fun setScreenSurfaceViewsVisibility(visibility: Int) { - meetingModel.currentScreenTiles.forEach { it.setRenderViewVisibility(visibility) } + meetingModel.currentScreenTiles.iterator().forEach { it.setRenderViewVisibility(visibility) } } private fun showViewAt(index: Int) { @@ -778,7 +778,7 @@ class MeetingFragment : Fragment(), override fun onVolumeChanged(volumeUpdates: Array) { uiScope.launch { mutex.withLock { - volumeUpdates.forEach { (attendeeInfo, volumeLevel) -> + volumeUpdates.iterator().forEach { (attendeeInfo, volumeLevel) -> meetingModel.currentRoster[attendeeInfo.attendeeId]?.let { meetingModel.currentRoster[attendeeInfo.attendeeId] = RosterAttendee( @@ -799,7 +799,7 @@ class MeetingFragment : Fragment(), override fun onSignalStrengthChanged(signalUpdates: Array) { uiScope.launch { mutex.withLock { - signalUpdates.forEach { (attendeeInfo, signalStrength) -> + signalUpdates.iterator().forEach { (attendeeInfo, signalStrength) -> logWithFunctionName( "onSignalStrengthChanged", "${attendeeInfo.externalUserId} $signalStrength", @@ -829,7 +829,7 @@ class MeetingFragment : Fragment(), override fun onAttendeesLeft(attendeeInfo: Array) { uiScope.launch { mutex.withLock { - attendeeInfo.forEach { (attendeeId, _) -> + attendeeInfo.iterator().forEach { (attendeeId, _) -> meetingModel.currentRoster.remove( attendeeId ) @@ -841,7 +841,7 @@ class MeetingFragment : Fragment(), } override fun onAttendeesDropped(attendeeInfo: Array) { - attendeeInfo.forEach { (_, externalUserId) -> + attendeeInfo.iterator().forEach { (_, externalUserId) -> notifyHandler("$externalUserId dropped") logWithFunctionName( object {}.javaClass.enclosingMethod?.name, @@ -851,7 +851,7 @@ class MeetingFragment : Fragment(), uiScope.launch { mutex.withLock { - attendeeInfo.forEach { (attendeeId, _) -> + attendeeInfo.iterator().forEach { (attendeeId, _) -> meetingModel.currentRoster.remove( attendeeId ) @@ -863,7 +863,7 @@ class MeetingFragment : Fragment(), } override fun onAttendeesMuted(attendeeInfo: Array) { - attendeeInfo.forEach { (attendeeId, externalUserId) -> + attendeeInfo.iterator().forEach { (attendeeId, externalUserId) -> logWithFunctionName( object {}.javaClass.enclosingMethod?.name, "Attendee with attendeeId $attendeeId and externalUserId $externalUserId muted" @@ -872,7 +872,7 @@ class MeetingFragment : Fragment(), } override fun onAttendeesUnmuted(attendeeInfo: Array) { - attendeeInfo.forEach { (attendeeId, externalUserId) -> + attendeeInfo.iterator().forEach { (attendeeId, externalUserId) -> logger.info( TAG, "Attendee with attendeeId $attendeeId and externalUserId $externalUserId unmuted" @@ -885,7 +885,7 @@ class MeetingFragment : Fragment(), mutex.withLock { var needUpdate = false val activeSpeakers = attendeeInfo.map { it.attendeeId }.toSet() - meetingModel.currentRoster.values.forEach { attendee -> + meetingModel.currentRoster.values.iterator().forEach { attendee -> if (activeSpeakers.contains(attendee.attendeeId) != attendee.isActiveSpeaker) { meetingModel.currentRoster[attendee.attendeeId] = RosterAttendee( @@ -926,7 +926,7 @@ class MeetingFragment : Fragment(), ) { uiScope.launch { mutex.withLock { - attendeeInfo.forEach { (attendeeId, externalUserId) -> + attendeeInfo.iterator().forEach { (attendeeId, externalUserId) -> if (attendeeId.isContentShare() && !isSelfAttendee(attendeeId) && meetingModel.isSharingContent @@ -1248,7 +1248,7 @@ class MeetingFragment : Fragment(), } is Transcript -> { val entitySet = mutableSetOf() - transcriptEvent.results.forEach { result -> + transcriptEvent.results.iterator().forEach { result -> val alternative = result.alternatives.firstOrNull() ?: return // for simplicity and demo purposes, assume each result only contains transcripts from // the same speaker, which matches our observation with current transcription service behavior. @@ -1274,7 +1274,7 @@ class MeetingFragment : Fragment(), alternative.items ) } else { - entities.forEach { entity -> + entities.iterator().forEach { entity -> entitySet.addAll(entity.content.split(" ")) } Caption( @@ -1379,7 +1379,7 @@ class MeetingFragment : Fragment(), private fun subscribeRemoteVideoByTileState(tileSate: VideoTileState) { val updatedSources: MutableMap = mutableMapOf() - meetingModel.getRemoteVideoSourceConfigurations().forEach { + meetingModel.getRemoteVideoSourceConfigurations().iterator().forEach { if (it.key.attendeeId == tileSate.attendeeId) { updatedSources[it.key] = it.value } @@ -1389,7 +1389,7 @@ class MeetingFragment : Fragment(), private fun unsubscribeRemoteVideoByTileState(tileState: VideoTileState) { val removedList: ArrayList = arrayListOf() - meetingModel.getRemoteVideoSourceConfigurations().forEach { + meetingModel.getRemoteVideoSourceConfigurations().iterator().forEach { if (it.key.attendeeId == tileState.attendeeId) { removedList.add(it.key) } @@ -1399,7 +1399,7 @@ class MeetingFragment : Fragment(), private fun unsubscribeAllRemoteVideos() { val removedList: ArrayList = arrayListOf() - meetingModel.getRemoteVideoTileStates().forEach { + meetingModel.getRemoteVideoTileStates().iterator().forEach { for ((key) in meetingModel.getRemoteVideoSourceConfigurations()) { if (key.attendeeId == it.videoTileState.attendeeId) { removedList.add(key) @@ -1410,7 +1410,7 @@ class MeetingFragment : Fragment(), } private fun pauseAllContentShares() { - meetingModel.currentScreenTiles.forEach { + meetingModel.currentScreenTiles.iterator().forEach { unsubscribeRemoteVideoByTileState(it.videoTileState) } } @@ -1547,7 +1547,7 @@ class MeetingFragment : Fragment(), if (tileState.isContent) { meetingModel.currentScreenTiles.add(videoCollectionTile) screenTileAdapter.notifyDataSetChanged() - meetingModel.currentScreenTiles.forEach { + meetingModel.currentScreenTiles.iterator().forEach { subscribeRemoteVideoByTileState(it.videoTileState) audioVideo.resumeRemoteVideoTile(it.videoTileState.tileId) } @@ -1714,7 +1714,7 @@ class MeetingFragment : Fragment(), // removed(by calling AudioVideo.updateVideoSourceSubscriptions()), as they will be // automatically unsubscribed in SDK. // The tracking sources still need to be removed in demo app - sources.forEach { meetingModel.removeVideoSource(it) } + sources.iterator().forEach { meetingModel.removeVideoSource(it) } } override fun onVideoTileAdded(tileState: VideoTileState) { @@ -1801,7 +1801,7 @@ class MeetingFragment : Fragment(), uiScope.launch { mutex.withLock { meetingModel.currentMetrics.clear() - metrics.forEach { (metricsName, metricsValue) -> + metrics.iterator().forEach { (metricsName, metricsValue) -> meetingModel.currentMetrics[metricsName.name] = MetricData(metricsName.name, metricsValue.toString()) } @@ -1920,10 +1920,10 @@ class MeetingFragment : Fragment(), if (meetingModel.localVideoTileState != null) { audioVideo.unbindVideoView(meetingModel.localTileId) } - meetingModel.getRemoteVideoTileStates().forEach { + meetingModel.getRemoteVideoTileStates().iterator().forEach { audioVideo.unbindVideoView(it.videoTileState.tileId) } - meetingModel.currentScreenTiles.forEach { + meetingModel.currentScreenTiles.iterator().forEach { audioVideo.unbindVideoView(it.videoTileState.tileId) } audioVideo.stopLocalVideo()