Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move bubble #17

Open
jehutyx opened this issue Jan 7, 2016 · 1 comment
Open

move bubble #17

jehutyx opened this issue Jan 7, 2016 · 1 comment

Comments

@jehutyx
Copy link

jehutyx commented Jan 7, 2016

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

@harmskhosa
Copy link

Hey,

This is quite a late response but in case anyone else is still looking for a similar solution, after skimming over the WindowManager implementation I think that the following is a possible solution for moving the bubble:

// params to represent the new position
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.WRAP_CONTENT,
                WindowManager.LayoutParams.TYPE_PHONE,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
                PixelFormat.TRANSLUCENT
        );
        params.gravity = Gravity.TOP | Gravity.LEFT;
        params.x = 0;
        params.y = 100; 
// get instance of window manager and use it to update the bubble's position
bubble.getWindowManager().updateViewLayout(bubble, params);
// notify the bubble's layout coordinator
if (bubble.getLayoutCoordinator() != null) {
    bubble.getLayoutCoordinator().notifyBubblePositionChanged(this, x, y);
}

Note: this will likely just 'teleport' the bubble without a smooth transition. If you're after a smooth transition you'll probably need to add an animation for the params, this might help: https://stackoverflow.com/questions/8664939/animate-view-added-on-windowmanager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants