Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Last update: Aug 13, 2022

Bubbles for Android

Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Logo

Latest Version

Download Android Arsenal

How to use

Configuring your project dependencies

Add the library dependency in your build.gradle file.

dependencies {
    ...
    compile 'com.txusballesteros:bubbles:1.2.1'
}

Adding your first Bubble

Compose your Bubble layout, for example using a Xml layout file. Remember that the first view of your Bubble layout has to be a BubbleLayout view.

<com.txusballesteros.bubbles.BubbleLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/avatar"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_gravity="center"
        android:background="@drawable/profile_decorator"
        android:src="@drawable/profile"
        android:scaleType="centerCrop"/>

</com.txusballesteros.bubbles.BubbleLayout>

Create your BubblesManager instance.

private BubblesManager bubblesManager;

@Override
protected void onCreate(Bundle savedInstanceState) {
     bubblesManager = new BubblesManager.Builder(this)
                                        .build();
     bubblesManager.initialize();
    ...
}

@Override
protected void onDestroy() {
    bubblesManager.recycle();
    ...
}

Attach your Bubble to the window.

BubbleLayout bubbleView = (BubbleLayout)LayoutInflater
                                    .from(MainActivity.this).inflate(R.layout.bubble_layout, null);
bubblesManager.addBubble(bubbleView, 60, 20);

Configuring your Bubbles Trash

If you want to have a trash to remove on screen bubbles, you can configure the layout of that.

Define your trash layout Xml.

<ImageView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="20dp"
    android:src="@mipmap/bubble_trash_background"
    android:layout_gravity="bottom|center_horizontal" />

Configure the trash layout with your BubblesManager builder.

private BubblesManager bubblesManager;

@Override
protected void onCreate(Bundle savedInstanceState) {
     bubblesManager = new BubblesManager.Builder(this)
                                        .setTrashLayout(R.layout.bubble_trash_layout)
                                        .build();
     bubblesManager.initialize();
    ...
}

License

Copyright Txus Ballesteros 2015 (@txusballesteros)

This file is part of some open source application.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contact: Txus Ballesteros [email protected]

GitHub

https://github.com/txusballesteros/bubbles-for-android
Comments
  • 1. Null pointer exception

    java.lang.NullPointerException at android.animation.PropertyValuesHolder.setupSetterAndGetter(PropertyValuesHolder.java:505) at android.animation.ObjectAnimator.initAnimation(ObjectAnimator.java:487) at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:517) at android.animation.ValueAnimator.start(ValueAnimator.java:936) at android.animation.ValueAnimator.start(ValueAnimator.java:946) at android.animation.ObjectAnimator.start(ObjectAnimator.java:465) at android.animation.AnimatorSet.start(AnimatorSet.java:563) at com.txusballesteros.bubbles.BubbleTrashLayout.playAnimation(BubbleTrashLayout.java:78) at com.txusballesteros.bubbles.BubbleTrashLayout.setVisibility(BubbleTrashLayout.java:54) at com.txusballesteros.bubbles.BubblesService.addTrash(BubblesService.java:102) at com.txusballesteros.bubbles.BubblesManager.configureBubblesService(BubblesManager.java:67) at com.txusballesteros.bubbles.BubblesManager.access$100(BubblesManager.java:33) at com.txusballesteros.bubbles.BubblesManager$1.onServiceConnected(BubblesManager.java:52) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1114) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1131) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5586) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) at dalvik.system.NativeStart.main(Native Method)

    my code :

    public class BubbleActivity extends AppCompatActivity {
    
        private BubblesManager bubblesManager;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            initializeBubblesManager();
            addNewBubble();
    
        }
    
        private void addNewBubble() {
            BubbleLayout bubbleView = (BubbleLayout) LayoutInflater.from(this).inflate(R.layout.bubble_layout, null);
            ImageView avatar =(ImageView)bubbleView.findViewById(R.id.avatar);
            avatar.setImageResource(R.drawable.walking);
            bubbleView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) { }
            });
            bubbleView.setOnBubbleRemoveListener(new BubbleLayout.OnBubbleRemoveListener() {
                @Override
                public void onBubbleRemoved(BubbleLayout bubble) { }
            });
            bubblesManager.addBubble(bubbleView, 60, 20);
        }
    
        private void initializeBubblesManager() {
            bubblesManager = new BubblesManager.Builder(this)
                                        .setTrashLayout(R.layout.bubble_trash_layout)
                                        .build();
            bubblesManager.initialize();
        }
    
        @Override
        protected void onDestroy() {
            super.onDestroy();
            bubblesManager.recycle();
        }
    
    Reviewed by Lir10 at 2015-07-07 08:43
  • 2. App force closed

    Hello,

    I have to recreate the exact same app in the repository here, however when I open it, it force closes and throws an error

    android.view.WindowManager$BadTokenException: Unable to add window [email protected] -- permission denied for window type 2006 at android.view.ViewRootImpl.setView(ViewRootImpl.java:702) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:342) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93) at com.txusballesteros.bubbles.BubblesService$2.run(BubblesService.java:120) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

    I have attached the Main Activity code in the Doc, please assist.

    Regards, Fayaz New Microsoft Word Document (2).docx

    Reviewed by fayazara at 2016-11-19 19:24
  • 3. Getting Error " java.lang.NullPointerException"

    java.lang.NullPointerException at android.animation.PropertyValuesHolder.setupSetterAndGetter(PropertyValuesHolder.java:505) at android.animation.ObjectAnimator.initAnimation(ObjectAnimator.java:487) at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:517) at android.animation.ValueAnimator.start(ValueAnimator.java:936) at android.animation.ValueAnimator.start(ValueAnimator.java:946) at android.animation.ObjectAnimator.start(ObjectAnimator.java:465) at android.animation.AnimatorSet.start(AnimatorSet.java:563) at com.txusballesteros.bubbles.BubbleTrashLayout.playAnimation(BubbleTrashLayout.java:78) at com.txusballesteros.bubbles.BubbleTrashLayout.setVisibility(BubbleTrashLayout.java:54) at com.txusballesteros.bubbles.BubblesService.addTrash(BubblesService.java:102) at com.txusballesteros.bubbles.BubblesManager.configureBubblesService(BubblesManager.java:67) at com.txusballesteros.bubbles.BubblesManager.access$100(BubblesManager.java:33) at com.txusballesteros.bubbles.BubblesManager$1.onServiceConnected(BubblesManager.java:52) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1110) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1127) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:149) at android.app.ActivityThread.main(ActivityThread.java:5257) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) at dalvik.system.NativeStart.main(Native Method)

    Reviewed by pranavlathigara at 2015-07-03 13:03
  • 4. Add Screenshots to the Readme.md file

    Hi, It would really help if you could attach some screenshots to the readme file. A lot of times people might not understand what the library is about or what the end result would be and just skip the page. Screenshots would really help making users understand what the library does :)

    Reviewed by vinaygaba at 2015-07-03 10:59
  • 5. resized bubble

    Hi,

    When I add a bubble, it has a big size, then when I click on it, it change to the good size.

    Any idea to allways keep the same size ?

    thanks for your help

    Reviewed by no-body at 2018-02-21 14:23
  • 6. app crash

    private void addViewToWindow(final BubbleBaseLayout view) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { crashes here >>> getWindowManager().addView(view, view.getViewParams()); } }); }

    android.view.WindowManager$BadTokenException: Unable to add window [email protected] -- permission denied for this window type

    Reviewed by ghost at 2016-07-20 20:31
  • 7. Go to the side of the screen, more animations, vibrator and more precise click listener !

    Added the gotowall function : with this when you release the bubble it mooves to the nearest side of the screen ! Reworked the click event, it's more precise now ! Added animations to OnDownClick et OnUpClick

    Reviewed by pierrebrtr at 2015-08-29 00:40
  • 8. Usage question

    First of all thanks for sharing this great library!

    Let's say, we have an ui which interacts with the user and then user switches to another app but we want that our app must became a bubble and user can use it while in another app just like the messenger app. From the bubble user can generate data or fetch something to views from a web service or something. The question is how can we use bubble layout's views inside the bubble, how can i determine if the user clicks a button inside the bubble? I couldn't see any example in app about this. It generates the bubble that's great but for what purpose?

    Reviewed by Swisyn at 2015-07-09 09:11
  • 9. Fixed crash with Android bigger then Oreo. TYPE_PHONE, TYPE_SYSTEM_OVERLAY is deprecated after 26 target sdk. Need use TYPE_APPLICATION_OVERLAY

    Fixed crash with Android bigger then Oreo. TYPE_PHONE, TYPE_SYSTEM_OVERLAY is deprecated after 26 target sdk. Need use TYPE_APPLICATION_OVERLAY. Update build gradle plugin, support library. Updated target SDK, compile SDK. Issue reproduced for target SDK 26+

    Reviewed by alexanderkrupenkov at 2018-01-18 13:02
  • 10. ability to set vibration time

    i want to remove vibration time or change it so i made some changes and i did it like this

    private BubblesManager bubblesManager; bubblesManager.getBubblesService().getBubblesTrash().setVibrationDurationInMs(0);

    Reviewed by m04az at 2016-11-06 18:47
  • 11. Detect if the bubble is on which side of the screen?

    How can I detect of the bubble is on the left or right of the screen? I used setOnTouchListner but motionEvent.getX() reports an incorrect X.

    bubbleView.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View view, MotionEvent motionEvent) {
                    if(motionEvent.getX() < getDisplayWidth()/2) {
                        //left
                    } else {
                        //right
                    }
                    return bubbleView.onTouchEvent(motionEvent);
                }
            });
    

    Edit: I figured it out using getLocationOnScreen

    Reviewed by hatpick at 2016-09-08 07:08
  • 12. Expanding View on bubble press

    Howdy yall, I'm working on creating a react native package that utilizes this package. Ive got the bubble showing up and all that works fine. I have created the secondary layout that should show up on bubble press however whenever i try to use the findViewById method in my case since its across a native bridge it's reactContext.getCurrentActivity().findViewById(r.id.layout) it's just returning null. The layout ive added is in the bubble_layout file yet i cant seem to figure out why all im getting is null. any help is appreciated thanks!

    heres an example of what im trying to do

    update

    so i have found out how to add the view on press however the code below is causing a second bubble to pop up which is resulting in a crash :/ on top of that the view only expands while in the app so i i still have some issues im working through if anyone has a tip that would be awesome

    private void addNewBubble(int x, int y) {
            this.removeBubble();
            bubbleView =
              (BubbleLayout) LayoutInflater
                .from(reactContext)
                .inflate(R.layout.bubble_layout, null);
            bubbleView.setOnBubbleRemoveListener(
              new BubbleLayout.OnBubbleRemoveListener() {
                @Override
                public void onBubbleRemoved(BubbleLayout bubble) {
                  bubbleView = null;
                  sendEvent("floating-bubble-remove");
                }
              }
            );
            bubbleView.setOnBubbleClickListener(
              new BubbleLayout.OnBubbleClickListener() {
                @Override
                public void onBubbleClick(BubbleLayout bubble) {
                   
                   reactContext.getCurrentActivity().setContentView(R.layout.bubble_layout); <-- this was the only way to get the code below to not return null for notification layout i have found
                   notificationLayout = reactContext.getCurrentActivity().findViewById(R.id.notification_layout);
                  
                  System.out.println(notificationLayout); <-- this prints null
                  System.out.println(bubble);
    
               if (notificationLayout.getVisibility() == View.GONE) {
    
                    notificationLayout.setVisibility(View.VISIBLE);
    
                  } else {
    
                    notificationLayout.setVisibility(View.GONE);
    
                  }
                  sendEvent("floating-bubble-press");
                }
              }
            );
            bubbleView.setShouldStickToWall(true);
            bubblesManager.addBubble(bubbleView, x, y);
          }
    
    
    Reviewed by JakeOrel at 2022-05-26 15:47
  • 13. App is crashing - permission denied on window type 2006 error

    App is crashing with permission denied on window type 2006 error , on Initializing bubble on android p version devices, even though I added permission in manifest as well as java class.

    Reviewed by ShrutiSantosh at 2019-05-06 11:17
ViewHelper to provide one activity applications
ViewHelper to provide one activity applications

PrismView provides animations for your views, similar to Dragger, but with fragments! You can change the fragment of the PrismView any time. Usage Ext

Apr 24, 2022
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Aug 10, 2022
BlurView - A very fast and dynamic blur layout for Android
BlurView - A very fast and dynamic blur layout for Android

BlurView - A very fast and dynamic blur layout for Android

Jul 11, 2022
An elegant way to show your menu or messages.

Android View Hover In my opinion, jumping to a new activity to show your menu is a kind of wasting time and life. So, I think, we need a hover view, t

Aug 12, 2022
ConstraintLayout is an Android layout component which allows you to position and size widgets in a flexible way

ConstraintLayout is a layout manager for Android which allows you to position and size widgets in a flexible way. It's available for both the Android view system and Jetpack Compose.

Aug 6, 2022
ViewStateLayout - Easy way to manage common state templates like loading, empty, error etc.!
ViewStateLayout - Easy way to manage common state templates like loading, empty, error etc.!

ViewStateLayout Easy way to manage common state templates like loading, empty, error etc.! How to Step 1. Add the JitPack repository to your build fil

Jul 17, 2022
Draftsman is an on device layout inspector which can be embedded in your android app.
Draftsman is an on device layout inspector which can be embedded in your android app.

