pedrovgs / DraggablePanel

Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.
Apache License 2.0
2.99k stars 605 forks source link

Dynamic change TopFragment's layout after calling initializeView #75

Open bqthuan opened 8 years ago

bqthuan commented 8 years ago

Hi you, After calling initializeView i cannot dynamic add view to TopFragment's layout, doesn't crash or throws any exception but doesn't showing the added view, seem not invalidated, i also call invalidate, requestLayout for TopFragment's layout, DraggablePanel and the added view, not working at all. Final solution that working : Calling requestLayout for BottomFragment's layout after adding view to TopFragment's layout. So, I have no idea how my solution works and this problem.

tanaev commented 8 years ago

@bqthuan when you call initializeView() its called draggableView.attachTopFragment(topFragment);

void attachTopFragment(Fragment topFragment) { addFragmentToView(R.id.drag_view, topFragment); }

then

private void addFragmentToView(final int viewId, final Fragment fragment) { fragmentManager.beginTransaction().replace(viewId, fragment).commit(); } where viewId is R.id.drag_view by default so, for change top fragment, you need something like

getSupportFragmentManager().beginTransaction().replace(R.id.drag_view, YOUFRAGMENT).commit();

bqthuan commented 8 years ago

@tanaev Did you test your solution? It's not working for me.

andreimarinescu commented 8 years ago

I'm having the same issue, I'm unable to change the view hierarchy of the top fragment. The only thing that worked indeed was calling a requestLayout on the bottom fragment with a 500 ms delay (when doing it instantly, the touch would also have issues and onMaximize would be called each time i touched the top fragment).

Any way of doing this elegantly?