Closed frakc closed 9 years ago
DraggablePanel is a DraggableView facade and is not easy to support resize feature right now. You can use DraggableView with resize enabled and add your fragment manually as DraggablePanel does. That's why the sample code is not using this feature.
@pedrovgs but main problem - resize transformer causes youtubefragment to be few pixel under some view, which make youtube player to stop, as anything is not allowed to be above it
Can you upload a screenshot whit your device layout bounds option activated?
@pedrovgs screenshoot As You can see if you magnify image, video fragme is slightly overlaped a bottom
I don't see any problem :S can you add an arrow or something like that pointing to the problem? Why do you say that youtube player is going to stop the video if youtube fragment is under some view?
I guess you are using the last library version.
@pedrovgs Yes, I am using last library version. quot from google dev https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayerFragment?hl=ru "Note that while videos are playing, this View has a minimum size of 200x110 dp. If you make the view any smaller, videos will automatically stop playing. Also, it is not permitted to overlay this fragment's view with other views while a video is playing. " And if you will try to put any overlay to youtubeplayerview or youtubeplayerfragment you will see that it is true - video will stop plaing in 2 second if overlay vill not move out of youtubeplayer bounds.
Also in last line of error log in topic body, you will see distances with negative numbers which point to overlaping.
I also tried to point it on this image, do you see that top view is just few pixels below bottomview? http://oi61.tinypic.com/2vv8dw5.jpg
I'm also seeing this behaviour where the youtube video will stop sometimes in minimized view.
I am using DraggableView and the youtube video resizes correctly.
03-28 15:06:47.630 3783-3783/com.myapp W/YouTubeAndroidPlayerAPI﹕ YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is not contained inside its ancestor android.widget.FrameLayout{1e96423f V.E..... .......D 1189,897-2395,1334 #7f0a0043 app:id/youtubeVideoContainer}. The distances between the ancestor's edges and that of the YouTubePlayerView is: left: 0, top: 0, right: -3, bottom: -1 (these should all be positive).
@ninja-tortoise There might be an issue with ResizeTransformer or with YouTubePlayerFragment. A quick fix would be to add padding or margin (bottom and right) to YouTubePlayerView after the fragment's view was created
@nostake This worked like charm. Thanks a lot.
@ninja-tortoise can you upload your previous DraggablePanel configuration to a sample project? I'd like to fix this issue :)
Hi Pedrovgs,
i had a problem with landscape view while using draggable panel, can u mention any hint or help to solve this feature.. i am trying to implement fullscreen mode...
The current workaround is change your DraggablePanel to use DraggableView. I'm trying to get time to improve this project but I'm working in another open source project right now...sorry.
Hi Pedrovgs,
Thanks for giving reply for my previous question, Hope you are doing well and busy with you work, i have one more doubt regarding draggable panel , if u have some free time can u clarify me ,
if we use "draggableView.setTopViewHeight(topFragmentHeight);" for top view fragment like 200 dip in Portrait mode , when the screen is in landscape mode, still the topFragmentHeight is 200dp, to show topview (video view) in full screen mode this is stopping me, if we change topFragmentHeight to 400 dp , in portrait mode it will bit more and in landscape view the top view(video view) will be fitted to fullscreen.. i guess this is stopping to load in full screen,, i tried from sidewith different approaches other than this way..
can u share your valuable inputs ..
Thie setTopViewHeight is a method only valid in the portrait mode. If you want to develop a landscape mode you'll have to override some of the current behavior.
besides overlappind, there also was issue with minimal player size for YouTubePlayerSupportFragment,which is limited to 200*110 dp. I fixed it in following way: At first wrap frame which will hold youtube fragment and add top and bottom padding
<FrameLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="220dip"
android:paddingBottom="5dip"
android:paddingTop="5dip"
android:layout_alignParentTop="true"
>
<FrameLayout
android:id="@+id/youtube_here"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</FrameLayout>
then
change updateScale
method in resizetransformer to
@Override public void updateScale(float verticalDragOffset) {
int newWidth = (int) (getOriginalWidth() * (1 - verticalDragOffset / getXScaleFactor()));
int newHeight = (int) (getOriginalHeight() * (1 - verticalDragOffset / getYScaleFactor()));
if(newWidth>minX)layoutParams.width = newWidth;
if(newHeight>minY)layoutParams.height = newHeight;
getView().setLayoutParams(layoutParams);
}
and constructor to
private int minX,minY;
ResizeTransformer(View view, View parent) {
super(view, parent);
layoutParams = (RelativeLayout.LayoutParams) view.getLayoutParams();
minX = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 210, view.getContext()
.getResources()
.getDisplayMetrics()
);
minY = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 114, view.getContext().getResources().getDisplayMetrics()
);
}
that will ensure that player will not be smalle then minimal dimentions and will not be overlaped by bottom fragment
Hi frank, I have tried what you mentioned i am able to get resize transformer with youtube fragment but when minimized it seams that touches on minimized view is not recognized.It is not sliding to right or left for close its only maximizing.Can you update your code to sample.
Hi Frakc, I implemented your suggestions but the top video fragment is going below the screen,its not position well and also when minimized it seams that touches on minimized view is not recognized.It is not sliding to right or left for close its only maximizing..
There were many issues, that minimised youtubeplayersupportfragment displays only topleft corner of the video. And there were recommendations which did not work: set draggable_panel:top_view_resize="true"/ It did not work because this paramenter was never transmited to draggableview ( as i see in latest 1.6 snapshot version of source library) after I modefied
inside DragablePanel.java? I can see nice resied minimised youtubeplayerfragment ScreenShot But new issue arise from this. Dragview became overlaped by few pixels and i cant understand where it comes from.