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

Pedro Paulo Amorim 149 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.

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
BlurView - A very fast and dynamic blur layout for Android

BlurView - A very fast and dynamic blur layout for Android

null 16 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

代码家 3.2k Dec 6, 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.

Android Jetpack 970 Jan 6, 2023
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

Kamrul Hasan 7 Dec 15, 2022
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

Gojek 243 Dec 22, 2022
[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

Alex Curran 5.6k Dec 16, 2022
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

Pedro Paulo Amorim 1.3k Dec 4, 2022
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

Pedro Vicente Gómez Sánchez 3k Jan 5, 2023
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

Hoàng Anh Tuấn 103 Oct 12, 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

null 33 Dec 8, 2022
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

ike_w0ng 6.1k Dec 29, 2022
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

Eric 1.7k Nov 21, 2022
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

ogaclejapan 1.4k Dec 26, 2022
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

Google 2.7k Dec 27, 2022
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

Igor Lashkov 318 Dec 7, 2022
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

TakuSemba 3.4k Dec 23, 2022
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

null 483 Nov 25, 2022