Fix ListView can not be moved after rotation.
Symptom: "Share with" popup displayed incompletely, and cannot be slid after rotated the screen twice. Root cause: Since ChooserActivity's configChanges attribute contains "screenSize|orientation" , when user rotates device, Android will not recreate ChooserActivity, its content view ResolverDrawerLayout is also not recreated. In ResolverDrawerLayout's onMeasure, it will call getHeightUsed to calculate the ListView's height. getHeightUsed will check against the lowest child view plus padding and margin instead of the actual measured height of the ListView. This lets the ListView hang off the edge when all of the content would fit on-screen . Because of ResolverDrawerLayout has not been drawn yet, we can not get the actual showing items' count of ListView before it's drawn, the result of getChildCount for ListView will return the value in landscape mode. The heightUsed of ListView might be smaller. mCollapsibleHeight will be 0. When received a move action, the mCollapseOffset and new position might both be 0. Solution: When configuration changed, we should rebuild the list and refresh adapter's data set. Just like onRestart does. Bug: 34365764 Change-Id: I4be0f9afc68588fbb0d8d152c41509650d04c754
Loading
Please register or sign in to comment