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

Overview

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]

Comments
  • Null pointer exception

    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();
        }
    
    opened by Lir10 9
  • App force closed

    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 android.view.ViewRootImpl$W@1454e05 -- 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

    opened by fayazara 4
  • Getting Error

    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)

    opened by pranavlathigara 3
  • Add Screenshots to the Readme.md file

    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 :)

    opened by vinaygaba 2
  • resized bubble

    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

    opened by no-body 1
  • app crash

    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 android.view.ViewRootImpl$W@ce82da -- permission denied for this window type

    opened by ghost 1
  • Go to the side of the screen, more animations, vibrator and more precise click listener !

    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

    opened by pierrebrtr 1
  • Usage question

    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?

    opened by Swisyn 1
  • 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

    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+

    opened by alexanderkrupenkov 0
  • ability to set vibration time

    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);

    opened by m04az 0
  • Detect if the bubble is on which side of the screen?

    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

    opened by hatpick 0
  • Expanding View on bubble press

    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);
          }
    
    
    opened by JakeOrel 0
  • App is crashing - permission denied on window type 2006 error

    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.

    opened by ShrutiSantosh 15
Owner
Txus Ballesteros
Txus Ballesteros
NumberPickerView - Custom Android View to provide a user friendly way of picking numbers. 🧪

?? Custom view for Android which provides a modern design and gestures for picking numbers in a user friendly way.

Mirkamal 6 Feb 16, 2022
[] A fast PDF reader component for Android development

This project is no longer maintained. You can find a good replacement here, which is a fork relying on Pdfium instead of Vudroid/MuPDF for decoding PD

Joan Zapata 2.8k Dec 16, 2022
This a Ride User app in which in integrate almost every features of a Ride Share app.

My-Ride-App This a Ride app(User) in which I integrate almost every features of a Ride Share app. Here I use kotlin programing language, Google map SD

Khairul Islam 5 Apr 27, 2022
Android library to create chat message view easily

ChatMessageView ChatMessageView helps you to create chat message view quickly like a typical chatting application. Its a container view, so you can ad

Himanshu Soni 641 Dec 24, 2022
Chat UI library for Android :zap:

ChatMessageView This library aims to provide a chat UI view for Android. Feature You need to write just few code to create chat view. Auto date settin

Tsubasa Nakayama 568 Dec 29, 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.

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

Umano: News Read To You 9.4k Dec 31, 2022
GreenDroid is a development library for the Android platform. It makes UI developments easier and consistent through your applications.

#GreenDroid Foreword : This project, initially initiated by me, Cyril Mottier, is not maintained anymore and can be considered as deprecated. As a con

Cyril Mottier 2.6k Jan 4, 2023
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

代码家 3.2k Jan 2, 2023
Regret is an Android library for apps that wants to implement an undo/redo feature

Regret I've been developing on an editor for my Android App recently, using Jetpack Compose, but Google doesn't implement a built-in undo / redo for d

Moriafly 5 Jun 29, 2022
The ShowcaseView library is designed to highlight and showcase specific parts of apps to the user with an attractive and flat overlay.

The ShowcaseView library is designed to highlight and showcase specific parts of apps to the user with an attractive and flat overlay.

Mohammad Reza Eram 484 Dec 26, 2022
SwipeBack for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swipe gesture

SwipeBack SwipeBack is for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swi

Hannes Dorfmann 697 Dec 14, 2022
[] A simple way to "badge" any given Android view at runtime without having to cater for it in layout

Android ViewBadger A simple way to "badge" any given Android view at runtime without having to cater for it in layout. Note: If your aim is to replica

Jeff Gilfelt 3k Nov 28, 2022
A set of Android-UI components to make it easier to request permission in a user friendly way.

Permission UI A set of Android-UI components to make it easier to request permission in a user friendly way. Access background location A jetpack comp

Stefan Wärting 54 Nov 3, 2022
Just a Wheel——A easy way to setEmptyView to ListView、GridView or RecyclerView etc..

中文说明在这里 TEmptyView Just a Wheel—— A easier way to setEmptyView. Without having to write xml file every time. It supports AdapterView(ListView,GridView

Barry 454 Jan 9, 2023
Display code with syntax highlighting :sparkles: in native way.

CodeView (Android) CodeView helps to show code content with syntax highlighting in native way. Description CodeView contains 3 core parts to implement

Kirill Biakov 827 Dec 22, 2022
It's a flip way to show share widget.

What's FlipShare ? It's a cool way to show share widget. Demo Usage step 1. Confirm your parentView to locate the share widget, and then you can custo

巴掌 630 Sep 5, 2022
A View on which you can freely draw, customizing paint width, alpha and color, and take a screenshot of the content. Useful for note apps, signatures or free hand writing.

FreeDrawView A View that let you draw freely on it. You can customize paint width, alpha and color. Can be useful for notes app, signatures or hands-f

Riccardo Moro 643 Nov 28, 2022
Reach plc. Apps Team Exercise (Junior)

Reach plc. Apps Team Exercise (Junior) Description One of our magazines is looki

Paul Vickers 0 Dec 20, 2021
A simple launcher which displays all the apps on a RecyclerView trying to KISS

A simple launcher which displays all the apps on a RecyclerView trying to KISS

Alex Allafi 1 Jun 17, 2022