Git Product home page Git Product logo

bubbles-for-android's People

Contributors

pierrebrtr avatar stumi01 avatar txusballesteros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bubbles-for-android's Issues

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

move bubble

hi,
there is a way to move the bubble to initial position?
when i click the bubble i display a popup window, but i need a way to move the bubble to upper left corner of the screen.

thanks in advance

android O new issue

android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@2557df6 -- permission denied for window type 2006
at android.view.ViewRootImpl.setView(ViewRootImpl.java:789)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:356)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:92)
at com.txusballesteros.bubbles.BubblesService$2.run(BubblesService.java:120)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

app targetSdkVersion 26

help me.. T.T

Messenger like popup

Can I get the complete code on how to open a messenger style dropdown window on clicking the bubble?

EditText issue when typing in keyboard

Hi! i have an issue regarding on the bubble layout when i added edittext the keyboard will not showup i added a toggle keyboard it does show up but it wont type on the edit text.. please help.

thanks,
PS: i think the FLAG_NOT_FOCUSABLE is the reason for this.. is there a way to override your function buildLayoutParamsForBubble ?

thank you..

Add Layout after click?

How can i add a layout after click the bubble because if the bubble dont do anything when i click it, what is the objetive of this library?

How can I set transparency, size via seekbar?

I'm trying to set transparency and change size via seekbar. But I'm getting this error. Please tell me how can I do that? Following error I get after using setAlpha.

E/UncaughtException: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setAlpha(float)' on a null object reference
at com.amey.voicebutton.Main2Activity$6.onClick(Main2Activity.java:155)
at android.view.View.performClick(View.java:5610)
at android.view.View$PerformClick.run(View.java:22265)
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/FA: Tag Manager is not found and thus will not be used
D/FA: Logging event (FE): _ae, Bundle[{_o=crash, _sc=Main2Activity, _si=-3901322298145191894, timestamp=1487272019047, fatal=1}]
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.amey.voicebutton, PID: 5834
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setAlpha(float)' on a null object reference
at com.amey.voicebutton.Main2Activity$6.onClick(Main2Activity.java:155)
at android.view.View.performClick(View.java:5610)
at android.view.View$PerformClick.run(View.java:22265)
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)

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

set theme to bubbles

Hi, txusballesteros thanks for this really amazing project.
I have a question is there any way to set a theme to bubbles I use carbon library and I hope to find a way to set that theme to bubbles.
and of course, I use your project in service which we cannot set a theme to them in the manifest file.
for now, I use this code
getApplicationContext().setTheme(R.style.AppThemeCarbon);
its work on 4.4 and higher API versions but not working on lower versions can you suggest me a way to set a theme to bubbles?
and repeat i use your project in service, not in an activity

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?

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

add Layout

how to add layout in bubbles when user click bubbles like facebook messenger ?

Facing Crash whne I remove BubbleView

Process: com.lookatme, PID: 462
java.lang.IllegalArgumentException: View=com.txusballesteros.bubbles.BubbleLayout{24789439 V.E...C. ......I. 0,0-0,0} not attached to window manager
at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:416)
at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:342)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:111)
at com.txusballesteros.bubbles.BubblesService$1.run(BubblesService.java:69)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5637)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)

Chain multiple bubbles together?

Is it possible to mimic facebook chat heads behaviour? stack bubbles over each other and on tap, list them horizontally chained together

isBubbleVisible()

Hello, How do we get the event that bubble is currently visible or not ? I want to check the status ! Do we have any method ?

Thanks,
Nimit

Usage with an AccessbilityService?

I wish to use the bubble in an AccessibilityService but that sounds like something that should not be done since that would be a Service running inside a Service(or would that be fine not very sure).

Simply put, how can i use the bubbles inside of an AccessbilityService? How can I go about doing that?

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

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)

new message bubble

how can I connect the bubble manager from my GCM service class.Its not showing when I tried to initialize it from the service.

Bubble cannot be run from the separated Service

Hello,

I would like to ask how can I display bubble on the main thread in separated service (due to better code organization). I tried following, but when i started service using.

Intent myIntent = new Intent(mContext, BubbleService.class);
mContext.startService(myIntent);

No bubble is displayed, without any exception.

Should i use the IntentService for this or how can i solve this issue?

Many thanks for any advice.

BubbleService:

public class BubbleService extends Service {

    private Context mContext;
    private BubblesManager bubblesManager;
    private BubbleLayout currentBubbleLayout;
    private Boolean isBubbleDisplayed = false;
    private Handler mHandler;
    private Runnable mRunnable;

    public BubbleService() {
        mContext = this;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        try {
            Logger.d("onCreate");
            showBubble();
        } catch (Exception e) {
            Logger.e(e.getMessage());
        }
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
        //TODO: MOVE TO SEPARATED METHOD
        //bubblesManager.recycle();
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }


    private void showBubble() {
        try {
            Logger.d("Show bubble");
            this.initBubble();
            BubbleLayout mBubbleView = (BubbleLayout) LayoutInflater
                    .from(BubbleService.this).inflate(R.layout.bubble_layout, null);
            //this.setTimerForInactiveBubble(mBubbleView); //TODO:UNCOMMENT AND RESET TIME WHEN USER TOUCHED THE BUBBLE
            mBubbleView.setOnBubbleClickListener(mBubbleClickListener);
            mBubbleView.setOnBubbleRemoveListener(mBubbleRemoveListener);
            if(!isBubbleDisplayed) {
                bubblesManager.addBubble(mBubbleView, 60, 20);
                isBubbleDisplayed = true;
            }

        } catch (Exception e) {
            Logger.e(e.getMessage());
        }
    }

    private void setTimerForInactiveBubble(final BubbleLayout bubbleLayout) {
        try {
            Logger.d("setTimerForInactiveBubble");
            mHandler = new Handler();
            mRunnable = new Runnable() {
                @Override
                public void run() {
                    mBubbleRemoveListener.onBubbleRemoved(bubbleLayout);
                }
            };
            mHandler.postDelayed(mRunnable,
                    Constants.Global.BUBBLE_DISMISS_DURATION);
            mHandler.removeCallbacks(mRunnable);
        } catch (Exception e) {
            Logger.e(e.getMessage());
        }
    }


    private BubbleLayout.OnBubbleRemoveListener mBubbleRemoveListener = new BubbleLayout.OnBubbleRemoveListener() {
        @Override
        public void onBubbleRemoved(BubbleLayout bubble) {
            Logger.d("onBubbleRemoved");
            bubble.removeAllViews();
            isBubbleDisplayed = false;
        }
    };

    private BubbleLayout.OnBubbleClickListener mBubbleClickListener = new BubbleLayout.OnBubbleClickListener() {
        @Override
        public void onBubbleClick(BubbleLayout bubble) {
            try {
                Logger.d("Clicked on the bubble");
                if (CommonHelper.isDeviceOnline(mContext)) {
                    bubble.findViewById(R.id.avatar).setVisibility(View.GONE);
                    bubble.findViewById(R.id.loading_progress_bar).setVisibility(View.VISIBLE);
                    currentBubbleLayout = bubble;
                }
                else {
                    ToastHelper.showToastMessage(mContext, //TODO: ADD THE OFFLINE TRANSACTION //TODO: MOVE TOAST TO HELPER?
                            mContext.getResources().getString(R.string.no_internet_connectivity),
                            Constants.Global.DEBUG_ENABLED);
                }
            } catch (Exception e) {
                Logger.d(e.getMessage());
            }

        }
    };

    private void initBubble() throws Exception {
        Logger.d("initBubble");
        bubblesManager = new BubblesManager.Builder(mContext)
                .setTrashLayout(R.layout.bubble_trash_layout)
                .build();
        bubblesManager.initialize();
    }
}

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

Keep Running

How can i keep app running ?
i want to create a Fab like iPhone that running in android
images

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

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.