From e8d8b9a7980e9a403b80792833a36196a4033a5c Mon Sep 17 00:00:00 2001 From: Mark Rietveld Date: Mon, 7 Sep 2015 18:10:42 -0700 Subject: [PATCH] Make bottomsheet work with YoutubePlayer from the Youtube SDK The player pauses if something is covering it. In the bottomsheet case, the dimview was always covering it The alpha was always 0 in the closed state, but the player doesn't care about that Setting dimView to INVISIBLE makes the player work. It will still pause when a sheet is opened, but that seems like expected behavior, and it can be resume after closing the sheet --- .../java/com/flipboard/bottomsheet/BottomSheetLayout.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bottomsheet/src/main/java/com/flipboard/bottomsheet/BottomSheetLayout.java b/bottomsheet/src/main/java/com/flipboard/bottomsheet/BottomSheetLayout.java index 24b83bee41..40ed6d6b0a 100644 --- a/bottomsheet/src/main/java/com/flipboard/bottomsheet/BottomSheetLayout.java +++ b/bottomsheet/src/main/java/com/flipboard/bottomsheet/BottomSheetLayout.java @@ -146,6 +146,7 @@ private void init() { dimView = new View(getContext()); dimView.setBackgroundColor(Color.BLACK); dimView.setAlpha(0); + dimView.setVisibility(INVISIBLE); peek = 0;//getHeight() return 0 at start! @@ -240,7 +241,11 @@ private void setSheetTranslation(float sheetTranslation) { this.contentClipRect.set(0, 0, getWidth(), bottomClip); getSheetView().setTranslationY(getHeight() - sheetTranslation); transformView(sheetTranslation); - dimView.setAlpha(shouldDimContentView ? getDimAlpha(sheetTranslation) : 0); + if (shouldDimContentView) { + float dimAlpha = getDimAlpha(sheetTranslation); + dimView.setAlpha(dimAlpha); + dimView.setVisibility(dimAlpha > 0 ? VISIBLE : INVISIBLE); + } } private void transformView(float sheetTranslation) { @@ -479,6 +484,7 @@ private void initializeSheetValues() { this.contentClipRect.set(0, 0, getWidth(), getHeight()); getSheetView().setTranslationY(getHeight()); dimView.setAlpha(0); + dimView.setVisibility(INVISIBLE); } /**