fix(magnification thumbnail): fix thumbnail area wrong when IME opens or orientation changes
This is because it was still using the old width/height from before the layout change. Fix: b/279538599 Fix: b/279527264 Test: manual Change-Id: I9f3cd40d9caba2a19ca93e1f87ff217840da771b
This commit is contained in:
@@ -270,21 +270,16 @@ public class MagnificationThumbnail {
|
|||||||
mThumbnailView.setScaleX(scaleDown);
|
mThumbnailView.setScaleX(scaleDown);
|
||||||
mThumbnailView.setScaleY(scaleDown);
|
mThumbnailView.setScaleY(scaleDown);
|
||||||
}
|
}
|
||||||
float thumbnailWidth;
|
|
||||||
float thumbnailHeight;
|
if (!Float.isNaN(centerX)
|
||||||
if (mThumbnailView.getWidth() == 0 || mThumbnailView.getHeight() == 0) {
|
&& !Float.isNaN(centerY)
|
||||||
// if the thumbnail view size is not updated correctly, we just use the cached values.
|
&& mThumbnailWidth > 0
|
||||||
thumbnailWidth = mThumbnailWidth;
|
&& mThumbnailHeight > 0
|
||||||
thumbnailHeight = mThumbnailHeight;
|
) {
|
||||||
} else {
|
|
||||||
thumbnailWidth = mThumbnailView.getWidth();
|
|
||||||
thumbnailHeight = mThumbnailView.getHeight();
|
|
||||||
}
|
|
||||||
if (!Float.isNaN(centerX)) {
|
|
||||||
var padding = mThumbnailView.getPaddingTop();
|
var padding = mThumbnailView.getPaddingTop();
|
||||||
var ratio = 1f / BG_ASPECT_RATIO;
|
var ratio = 1f / BG_ASPECT_RATIO;
|
||||||
var centerXScaled = centerX * ratio - (thumbnailWidth / 2f + padding);
|
var centerXScaled = centerX * ratio - (mThumbnailWidth / 2f + padding);
|
||||||
var centerYScaled = centerY * ratio - (thumbnailHeight / 2f + padding);
|
var centerYScaled = centerY * ratio - (mThumbnailHeight / 2f + padding);
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(
|
Log.d(
|
||||||
|
|||||||
Reference in New Issue
Block a user