Closed manpreetsinghsodhi closed 10 years ago
I had a similar problem with vitamio VideoView as dragView and resizeTransformer.
Solution: Move methods responsible for changing a position of seconView to layoutChange listener of dragView.
in DraggableView.mapGui()
...
private void mapGUI(TypedArray attributes) {
final int dragViewId = attributes.getResourceId(R.styleable.draggable_view_top_view_id, R.id.drag_view);
final int secondViewId = attributes.getResourceId(R.styleable.draggable_view_bottom_view_id, R.id.second_view);
dragView = findViewById(dragViewId);
secondView = findViewById(secondViewId);
ViewTreeObserver observer = dragView.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
changeSecondViewPosition();
changeSecondViewAlpha();
}
});
}
...
and comment in: DraggableViewCallback.onViewPositionChanged()
...
@Override
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
draggableView.updateLastDragViewPosition(top, left);
if (draggableView.isDragViewAtBottom()) {
draggableView.changeDragViewViewAlpha();
} else {
draggableView.restoreAlpha();
draggableView.changeDragViewScale();
draggableView.changeDragViewPosition();
//draggableView.changeSecondViewAlpha();
//draggableView.changeSecondViewPosition();
draggableView.changeBackgroundAlpha();
}
}
...
also there is bug in DraggableView.smoothSlideTo(float slideOffset)
int x = (int) (slideOffset * (getWidth() - transformer.getMinWidth()));
int y = (int) (topBound + slideOffset * getVerticalDragRange());
should be:
int x = (int) (slideOffset * (getWidth() - transformer.getMinWidth() - transformer.getMarginRight()));
int y = (int) (topBound + slideOffset * getVerticalDragRange());
and some in resize tranformer...
You need to create local copy of library (clone git repo), add it as module, add module dependency in grade (I'm using Android Studio), and modify java sources. In eclipse create android library project, make changes, compile and add .jar to libs, of your project.
Changes You need to make: In Class: https://github.com/pedrovgs/DraggablePanel/blob/develop/draggablepanel/src/main/java/com/github/pedrovgs/DraggableView.java#L334 modify/replace mapGUI (Copy&Paste from above answer)
add comment in line 66&67, or replace whole onViewPositionChanged() from my prev answer
Sorry for my English, I hope You'll understand now.
Hi i implemented the changes you suggested but still it is not working fine. There is a problem of rendering when i drag from top to bottom and bottom to top again and also it is taking a lot of time.
I am sending you screenshots when i drag from top to bottom
And when i drag from bottom to top then it is displaying as follows
So please help me
And what are changes in code should i do in resize transformer?
You using ScaleTransformer which is default (seems more smooth, but not working with vitamio)... in ScaleTransformer view position is changed by ViewHelper.
Add brake point in addOnGlobalLayoutListener you implemented, and check whether it is fired
If not, you should reverse changes and study dragView & secondView positions while dragging, and in OnLayout https://github.com/pedrovgs/DraggablePanel/blob/develop/draggablepanel/src/main/java/com/github/pedrovgs/DraggableView.java#L308
and check if positions are proper...
I implemented the library as it is in sample . Haven't changed anything other than changes you suggested. So how to resolve it now . Is there any alternate for this draggable pannel on github or anywhere else?
Can you share your code (Add whole project to Archive)? I'll take look and may be able to help.
@Fiddle3 sure .Can i have your mail id or skype id ?
mail.fiddle@gmail.com
Guys I was on holidays and I couldn't comment about this issues. Sorry.
Instead of copy paste code modifications why don't you fork this project to your github and send me a pull request with your changes?
@manpreetsinghsodhi if you want some help, please upload your project to any repository and give me access. My mail is pedrovicente.gomez (at) gmail (dot) com. And I'll take a look.
Please, don't open more issues related with the same problem. I'm going to help you with this in this issue and close other issues opened by @manpreetsinghsodhi because every issue opened is related with the same problem.
I'll send pull request, but I have to test it more deeply
@pedrovgs sure !!
@pedrovgs Hi i added you as a collaborator to my repository. I uploaded the files that are causing me error. Please have a look. Issue you already know . I uploaded vedio in earlier issue as well. Looking positively for help.
I'll take a look this weekend. Thanks!
@pedrovgs I tried to explore why this issue occurs, but I haven't enough time to investigate this deeply, so, for now, i use temp fix with ViewTreeObserver and it works I made some other changes in library, take look https://github.com/Fiddl3/DraggablePanel/commit/b0f253eb76adc530dc01e6ec456e41265065d4f2
I'll continue working on this when I'll have time, and send you a pull request... Maybe you'll resolve this issue earlier
@Fiddl3 thanks! @manpreetsinghsodhi can you check if that version of the library is working for you?
@pedrovgs here is updated sample app that I send to @manpreetsinghsodhi last week https://github.com/Fiddl3/DraggablePanel/commit/e6f64b6798bc5e3707ed2d991344d62b4a876d85
Fiddle when vedio plays it is again cutting edges at bottom(only on vedio play). I will send you my project in android studio.
I don't have time to resolve all of your problems... especially if I don't know what is the problem...
I suppose that video aspect ratio is different than dragView aspect ratio and part of video is cutoff (at bottom), the solution for this "issue" is to change dragView height programmatically to adjust it to video height
There is more problems to solve for example, when you drag YT player the video doesn't change its dimensions. There will be many more so You should teach yourself how to resolve them.
@manpreetsinghsodhi I've created a new branch with a ListView below DraggablePanel in YoutubeSampleActivity. It's working fine to me.
https://github.com/pedrovgs/DraggablePanel/tree/manpreetsinghsodhi-issue17
@manpreetsinghsodhi I think I've found the bug. It's related with YouTube player view. This view is executing requestLayout when I still think my view was in other position :) I've changed onLayout method to fix this issue. Please, review if it's working for to and tell me to do a public release to maven central.
This is the branch: https://github.com/pedrovgs/DraggablePanel/tree/manpreetsinghsodhi-issue17
Thanks. This issue is solved.
\o/ Released and uploaded to Maven Central Repository in Release 1.3.
I imported your sample app and done minor changes. In framelayout i took first element as Listview(as i need to show working same as youtube app). When we minimize the vedio and i select any other element from listview then draggable pannel UI is getting distorted. I changed activity_youtube_sample.xml as following <?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:draggable_panel="http://schemas.android.com/apk/res-auto" android:id="@+id/fl_container" android:layout_width="match_parent" android:layout_height="match_parent">
Even i tried putting listview and draggable pannel in separate linear layout(with match parent) but still not working. And the rest of the code is as it is. I captured vedio of the error http://videobam.com/IUjYH This library is not working for me in this situation. Kindly help.