Don't clear translation state on temporary detachment.
Change I97cc418a8 broke translation on apps which use ListView; messages were re-translated with the animation even while on-screen. A new message arrival triggers a re-layout which causes the temporary detachment, which caused translation to be cleared, and the views get translated again later. The solution is to NOT clear translation in the case of temporary detachment. When Views are actually recycled (e.g., by ListView and RecyclerView), the detachment is permanent/non-temporary. Bug: 232178488 Test: atest UiTranslationManagerTest Test: Manual - Verified scrolling and new messages arriving when translation is enabled. Tested on apps that use ListView and RecyclerView. Change-Id: Ibf1be58219c43252e00b06d4c9e27def5bd36fc2
This commit is contained in:
@@ -10000,7 +10000,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
// We reset any translation state as views may be re-used (e.g., as in ListView and
|
||||
// RecyclerView). We only need to do this for views important for content capture since
|
||||
// views unimportant for content capture won't be translated anyway.
|
||||
clearTranslationState();
|
||||
if (!isTemporarilyDetached()) {
|
||||
clearTranslationState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user