blob: 06dbb26c863d5d052606554eb82884c7b494a8ed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
package de.luhmer.owncloudnewsreader.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
/**
* Created by David on 21.06.2014.
*/
public class PodcastSlidingUpPanelLayout extends SlidingUpPanelLayout{
public PodcastSlidingUpPanelLayout(Context context) {
super(context);
}
public PodcastSlidingUpPanelLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public PodcastSlidingUpPanelLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
//return super.onInterceptTouchEvent(ev);
return isDragViewHit((int)ev.getX(), (int)ev.getY());
}
private View mDragView;
private View mSlideableView;
public void setSlideableView(View view) {
this.mSlideableView = view;
}
@Override
public void setDragView(View dragView) {
this.mDragView = dragView;
super.setDragView(dragView);
}
private boolean isDragViewHit(int x, int y) {
//original implementation - only allow dragging on mDragView
View v = isExpanded() ? mDragView : mSlideableView;
if (v == null) return false;
int[] viewLocation = new int[2];
v.getLocationOnScreen(viewLocation);
int[] parentLocation = new int[2];
this.getLocationOnScreen(parentLocation);
int screenX = parentLocation[0] + x;
int screenY = parentLocation[1] + y;
return screenX >= viewLocation[0] && screenX < viewLocation[0] + v.getWidth() &&
screenY >= viewLocation[1] && screenY < viewLocation[1] + v.getHeight();
}
}
|