/ Blur

Easily have blurred and transparent background effect on your Android views

Easily have blurred and transparent background effect on your Android views

BlurBehind

Easily have blurred and transparent background effect on your Android views.

Before API level 14 there was a Window flag called FLAG_BLUR_BEHIND. It was used for "blurring everything behind a window" and is no longer supported by Android.

BlurBehind provides an easy way to have that effect, with customization, for your window without API level restrictions.

Usage

Invoke BlurBehind.getInstance().execute() method with caller Activity and the actual work as a Runnable.

dummyButton.setOnClickListener(new View.OnClickListener() {
	@Override
	public void onClick(View v) {

		BlurBehind.getInstance().execute(MainActivity.this, new OnBlurCompleteListener() {
            @Override
            public void onBlurComplete() {
                Intent intent = new Intent(MainActivity.this, BlurredActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

                startActivity(intent);
            }
        });
	}
});

And use BlurBehind.getInstance().setBackground(Activity a) method on new View, which is an Activity in sample project:

BlurBehind.getInstance().setBackground(this);

You can optionally set alpha and filterColor:

BlurBehind.getInstance()
    .withAlpha(80)
    .withFilterColor(Color.parseColor("#0075c0")) //or Color.RED
    .setBackground(this);

Which will result in this:

blur-behind-after-alpha-color

blur-behind-before

Dependency

  • Run gradle install on blur-behind library project.
  • In your build.gradle:
repositories {
    mavenCentral()
    mavenLocal() //Add local m2 repository of yours
}
dependencies {
    compile 'com.faradaj:blur-behind:[LATEST_RELEASE_VERSION]'
}

or

  • In your pom.xml:
<dependency>
  <groupId>com.faradaj</groupId>
  <artifactId>blur-behind</artifactId>
  <version>[LATEST_RELEASE_VERSION]</version>
</dependency>

or you can clone and add blur-behind as a library project to yours.

GitHub