-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow customizing how the content of BottomSheet is dimmed
Fixes #2
- Loading branch information
Emil Sjolander
committed
Jun 8, 2015
1 parent
18b989e
commit b71a338
Showing
3 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
bottomsheet/src/main/java/com/flipboard/bottomsheet/BaseViewTransformer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.flipboard.bottomsheet; | ||
|
||
import android.view.View; | ||
|
||
/** | ||
* A very simple view transformer which only handles applying a correct dim. | ||
*/ | ||
public abstract class BaseViewTransformer implements ViewTransformer { | ||
|
||
public static final float MAX_DIM_ALPHA = 0.7f; | ||
|
||
@Override | ||
public float getDimAlpha(float translation, float maxTranslation, float peekedTranslation, BottomSheetLayout parent, View view) { | ||
float progress = translation / maxTranslation; | ||
return progress * MAX_DIM_ALPHA; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters