Fix initial visibility of PlayerControlView

This applies when PlayerControlView is used as a standalone
component (not inside PlayerView). Previously hideAtMs was
set to 0, which caused the view to be immediatley hidden in
onAttachedToWindow. After this change the first time the view
is attached to the window is effectively treated as a "user
interaction" for the purposes of deciding when to timeout.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184056324
This commit is contained in:
olly 2018-01-31 15:22:35 -08:00 committed by Oliver Woodman
parent 2f932bfaf7
commit fd10a3cbb0

View File

@ -271,6 +271,7 @@ public class PlayerControlView extends FrameLayout {
fastForwardMs = DEFAULT_FAST_FORWARD_MS;
showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS;
repeatToggleModes = DEFAULT_REPEAT_TOGGLE_MODES;
hideAtMs = C.TIME_UNSET;
showShuffleButton = false;
if (playbackAttrs != null) {
TypedArray a =
@ -937,6 +938,8 @@ public class PlayerControlView extends FrameLayout {
} else {
postDelayed(hideAction, delayMs);
}
} else if (isVisible()) {
hideAfterTimeout();
}
updateAll();
}