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

Draggable Panel Tablet Landscape Support Similar to youtube 3-view slider. #81

Open Amritpal33 opened 8 years ago

Amritpal33 commented 8 years ago

I have been using DraggablePanel in phone as per the implementation and it is working perfectly fine for me. I just want your help to understand how similar Experience can be achieved on Tablet Landscape view similar to Youtube.

I may add third fragment in right of player and proceed.It may be helpful if you guide me through the implementation.

Thanks in Advance.!

royalviki007 commented 7 years ago

Hi, I wanted to achieve diagonal slide animation similar to youtube.

I have made changes on updatePosition method in ScaleTransformer class to calculate the new pivotX for landscape mode to drag the top fragment diagonally.

public void updatePosition(float verticalDragOffset) { float maxScaleFactor = (1 - (1 / getXScaleFactor())); int actualWidth = (int) getMinWidthPlusMarginRight(); int finalWidth = (int) (getMinWidthPlusMarginRight() maxScaleFactor); int translatedWidth = actualWidth - finalWidth; int totalTanslatedWidth = getParentView().getWidth() - finalWidth; xPosition = (int) (actualWidth 1.0f / translatedWidth * totalTanslatedWidth); ViewHelper.setPivotX(getView(), xPosition); ViewHelper.setPivotY(getView(), getView().getHeight() - getMarginBottom()); }

This enable me to drag the video(Top Fragment) from top left to bottom right in landscape mode, after settling down at bottom right, not able to drag vertically , only horizontal drag was working.

As I am playing with scaling the view, its actual properties remain the same. which is make it fail for isViewHit method of ViewHelper.

Thanks ..