@Override public void onAnimationEnd(Animator animation) { // reset the view; if (isOpened()) { viewActivity.setTouchDisable(true); viewActivity.setOnClickListener(viewActivityOnClickListener); } else { viewActivity.setTouchDisable(false); viewActivity.setOnClickListener(null); hideScrollViewMenu(scrollViewLeftMenu); hideScrollViewMenu(scrollViewRightMenu); if (menuListener != null) menuListener.closeMenu(); } }
@Override protected boolean fitSystemWindows(Rect insets) { // Applies the content insets to the view's padding, consuming that // content (modifying the insets to be 0), // and returning true. This behavior is off by default and can be // enabled through setFitsSystemWindows(boolean) // in api14+ devices. // This is added to fix soft navigationBar's overlapping to content above LOLLIPOP int bottomPadding = viewActivity.getPaddingBottom() + insets.bottom; boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK); boolean hasHomeKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_HOME); if (!hasBackKey || !hasHomeKey) { // there's a navigation bar bottomPadding += getNavigationBarHeight(); } this.setPadding( viewActivity.getPaddingLeft() + insets.left, viewActivity.getPaddingTop() + insets.top, viewActivity.getPaddingRight() + insets.right, bottomPadding); insets.left = insets.top = insets.right = insets.bottom = 0; return true; }
private void initValue(Activity activity) { this.activity = activity; leftMenuItems = new ArrayList<ResideMenuItem>(); rightMenuItems = new ArrayList<ResideMenuItem>(); ignoredViews = new ArrayList<View>(); viewDecor = (ViewGroup) activity.getWindow().getDecorView(); viewActivity = new TouchDisableView(this.activity); View mContent = viewDecor.getChildAt(0); viewDecor.removeViewAt(0); viewActivity.setContent(mContent); addView(viewActivity); ViewGroup parent = (ViewGroup) scrollViewLeftMenu.getParent(); parent.removeView(scrollViewLeftMenu); parent.removeView(scrollViewRightMenu); }