cmsdk: fix visible check in hasChanged

Previously the visible check was comparing the newly set value to
itself. Now we cache the old value, set new value, and can do a proper
comparison.

Change-Id: Idbe921bfe9e311551d6bfbad432c647c129f376e
Signed-off-by: Roman Birg <roman@cyngn.com>
This commit is contained in:
Roman Birg 2016-08-30 16:00:36 -07:00
parent 70da0ef9dc
commit 662cb51642
1 changed files with 3 additions and 3 deletions

View File

@ -84,12 +84,12 @@ public class ExternalViewProperties {
if (mDecorView != null) { if (mDecorView != null) {
mDecorView.getHitRect(mHitRect); mDecorView.getHitRect(mHitRect);
} }
boolean visible = mView.getLocalVisibleRect(mHitRect); boolean wasVisible = mVisible;
mVisible = visible; mVisible = mView.getLocalVisibleRect(mHitRect);
// Check if anything actually changed // Check if anything actually changed
return previousX != newX || previousY != newY return previousX != newX || previousY != newY
|| previousWidth != mWidth || previousHeight != mHeight || previousWidth != mWidth || previousHeight != mHeight
|| mVisible != visible; || mVisible != wasVisible;
} }
} }