mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 977155 - Don't animate HomeBanner when it's not visible. r=bnicholson
This commit is contained in:
parent
ef6f973be6
commit
3bbedb11ea
@ -138,8 +138,12 @@ public class HomeBanner extends LinearLayout
|
||||
public void run() {
|
||||
mTextView.setText(text);
|
||||
setVisibility(VISIBLE);
|
||||
|
||||
// Animate the banner if it is currently enabled.
|
||||
if (mEnabled) {
|
||||
animateUp();
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (JSONException e) {
|
||||
Log.e(LOGTAG, "Exception handling " + event + " message", e);
|
||||
@ -168,6 +172,12 @@ public class HomeBanner extends LinearLayout
|
||||
}
|
||||
|
||||
mEnabled = enabled;
|
||||
|
||||
// Don't animate if the banner isn't visible.
|
||||
if (getVisibility() != View.VISIBLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
animateUp();
|
||||
} else {
|
||||
@ -176,14 +186,9 @@ public class HomeBanner extends LinearLayout
|
||||
}
|
||||
|
||||
private void animateUp() {
|
||||
// Check to make sure that message has been received and the banner has been enabled.
|
||||
// Necessary to avoid race conditions between show() and handleMessage() calls.
|
||||
if (!mEnabled || TextUtils.isEmpty(mTextView.getText()) || mUserSwipedDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
// No need to animate if already translated.
|
||||
if (ViewHelper.getTranslationY(this) == 0) {
|
||||
// Don't try to animate if the banner is already translated, or if the user swiped
|
||||
// the banner down previously to hide it.
|
||||
if (ViewHelper.getTranslationY(this) == 0 || mUserSwipedDown) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -193,7 +198,7 @@ public class HomeBanner extends LinearLayout
|
||||
}
|
||||
|
||||
private void animateDown() {
|
||||
// No need to animate if already translated or gone.
|
||||
// Don't try to animate if the banner is already translated.
|
||||
if (ViewHelper.getTranslationY(this) == getHeight()) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user