Skip to content

Instantly share code, notes, and snippets.

@torchhound
Last active March 8, 2017 05:41
Show Gist options
  • Save torchhound/c99ca132a980de4aab2d8fe74c7b314e to your computer and use it in GitHub Desktop.
Save torchhound/c99ca132a980de4aab2d8fe74c7b314e to your computer and use it in GitHub Desktop.
500px Blur View Library Implementation
<com.fivehundredpx.android.blur.BlurringView
android:id="@+id/blurring_view"
android:layout_width="match_parent"
android:layout_height="56dp"
app:blurRadius="2"
app:downsampleFactor="6"
app:overlayColor="@color/player_bottom"/>
app build.gradle
android{
defaultConfig{
renderscriptTargetApi 20
renderscriptSupportModeEnabled true
}
}
dependencies {
repositories {
maven { url 'https://github.com/500px/500px-android-blur/raw/master/releases/' }
}
compile('com.fivehundredpx:blurringview:1.0.0') {
force = true;
}
}
final LayoutInflater factory = getActivity().getLayoutInflater();
final View miniplayerView = factory.inflate(R.layout.miniplayer, null);
final BlurringView miniplayerBlurringView = (BlurringView) miniplayerView.findViewById(R.id.blurring_view);
final LinearLayout miniplayerBlurredView = (LinearLayout) miniplayerView.findViewById(R.id.miniplayer_linear);
miniplayerBlurringView.setBlurredView(miniplayerBlurredView);
newsfeedRecycler.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
miniplayerBlurringView.invalidate();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment