Merge "Fixed that texts of players would often remain empty" into rvc-dev am: 7387faf8c2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12038727

Change-Id: Ice0c8ed8e0f2e4f5d5ee9ee91fa487b771b595a5
This commit is contained in:
Selim Cinek
2020-06-30 21:20:44 +00:00
committed by Automerger Merge Worker
2 changed files with 20 additions and 15 deletions

View File

@@ -249,6 +249,7 @@ class MediaCarouselController @Inject constructor(
val lp = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT)
existingPlayer.view?.player?.setLayoutParams(lp)
existingPlayer.bind(data)
existingPlayer.setListening(currentlyExpanded)
updatePlayerToState(existingPlayer, noAnimation = true)
if (existingPlayer.isPlaying) {
@@ -256,16 +257,18 @@ class MediaCarouselController @Inject constructor(
} else {
mediaContent.addView(existingPlayer.view?.player)
}
} else if (existingPlayer.isPlaying &&
mediaContent.indexOfChild(existingPlayer.view?.player) != 0) {
if (visualStabilityManager.isReorderingAllowed) {
mediaContent.removeView(existingPlayer.view?.player)
mediaContent.addView(existingPlayer.view?.player, 0)
} else {
needsReordering = true
} else {
existingPlayer.bind(data)
if (existingPlayer.isPlaying &&
mediaContent.indexOfChild(existingPlayer.view?.player) != 0) {
if (visualStabilityManager.isReorderingAllowed) {
mediaContent.removeView(existingPlayer.view?.player)
mediaContent.addView(existingPlayer.view?.player, 0)
} else {
needsReordering = true
}
}
}
existingPlayer?.bind(data)
updatePageIndicator()
mediaCarouselScrollHandler.onPlayersChanged()
mediaCarousel.requiresRemeasuring = true

View File

@@ -268,7 +268,6 @@ class MediaViewController @Inject constructor(
fun attach(transitionLayout: TransitionLayout) {
this.transitionLayout = transitionLayout
layoutController.attach(transitionLayout)
ensureAllMeasurements()
if (currentEndLocation == -1) {
return
}
@@ -414,13 +413,16 @@ class MediaViewController @Inject constructor(
* Clear all existing measurements and refresh the state to match the view.
*/
fun refreshState() {
if (!firstRefresh) {
// Let's clear all of our measurements and recreate them!
viewStates.clear()
setCurrentState(currentStartLocation, currentEndLocation, currentTransitionProgress,
applyImmediately = true)
// Let's clear all of our measurements and recreate them!
viewStates.clear()
if (firstRefresh) {
// This is the first bind, let's ensure we pre-cache all measurements. Otherwise
// We'll just load these on demand.
ensureAllMeasurements()
firstRefresh = false
}
firstRefresh = false
setCurrentState(currentStartLocation, currentEndLocation, currentTransitionProgress,
applyImmediately = true)
}
}