Draftsman Draftsman is an on-device layout inspector for Android apps. It allows you to view various properties of rendered Android Views such as widt

Jul 21, 2022
[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly
[Archived] Highlight the best bits of your app to users quickly, simply, and cool...ly

ShowcaseView The ShowcaseView (SCV) library is designed to highlight and showcase specific parts of apps to the user with a distinctive and attractive

Aug 7, 2022
Animate your activity!
Animate your activity!

Warning This library is not in development anymore, but we are accepting PRs or successors if anyone is interested. If you want to use these transitio

Jun 20, 2022
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.

Draggable Panel DEPRECATED. This project is not maintained anymore. Draggable Panel is an Android library created to build a draggable user interface

Aug 8, 2022
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube New graphic component.
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube New graphic component.

Please switch to DragView, for the best support, thank you DraggablePanel Download allprojects { repositories { ... maven { url 'https://jitp

Jul 28, 2022
FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout
FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

Aug 11, 2022
An Android library that help you to build app with swipe back gesture.
An Android library that help you to build app with swipe back gesture.

SwipeBackLayout An Android library that help you to build app with swipe back gesture. Demo Apk GooglePlay Requirement The latest android-support-v4.j

Aug 4, 2022
SwipeBack is an android library that can finish a activity by using gesture.
SwipeBack is an android library that can finish a activity by using gesture.

SwipeBack SwipeBack is a android library that can finish a activity by using gesture. You can set the swipe direction,such as left,top,right and botto

Aug 9, 2022
A very simple arc layout library for Android
A very simple arc layout library for Android

ArcLayout A very simple arc layout library for Android. Try out the sample application on the Play Store. Usage (For a working implementation of this

Aug 2, 2022
A floating menu library for Android.
A floating menu library for Android.

Hover Hover is a floating menu implementation for Android. Goals The goals of Hover are to: Provide an easy-to-use, out-of-the-box floating menu imple

Aug 17, 2022
Simple android library to present an animated ferris wheel
Simple android library to present an animated ferris wheel

Ferris Wheel View Overview An Android Library used to implement an animated Ferris Wheel in android. API SDK 15+ Written in Kotlin Supports landscape

Apr 28, 2022
Android Library that lights items for tutorials or walk-throughs etc...
Android Library that lights items for tutorials or walk-throughs etc...

Spotlight Gradle dependencies { implementation 'com.github.takusemba:spotlight:x.x.x' } Usage val spotlight = Spotlight.Builder(this) .setTarg

Aug 12, 2022
It's an Android library that allows you to use Layout as RadioButton or CheckBox.
It's an Android library that allows you to use Layout as RadioButton or CheckBox.

Android - CompoundLayout It's an Android library that allows you to use Layout as RadioButton or CheckBox. The librarie is Android 14+ compatible. Gra

Jul 19, 2022