GithubHelp home page GithubHelp logo

lerist / blurview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dimezis/blurview

0.0 2.0 0.0 9.14 MB

Dynamic iOS-like blur of underlying Views for Android

License: Apache License 2.0

Java 100.00%

blurview's Introduction

BlurView

alt tag

Dynamic iOS-like blur of underlying Views for Android. Includes library and small example project.

BlurView can be used as a regular FrameLayout. It blurs its underlying content and draws it as a background for its children. BlurView redraws its blurred content when changes in view hierarchy are detected (draw() called). It honors its position and size changes, including view animation and property animation.

How to use:

  <eightbitlab.com.blurview.BlurView
      android:id="@+id/blurView"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      app:blurOverlayColor="@color/colorOverlay">

       <!--Any child View here, TabLayout for example-->

  </eightbitlab.com.blurview.BlurView>
    final float radius = 16;

    final View decorView = getWindow().getDecorView();
    //Activity's root View. Can also be root View of your layout
    final View rootView = decorView.findViewById(android.R.id.content);
    //set background, if your root layout doesn't have one
    final Drawable windowBackground = decorView.getBackground();

    blurView.setupWith(rootView)
           .windowBackground(windowBackground)
           .blurAlgorithm(new RenderScriptBlur(this, true)) //Preferable algorithm, needs RenderScript support mode enabled
           .blurRadius(radius);

Enable RenderScript support mode:

 defaultConfig {
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true
  }

Perfomance

It takes 1-4ms on Nexus 5 and Nexus 4 to draw BlurView with the setup given in example project

Gradle

compile 'com.eightbitlab:blurview:1.0.1'

License

Copyright 2016 Dmitry Saviuk

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

blurview's People

Contributors

dimezis avatar

Watchers

Lerist avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.