forked from jfeinstein10/SlidingMenu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomViewBehind.java
More file actions
74 lines (58 loc) · 1.33 KB
/
CustomViewBehind.java
File metadata and controls
74 lines (58 loc) · 1.33 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
package com.slidingmenu.lib;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
public class CustomViewBehind extends CustomViewAbove {
private static final String TAG = "CustomViewBehind";
public CustomViewBehind(Context context) {
this(context, null);
}
public CustomViewBehind(Context context, AttributeSet attrs) {
super(context, attrs, false);
}
public int getDestScrollX() {
if (isMenuOpen()) {
return getBehindWidth();
} else {
return 0;
}
}
public int getChildLeft(int i) {
return 0;
}
public int getChildRight(int i) {
return getChildLeft(i) + getChildWidth(i);
}
public boolean isMenuOpen() {
return getScrollX() == 0;
}
public int getCustomWidth() {
int i = isMenuOpen()? 0 : 1;
return getChildWidth(i);
}
public int getChildWidth(int i) {
if (i <= 0) {
return getBehindWidth();
} else {
return getChildAt(i).getMeasuredWidth();
}
}
public int getBehindWidth() {
ViewGroup.LayoutParams params = getLayoutParams();
return params.width;
}
@Override
public void setContent(View v) {
super.setMenu(v);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent e) {
return false;
}
@Override
public boolean onTouchEvent(MotionEvent e) {
return false;
}
}