Skip to content

Repository files navigation

#BubbleAnimationLayout AwesomeHeader image

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.

Demo image ####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.

Awesome

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"
>
<RelativeLayoutandroid:layout_width="match_parent"android:layout_height="@dimen/list_item_size"android:background="@android:color/white"app:bav_view_type="base_container"
>
...
</RelativeLayout>
<RelativeLayoutandroid: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

BubbleAnimationLayoutmBalBaseView = ...;
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

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

Show context container

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

BubbleAnimationLayoutmBalBaseView = ...;
ViewcontextView = findViewById(R.id.fl_context_view);
Animatoranimator = ObjectAnimator.ofPropertyValuesHolder(contextView, PropertyValuesHolder.ofFloat("alpha", 0.0f, 1.0f))
.setDuration(500);
mBalBaseView.showContextViewWithAnimation(animator);

or without animation

BubbleAnimationLayoutmBalBaseView = ...;
mBalBaseView.showContextView();

Show base container

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

BubbleAnimationLayoutmBalBaseView = ...;
ViewcontextView = findViewById(R.id.fl_context_view);
Animatoranimator = ObjectAnimator.ofPropertyValuesHolder(contextView, PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.0f))
.setDuration(500);
mBalBaseView.showBaseViewWithAnimation(animator);

or without animation

BubbleAnimationLayoutmBalBaseView = ...;
mBalBaseView.showBaseView();

Show/hide bubble view

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

BubbleAnimationLayoutmBalBaseView = ...;
mBalBaseView.showBubbleViewWithAnimation(newBubbleAnimationLayout.BubbleAnimationEndListener() {
@OverridepublicvoidonEndAnimation(booleanisForwardAnimation, Animatoranimation) {
//Do something
}
});

or without animation

BubbleAnimationLayoutmBalBaseView = ...;
mBalBaseView.showBubbledView();

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

BubbleAnimationLayoutmBalBaseView = ...;
mBalBaseView.hideBubbledViewWithAnimation(newBubbleAnimationLayout.BubbleAnimationEndListener() {
@OverridepublicvoidonEndAnimation(booleanisForwardAnimation, Animatoranimation) {
//Do something
}
});

or without animation

BubbleAnimationLayoutmBalBaseView = ...;
mBalBaseView.hideBubbledView();

Reset view

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

BubbleAnimationLayoutmBalBaseView = ...;
mBalBaseView.resetView();

Handling ending of animation

For handling animation's ending declare BubbleAnimationEndListener

BubbleAnimationLayoutmBalBaseView = ...;
mBalBaseView.addAnimationEndListener(newBubbleAnimationLayout.BubbleAnimationEndListener() {
@OverridepublicvoidonEndAnimation(booleanisForwardAnimation, Animatoranimation) {
//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.

privatestaticclassNonScrollLinearLayoutManagerextendsLinearLayoutManager {
privatebooleanmCanScroll = true;
publicNonScrollLinearLayoutManager(Contextcontext) {
super(context);
}
@SuppressWarnings("unused")
publicNonScrollLinearLayoutManager(Contextcontext, intorientation, booleanreverseLayout) {
super(context, orientation, reverseLayout);
}
@SuppressWarnings("unused")
publicNonScrollLinearLayoutManager(Contextcontext, AttributeSetattrs, intdefStyleAttr, intdefStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@OverridepublicbooleancanScrollHorizontally() {
returnsuper.canScrollHorizontally() && mCanScroll;
}
@OverridepublicbooleancanScrollVertically() {
returnsuper.canScrollVertically() && mCanScroll;
}
}
{
...
RecyclerViewrvUsers = ...;
rvUsers.setHasFixedSize(true);
finalNonScrollLinearLayoutManagerlayoutManager = newNonScrollLinearLayoutManager(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 info@cleveroad.com (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.

About

You don’t want your apps look and feel boring, do you? Add some bubbles!

Resources

Stars

573 stars

Watchers

19 watching

Forks

Releases

Packages

Contributors

Languages