Skip to content

Commit

Permalink
Merge pull request #58 from Flipboard/dim
Browse files Browse the repository at this point in the history
Make bottomsheet work with YoutubePlayer from the Youtube SDK
  • Loading branch information
markrietveld committed Sep 8, 2015
2 parents 8103b06 + e8d8b9a commit f26f4c1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -479,6 +484,7 @@ private void initializeSheetValues() {
this.contentClipRect.set(0, 0, getWidth(), getHeight());
getSheetView().setTranslationY(getHeight());
dimView.setAlpha(0);
dimView.setVisibility(INVISIBLE);
}

/**
Expand Down

0 comments on commit f26f4c1

Please sign in to comment.