JumpingBeans


Source link: https://github.com/frakbot/JumpingBeans

JumpingBeans

The JumpingBeans make your test jump to the eye. Literally!

What are the JumpingBeans

Have you ever used Hangouts? If not, do it and then come back here. Go. Go, I said!

Good. With that under our belt, we can be confident you've seen at least once those fancy, nice jumping suspension dots that Hangouts uses to indicate that someone is typing, or some other kind of ongoing activity (e.g., connecting to a video hangout).

Well, since there's no official naming for them, and since they remind me of the jumping Mexican beans, the name for a library that emulates their behaviour has come to be exactly that: JumpingBeans.

See them in action

Please come closer, ladies and gentlemen! Here you have, for your own amusement, the amazing JumpingBeans:

Make your project jump around

In order to use JumpingBeans in your own project, you can use the wonderous remote dependencies capabilities that Gradle offers you (if you're not using Gradle and Android Studio/IntelliJ offer you, I'm sorry for you.) (No, I mean it, I'm really sorry for you!)

Just make sure you have jcenter() in your root build.gradle:

allprojects {

  repositories {

jcenter()
  
}
 
}

And then just add the JumpingBeans dependency to your module's build.gradle:

dependencies {

  compile 'net.frakbot:jumpingbeans:1.3.0' 
}

What you can do

The library supports two main operation modes: appending three jumping dots, Hangouts-style, or making any arbitrary subsection of a CharSequence jump, either as a wave or as a single block.

Append jumping dots

This method takes the trailing ... (or appends them, if the given TextView's text doesn't end in three dots), and makes them jump like it was -the 70s- Hangouts.

The defaults emulate the Hangouts L&F as closely as possible, but you can easily change the animation properties to suit your needs.

Make text jumping

This method takes the specified subsection a the TextView text and animates it as to make it jump.

Usage

Just create a JumpingBeans by using its Builder and call the method you want:

// Append jumping dots final TextView textView1 = (TextView) findViewById(R.id.jumping_text_1);
 jumpingBeans1 = JumpingBeans.with(textView1)

.appendJumpingDots()

.build();

 // Make the first word's letters jump final TextView textView2 = (TextView) findViewById(R.id.jumping_text_2);
 jumpingBeans2 = JumpingBeans.with(textView2)

.makeTextJump(0, textView2.getText().toString().indexOf(' '))

.setIsWave(false)

.setLoopDuration(1000)  // ms

.build();

Customising the jumpin' beans

Just act on the Builder. Don't want the dots to jump in a wave? Call setIsWave(false). Don't like the default loop duration? setLoopDuration(int) is here to help. Fancy different per-char delays in waves? Well, ya know that setWavePerCharDelay(int) is the one you want. Maybe you wanted to have a shorter pause between jumping cycles? BAM, setAnimatedDutyCycle(float) and you're all set.

Being a responsible citizen

Since Spans were not really designed to be animated, there's some trickery going on behind the scenes to make this happen. You needn't be concerned with it, but make sure you call the stopJumping() method on your JumpingBeans object whenever you stop using the TextView (it's detaching from the view tree, or the container Activity or Fragment is going in paused state, ...).

This allows a deeper cleanup than what the JumpingBeans library is trying to perform if you forget to. Don't leave stuff lying around if you can!

Also, a few caveats

Please note that you:

  • Must not try to change a jumping beans text in a textview before calling stopJumping() as to avoid unnecessary invalidation calls; the JumpingBeans class cannot know when this happens and will keep animating the textview (well, try to, anyway), wasting resources
  • Must not try to use a jumping beans text in another view; it will not animate. Just create another jumping beans animation for each new view
  • Must not use more than one JumpingBeans instance on a single TextView, as the first cleanup operation called on any of these JumpingBeans will also cleanup all other JumpingBeans' stuff. This is most likely not what you want to happen in some cases.
  • Should not use JumpingBeans on large chunks of text. Ideally this should be done on small views with just a few words. We've strived to make it as inexpensive as possible to use JumpingBeans but invalidating and possibly relayouting a large TextView can be pretty expensive.
  • Must not use JumpingBeans in conjunction with code and attributes that strip away spans or change them. This includes the deeply flawed textAllCaps.

Demo app

You can find the JumpingBeans demo app on the Google Play Store.

License

This library was written by Sebastiano Poggi and released by Frakbot under the Apache 2.0 License.

Please see the NOTICE file for details.

Resources

Views and Drawable for animated GIFs in Android.

Bundled GIFLib via JNI is used to render frames. This way should be more efficient than WebView or Movie classes.
Animation starts automatically and run only if View with attached GifDrawable is visible.

Gradle plugin for Android which lets you use Java generics in your XML layouts.

droidicon provides over 1600 customizable icons, 25 ready-made social badges and more! droidicon makes it super easy to add icons and badges to your app. All of the social badges are already styled.

Just add them to your app! Or you can customize the icons however you want.

Helpstack provides mobile in-app support for your app users.

With HelpStack, you can:

  • Let users report issues within your app
  • Let users attach screenshots to their support requests
  • Receive Device and App Information automatically, along with the reported issue
  • Let users view your responses to their issues
  • Provide self-support by showing FAQ articles
  • Customise your HelpStack screen to blend with your app theme
  • Integrates with Zendesk, Desk.com and HappyFox. Even works with email if you don't have a help desk account.

Android Studio / Eclipse ADT template for including icon resources from Material Design icons by Google in your project.

An Android application to analyse your notification history. It shows the number of received notifications during the day and the distribution across each application. An overview per day, week or month is available.

This application is available in the Google Play Store.

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