Only resize list popup if it's still attached to a window

We can't rely on ListPopupWindow.dismiss() to get called before the popup
is removed, for example when the activity hosting the popup is finished,
but we can easily ensure that the popup is still attached to a window.

Bug: 20831507
Change-Id: I9dcaa46e68df3f2b301cf299fa64d460c7e177fd
1 file changed