Fix warnings

Only one warning fix changes any behavior. At the end of
reorderAllPlayers, there was a block of code that looks like it will execute but actually just declares a lambda that does not run.

Bug: 209148780
Test: ran all tests
Change-Id: I316c4ef7b459fe4a7e539e0aa57b873c6b688716
This commit is contained in:
Justin Weir
2022-04-27 19:56:43 +00:00
parent 5ec5a80c8a
commit e2fb4b8166

View File

@@ -127,7 +127,7 @@ class MediaCarouselController @Inject constructor(
private val visualStabilityCallback: OnReorderingAllowedListener
private var needsReordering: Boolean = false
private var keysNeedRemoval = mutableSetOf<String>()
protected var shouldScrollToActivePlayer: Boolean = false
var shouldScrollToActivePlayer: Boolean = false
private var isRtl: Boolean = false
set(value) {
if (value != field) {
@@ -413,9 +413,7 @@ class MediaCarouselController @Inject constructor(
.indexOfFirst { key -> it == key }
mediaCarouselScrollHandler
.scrollToPlayer(previousVisibleIndex, activeMediaIndex)
} ?: {
mediaCarouselScrollHandler.scrollToPlayer(destIndex = activeMediaIndex)
}
} ?: mediaCarouselScrollHandler.scrollToPlayer(destIndex = activeMediaIndex)
}
}
}
@@ -432,7 +430,7 @@ class MediaCarouselController @Inject constructor(
val curVisibleMediaKey = MediaPlayerData.playerKeys()
.elementAtOrNull(mediaCarouselScrollHandler.visibleMediaIndex)
if (existingPlayer == null) {
var newPlayer = mediaControlPanelFactory.get()
val newPlayer = mediaControlPanelFactory.get()
newPlayer.attachPlayer(MediaViewHolder.create(
LayoutInflater.from(context), mediaContent))
newPlayer.mediaViewController.sizeChangedListener = this::updateCarouselDimensions
@@ -480,7 +478,7 @@ class MediaCarouselController @Inject constructor(
MediaPlayerData.removeMediaPlayer(existingSmartspaceMediaKey)
}
var newRecs = mediaControlPanelFactory.get()
val newRecs = mediaControlPanelFactory.get()
newRecs.attachRecommendation(
RecommendationViewHolder.create(LayoutInflater.from(context), mediaContent))
newRecs.mediaViewController.sizeChangedListener = this::updateCarouselDimensions
@@ -1048,7 +1046,5 @@ internal object MediaPlayerData {
return false
}
fun isSsReactivated(key: String): Boolean = mediaData.get(key)?.let {
it.isSsReactivated
} ?: false
fun isSsReactivated(key: String): Boolean = mediaData.get(key)?.isSsReactivated ?: false
}