Cell visibility issues when reordering on Android L
Opened this issue · 1 comments
SteveMil commented
I'm running the 'official' pre-release version of Android L (LPV79) on my Nexus 5. Both DynamicGridExample and my app have cell visibility issues when reordering. I was able to fix it just by stubbing out two calls to setVisibility() in handleCellSwitch() in DynamicGridView.java. I added the following code to dynamically check for L and only make the calls if on a pre-L OS. I'm not sure this is the best fix, but is working for me at the moment.
/**
* The GridView from Android L requires some different setVisibility() logic
* when switching cells. Unfortunately, both 4.4W and the pre-release L
* report 20 for the SDK_INT, but we want to return true for 4.4W and false
* for Android L. So, we check the release name for "L" if we see SDK 20.
* Hopefully, Android L will actually be SDK 21 or later when it ships.
*
* @return
*/
private boolean isPreL() {
final int KITKAT_WATCH = 20;
return (Build.VERSION.SDK_INT < KITKAT_WATCH) ||
((Build.VERSION.SDK_INT == KITKAT_WATCH) && !"L".equals(Build.VERSION.RELEASE));
}
private void handleCellSwitch() {
...
if (isPreL()) {
mobileView.setVisibility(View.VISIBLE);
}
if (isPostHoneycomb() && isPreL()) {
targetView.setVisibility(View.INVISIBLE);
}
...
}