Skip to content

Commit 32a8ac7

Browse files
author
jfeinstein10
committed
Fix for empty non-clickable views
1 parent 593b78a commit 32a8ac7

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

library/src/com/slidingmenu/lib/CustomViewAbove.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
public class CustomViewAbove extends ViewGroup {
3535

3636
private static final String TAG = "CustomViewAbove";
37-
private static final boolean DEBUG = true;
37+
private static final boolean DEBUG = false;
3838

3939
private static final boolean USE_CACHE = false;
4040

@@ -158,11 +158,9 @@ public CustomViewAbove(Context context, AttributeSet attrs) {
158158
}
159159

160160
void initCustomViewAbove() {
161-
// setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
162-
setDescendantFocusability(FOCUS_BEFORE_DESCENDANTS);
163-
setClickable(true);
164-
setFocusable(true);
165161
setWillNotDraw(false);
162+
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
163+
setFocusable(true);
166164
final Context context = getContext();
167165
mScroller = new Scroller(context, sInterpolator);
168166
final ViewConfiguration configuration = ViewConfiguration.get(context);
@@ -435,8 +433,6 @@ public void setContent(View v) {
435433
if (mContent != null)
436434
this.removeView(mContent);
437435
mContent = v;
438-
// mContent.setClickable(true);
439-
mContent.setFocusable(true);
440436
addView(mContent);
441437
}
442438

@@ -689,12 +685,12 @@ public boolean onTouchEvent(MotionEvent ev) {
689685
if (!mEnabled)
690686
return false;
691687

692-
// if (!mIsBeingDragged && !thisTouchAllowed(ev))
693-
// return false;
694-
695-
if (!mIsBeingDragged && !mQuickReturn)
688+
if (!mIsBeingDragged && !thisTouchAllowed(ev))
696689
return false;
697690

691+
// if (!mIsBeingDragged && !mQuickReturn)
692+
// return false;
693+
698694
final int action = ev.getAction();
699695

700696
if (mVelocityTracker == null) {

library/src/com/slidingmenu/lib/SlidingMenu.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public SlidingMenu(Context context, AttributeSet attrs) {
199199
*/
200200
public SlidingMenu(Context context, AttributeSet attrs, int defStyle) {
201201
super(context, attrs, defStyle);
202-
202+
203203
LayoutParams behindParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
204204
mViewBehind = new CustomViewBehind(context);
205205
addView(mViewBehind, behindParams);
@@ -320,10 +320,13 @@ public void attachToActivity(Activity activity, int slideStyle, boolean actionba
320320
case SLIDING_CONTENT:
321321
mActionbarOverlay = actionbarOverlay;
322322
// take the above view out of
323-
ViewGroup contentParent = (ViewGroup)activity.findViewById(android.R.id.content);
324-
View content = contentParent.getChildAt(0);
323+
// ViewGroup contentParent = (ViewGroup)activity.findViewById(android.R.id.content);
324+
// View content = contentParent.getChildAt(0);
325+
View content = activity.findViewById(android.R.id.content);
326+
content.setFocusable(true);
327+
ViewGroup contentParent = (ViewGroup)content.getParent();
325328
contentParent.removeView(content);
326-
contentParent.addView(this, 0, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
329+
contentParent.addView(this);
327330
setContent(content);
328331
// save people from having transparent backgrounds
329332
if (content.getBackground() == null)

0 commit comments

Comments
 (0)