BubbleAnimationLayout


Source link: https://github.com/Cleveroad/BubbleAnimationLayout

#BubbleAnimationLayout

Say hello to Bubble Animation Layout for Android by Cleveroad

You don’t want your apps look and feel boring, do you? Add some bubbles! Bubble Animation Layout for Android by Cleveroad is at your service. This component is extremely functional and suits all kinds of apps. It’s more than simple to get your app’s UI stand out and attract attention.

####The animation is also available on Bubble Animation Layout for Android on YouTube in HD quality.

It’s easy to add some spice and create something outstanding with Cleveroad Bubble Animation Layout library. Be sure, your app users will appreciate your efforts and imaginative approach.

Using

First, add gradle dependency into your build.gradle:

dependencies {

  compile 'com.cleveroad:bubbleanimation-layout:1.0.0' 
}

Then you can declare it in you layout file like this:

<com.cleveroad.bubbleanimation.BubbleAnimationLayout
  android:id="@+id/animation_view"
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@android:color/darker_gray"
  android:paddingBottom="@dimen/padding_s"
  android:paddingEnd="@dimen/padding_m"
  android:paddingStart="@dimen/padding_m"
  app:bav_animation_color="@color/base_red"
  app:bav_indicator_width="@dimen/indicator_width"
  >

<RelativeLayout

android:layout_width="match_parent"

android:layout_height="@dimen/list_item_size"

android:background="@android:color/white"

app:bav_view_type="base_container"

>

...
  </RelativeLayout>

 <RelativeLayout

android:id="@+id/fl_context_view"

android:layout_width="match_parent"

android:layout_height="wrap_content"

app:bav_view_type="context_container"

>

...
  </RelativeLayout>

</com.cleveroad.bubbleanimation.BubbleAnimationLayout>

BubbleAnimationLayout can contain only two children. One of them is base container (you can declare it with attribute app:bav_view_type="base_container") and another one is context container (you can declare it with attribute app:bav_view_type="context_container"). Be careful, layout calculates size by base container's layout params

Customization

Setup indicator and bubble animation color

You can change animation color with attribute 'app:bav_animation_color'

<com.cleveroad.bubbleanimation.BubbleAnimationLayout
  ...
  app:bav_animation_color="#b92714"
  >

or

 BubbleAnimationLayout mBalBaseView = ...;  mBalBaseView.setAnimationColor(Color.YELLOW);

Setup indicator width

You can change indicator width with attribute 'app:bav_indicator_width'

<com.cleveroad.bubbleanimation.BubbleAnimationLayout
  ...
  app:bav_indicator_width="10dp"
  >

or

 BubbleAnimationLayout mBalBaseView = ...;  mBalBaseView.setIndicatorWidth(30);

Show context container

You can show context container with animation (base container will be hidden)

 BubbleAnimationLayout mBalBaseView = ...;  View contextView = findViewById(R.id.fl_context_view);
  Animator animator = ObjectAnimator.ofPropertyValuesHolder(contextView, PropertyValuesHolder.ofFloat("alpha", 0.0f, 1.0f))

.setDuration(500);
  mBalBaseView.showContextViewWithAnimation(animator);

or without animation

 BubbleAnimationLayout mBalBaseView = ...;  mBalBaseView.showContextView();

Show base container

For displaying base container with animation call (context container and bubble view will be hidden)

 BubbleAnimationLayout mBalBaseView = ...;  View contextView = findViewById(R.id.fl_context_view);
  Animator animator = ObjectAnimator.ofPropertyValuesHolder(contextView, PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.0f))

.setDuration(500);
  mBalBaseView.showBaseViewWithAnimation(animator);

or without animation

 BubbleAnimationLayout mBalBaseView = ...;  mBalBaseView.showBaseView();

Show/hide bubble view

You can show bubble view with animation (for handling ending of animation specify BubbleAnimationEndListener)

 BubbleAnimationLayout mBalBaseView = ...;  mBalBaseView.showBubbleViewWithAnimation(new BubbleAnimationLayout.BubbleAnimationEndListener() {

@Override

public void onEndAnimation(boolean isForwardAnimation, Animator animation) {

//Do something

}
  
}
);

or without animation

 BubbleAnimationLayout mBalBaseView = ...;  mBalBaseView.showBubbledView();

For hiding with animation (for handling ending of animation specify BubbleAnimationEndListener) call

 BubbleAnimationLayout mBalBaseView = ...;  mBalBaseView.hideBubbledViewWithAnimation(new BubbleAnimationLayout.BubbleAnimationEndListener() {

@Override

public void onEndAnimation(boolean isForwardAnimation, Animator animation) {

//Do something

}
  
}
);

or without animation

 BubbleAnimationLayout mBalBaseView = ...;  mBalBaseView.hideBubbledView();

Reset view

Call BubbleAnimationLayout#resetView() to reset view to initial state

 BubbleAnimationLayout mBalBaseView = ...;  mBalBaseView.resetView();

Handling ending of animation

For handling animation's ending declare BubbleAnimationEndListener

 BubbleAnimationLayout mBalBaseView = ...;  mBalBaseView.addAnimationEndListener(new BubbleAnimationLayout.BubbleAnimationEndListener() {

@Override

public void onEndAnimation(boolean isForwardAnimation, Animator animation) {

 //Do something

}
  
}
);

Usage in the list item

If you call BubbleAnimationLayout#hideBubbledViewWithAnimation(BubbleAnimationEndListener) and scroll animation will show in recycled view. E.g. you can lock scroll while animation will end for resolving this issue.

 private static class NonScrollLinearLayoutManager extends LinearLayoutManager {

private boolean mCanScroll = true;

public NonScrollLinearLayoutManager(Context context) {

  super(context);

 
}

@SuppressWarnings("unused")

 public NonScrollLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {

  super(context, orientation, reverseLayout);

 
}

@SuppressWarnings("unused")

 public NonScrollLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {

  super(context, attrs, defStyleAttr, defStyleRes);

 
}

@Override

 public boolean canScrollHorizontally() {

  return super.canScrollHorizontally() && mCanScroll;

 
}

@Override

 public boolean canScrollVertically() {

  return super.canScrollVertically() && mCanScroll;

 
}
  
}

 {

  ...
  RecyclerView rvUsers = ...;
  rvUsers.setHasFixedSize(true);

  final NonScrollLinearLayoutManager layoutManager = new NonScrollLinearLayoutManager(this);

  rvUsers.setLayoutManager(layoutManager);

  layoutManager.mCanScroll = false;

  ...  
}

Support

If you have any questions regarding the use of this tutorial, please contact us for support at [email protected] (email subject: «Bubble Animation Layout for Android. Support request.»)
or
Use our contacts:
Cleveroad.com
Facebook account
Twitter account
Google+ account

License


 The MIT License (MIT)

Copyright (c) 2015-2016 Cleveroad

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

Translucent draw a transparent text into a Textview.

EpubParser is a java library for parsing epub files.

An extension for Google's AutoValue that generates the following for for @AutoValue annotated objects:

  • createFromSharedPreferences
  • createFromCursor
  • Parcelable implementations

pdfium binding for android.

A simple easy-to-use debug utility which helps you capture the logs simultaneously to adb terminal as well to a file on SD Card.

Makes it easy and simple to integrate "Attach that file" feature into your android apps.

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