Giter Club home page Giter Club logo

etsyblur's Introduction

EtsyBlur

EtsyBlur is an Android library that allows developers to easily add a glass-like effect implemented in the Etsy app.

Quick Demo

Try out the sample application:

Android app on Google Play

Requirements

API Level 8 (Froyo) and above.

Setup

The library is pushed to Maven Central as an AAR, so you just need to add the followings to your build.gradle file:

dependencies {
    compile 'com.ms-square:etsyblur:0.1.3'
}

android {
    defaultConfig {
        renderscriptTargetApi 23
        renderscriptSupportMode true
    }
}

Usage

Using the library is really simple, just look at the source code of the provided sample.

For NavigationDrawer

  • EtsyActionBarDrawerToggle

Simply replace the ActionBarDrawerToggle class by this class to get the blur effect.

Also, your layout file for the main activity should look like the following. To make the library work, you have to use the id 'container' for the content frame and 'blur_view' for the ImageView to show the blurred image.

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    
    <FrameLayout
        android:id="@id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- needed w/this id for EtsyLib to work -->
    <ImageView
        android:id="@id/blur_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:visibility="gone">
    </ImageView>

    <fragment android:id="@+id/navigation_drawer"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:name="com.ms.square.android.etsyblurdemo.NavigationDrawerFragment"
        tools:layout="@layout/fragment_navigation_drawer" />

</android.support.v4.widget.DrawerLayout>

For DialogFragment

  • BlurDialogFragmentHelper

This is a helper class to make the dialog background into the blurred image of the underlying content. To make it work, instantiate this class in your DialogFragment(ex.. in onCreate) and forward the following methods in it to this helper class.

  • public void onCreate()
  • public void onActivityCreated()
  • public void onStart()
  • public void onDismiss()

Note:

In your DialogFragment, override either onCreateDialog() or onCreateView(), not both. For a simple example, please look at the BlurDialogFragment in provided sample.

License

Copyright 2014 Manabu Shimobe

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.

etsyblur's People

Contributors

abivan-tech avatar manabu-gt avatar

Watchers

 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.