FancyBackground


Source link: https://github.com/tslamic/FancyBackground

FancyBackground

FancyBackground is a tiny Android library designed to animate a set of resource Drawables. It ensures the drawables are subsampled and cached, if necessary, with heavy lifting done in the background.

Before After

Achieving the above is easy:

FancyBackground.on(view)

 .set(R.drawable.fst, R.drawable.snd, R.drawable.trd)

 .inAnimation(R.anim.fade_in)

 .outAnimation(R.anim.fade_out)

 .interval(2500)

 .start();
  

Don't forget to add the following in your build.gradle:

dependencies {
  compile 'com.github.tslamic.fancybackground:library:1.0' 
}
 

Builder options

Method name Description
set sets the Drawable resources we wish to show/animate
inAnimation specifies the animation used to animate a View entering the screen.
outAnimation specifies the animation used to animate a View exiting the screen.
loop continuously loop through the Drawables or stop after the first cycle is complete.
interval the millisecond interval a Drawable instance will be displayed for.
scale determines how the Drawables should be resized or moved to match the size of the view we're animating on.
listener receives the FancyBackground events (described below)
cache caches loaded bitmaps so we don't have to do it again

FancyListener can receive four events:

  • onStarted when the FancyBackground is started
  • onNew when a new image is set
  • onLoopDone if looping is set to false and the first cycle is complete
  • onStopped when the FancyBackground stops.

FancyCache enables you to create your own bitmap cache. FancyLruCache is the default, targeting ~25% of the available heap and evicting the least recently used bitmap if over capacity. Use null to avoid caching.

An example?

See app for a hands-on example.

How to get it?

Gradle

dependencies {
  compile 'com.github.tslamic.fancybackground:library:1.0' 
}
 

Maven

<dependency>
  <groupId>com.github.tslamic.fancybackground</groupId>
  <artifactId>library</artifactId>
  <version>1.0</version> </dependency> 

or download the aar by clicking here.

License

The MIT License (MIT)  Copyright (c) 2015 Tadej Slamic  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 

Resources

A library for easy call JS-functions from Java.

An Android library to make a flowing gradient effect, similar to login screen in Instagram app.

An Android Banner that supports auto scrolling and decent animation.

AutoValue Extension to add Map generation support. Generates a Map<String,Object> where the keys are the field names and the values the related field values.

A very simple implementation for social login on android.

It's a cute button.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes