Glass-break effect for views

Overview

BrokenView

Glass-break effect for views.

brokenview

Demo

Download APK

Usage

Android Studio

dependencies {
   compile 'com.zys:brokenview:1.0.3'
}

Eclipse

Just put brokenview.jar into the libs folder of your app.

Basic Example

brokenView = BrokenView.add2Window(context);
listener = new BrokenTouchListener.Builder(brokenView).build();
view.setOnTouchListener(listener);

More Config

Use BrokenTouchListener.Builder for more configurations, and set custom attributes as shown below:

BrokenTouchListener.Builder(brokenView).

    setComplexity(...).          // default 12 
    
    setBreakDuration(...).       // in milliseconds, default 700ms
    
    setFallDuration(...).        // in milliseconds, default 2000ms
    
    setCircleRiftsRadius(...).   // in dp, default 66dp, you can disable circle-rifts effect by set it to 0
    
    setEnableArea(...).          // set the region or childview that can enable break effect,
                                 // be sure the childView or childView in region doesn't intercept any touch event
                                 
    setPaint(...).               // the paint to draw rifts
    
    build();

You can also set a callback to listen to the status of animations, like this:

brokenView.setCallback.(new BrokenCallback() {

   @Override
   public void onStart(View v) {...}
   
   @Override
   public void onCancel(View v) {...}
   
   @Override
   public void onCancelEnd(View v) {...}
   
   @Override
   public void onRestart(View v) {...}
   
   @Override
   public void onFalling(View v) {...}
   
   @Override
   public void onFallingEnd(View v) {...}
});

Compatibility

  • Support API LEVEL >= 14

Changelog

Version 1.0.0
  • First release

Version 1.0.1

  • Optimize animation effects
  • Set minSdkVersion to 14

Version 1.0.2

  • Added many annotations
  • Added new features: setCircleRiftsRadius, setEnableArea

Version 1.0.3

  • Fixed ANR caused by setCircleRiftsRadius(0)
  • Better annotations

License

BrokenView is available under the MIT license.

You might also like...
An easy, flexible way to add a shimmering effect to any view in an Android app.
An easy, flexible way to add a shimmering effect to any view in an Android app.

Shimmer for Android Shimmer is an Android library that provides an easy way to add a shimmer effect to any view in your Android app. It is useful as a

Memory efficient shimmering effect for Android applications by Supercharge.

DEPRECATED - ShimmerLayout Attention: This tool is now deprecated. Please switch to Shimmer for Android or any other shimmer effect solution. ShimmerL

A pager for Android with parallax effect

ParallaxPagerTransformer A pager transformer for Android with parallax effect Installation in your build.gradle file dependencies { // ... com

Wave effect of activity animation
Wave effect of activity animation

WaveCompat Wave effect of activity animation How to use 1. Bind wave touch helper to a view which will start an activity when it clicked: WaveTouchHel

Library provides an easy way to a add shimmer effect in Android Compose project.
Library provides an easy way to a add shimmer effect in Android Compose project.

Add a shimmer effect to the layout in Android Compose

"Gooey-Effect" for android-compose

Gooey effect for android-compose "Gooey" is a library made to use "gooey-effect" that exists as a CSS trick in android-compose. Download repositories

ShimmerTextView is a simple library to integrate shimmer effect in your TextView.
ShimmerTextView is a simple library to integrate shimmer effect in your TextView.

ShimmerTextView ShimmerTextView is a simple library to integrate shimmer effect in your TextView. Key features Set a base color in ShimmerTextView. Se

Beautiful and smooth custom loading views
Beautiful and smooth custom loading views

mkloader Beautiful and smooth custom loading views Usage com.tuyenmonkey.mkloader.MKLoader android:layout_width="wrap_content" an

💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.

The article on how this library was created is now published. You can read it on this link here. →. 💳 EasyFlipView Built with ❤︎ by Wajahat Karim and

Comments
  • 请问下,如何让自动指定位置破碎

    请问下,如何让自动指定位置破碎

    public void animationBroken(View mView){ BrokenConfig mBrokenConfig=new BrokenConfig(); mBrokenConfig.complexity=8; Point mPaint=new Point(parentLayout.getWidth()/2,parentLayout.getHeight()/2); BrokenAnimator mBrokenAnimator=mBrokenView.createAnimator(parentLayout,mPaint,mBrokenConfig); mBrokenAnimator.start();

    }
    

    有时候破碎不成功

    opened by chongbo2013 4
  • BrokenView with ViewPager

    BrokenView with ViewPager

    I've implemented BrokenView with ViewPager, and it is only working for the first Tab (View) that references it in the ViewPager - any ideas why?

    Many thanks

    opened by plthatfunkymusic 0
  • Falling animation repeats

    Falling animation repeats

    When glass gets breaked it apears once again and falls again :-X I am adding view with default listener

    
    	RelativeLayout relative = (RelativeLayout) getLayoutInflater().inflate(R.layout.view_break_glass, null);
    
    	ImageView imageView = (ImageView) relative.findViewById(R.id.glass);
    
    	BrokenView brokenView = BrokenView.add2Window(this);
    
    	BrokenTouchListener listener = new BrokenTouchListener.Builder(brokenView).build();
    
    	imageView.setOnTouchListener(listener);
    
    	return relative;
    
    opened by YuckFo 5
Owner
we all have a bright future
null
Android L Ripple effect wrapper for Views

Material Ripple Layout Ripple effect wrapper for Android Views Including in your project compile 'com.balysv:material-ripple:1.0.2' Check for latest v

Balys Valentukevicius 2.3k Dec 29, 2022
[] Easily have blurred and transparent background effect on your Android views.

##[DEPRECATED] BlurBehind Easily have blurred and transparent background effect on your Android views. Before API level 14 there was a Window flag cal

Gokberk Ergun 516 Nov 25, 2022
explosive dust effect for views

ExplosionField explosive dust effect for views Getting started In your build.gradle: dependencies { compile 'tyrantgit:explosionfield:1.0.1' } Ex

null 3.6k Dec 29, 2022
A component for flip animation on Android, which is similar to the effect in Flipboard iPhone/Android

android-flip Aphid FlipView is a UI component to accomplish the flipping animation like Flipboard does. A pre-built demo APK file for Android OS 2.2+

Bo 2.8k Dec 21, 2022
Android ImageViews animated by Ken Burns Effect

KenBurnsView Android library that provides an extension to ImageView that creates an immersive experience by animating its drawable using the Ken Burn

Flávio Faria 2.7k Jan 2, 2023
ViewAnimator view with a lollipop style reveal effect

ViewRevealAnimator Widget ViewAnimator view with a lollipop style reveal effect. Regular animation can be set (just like the default ViewAnimator) for

Alessandro Crugnola 339 Jun 3, 2022
Implementation of Ripple effect from Material Design for Android API 9+

RippleEffect ExpandableLayout provides an easy way to create a view called header with an expandable view. Both view are external layout to allow a ma

Robin Chutaux 4.9k Dec 30, 2022
Library project to display DialogFragment with a blur effect.

BlurDialogFragment This project allows to display DialogFragment with a burring effect behind. The blurring part is achieved through FastBlur algorith

tvbarthel 2.1k Dec 29, 2022
Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.

Android StackBlur Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. Th

Enrique López Mañas 3.6k Dec 29, 2022
:sparkles: An easy way to implement an elastic touch effect for Android.

ElasticViews ✨ An easy way to implement an elastic touch effect for Android. Including in your project Gradle Add below codes to your root build.gradl

Jaewoong Eum 763 Dec 29, 2022