Last active
December 13, 2015 17:48
-
-
Save drakestone/4950611 to your computer and use it in GitHub Desktop.
This is SlidingMenu patch code to get notice when SlidingMenu is opening.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- SlidingMenu.java 2013-02-14 13:24:19.000000000 +0900 | |
+++ /tmp/SlidingMenu.java 2013-02-14 13:24:15.000000000 +0900 | |
@@ -86,7 +86,7 @@ | |
/** | |
* On open. | |
*/ | |
- public void onOpen(); | |
+ public void onOpen(int position); | |
} | |
/** | |
@@ -210,16 +210,19 @@ | |
mViewAbove.setCustomViewBehind(mViewBehind); | |
mViewBehind.setCustomViewAbove(mViewAbove); | |
mViewAbove.setOnPageChangeListener(new OnPageChangeListener() { | |
- public static final int POSITION_OPEN = 0; | |
- public static final int POSITION_CLOSE = 1; | |
+ public static final int POSITION_LEFT_MENU = 0; | |
+ public static final int POSITION_CONTENT = 1; | |
+ public static final int POSITION_RIGHT_MENU = 2; | |
public void onPageScrolled(int position, float positionOffset, | |
int positionOffsetPixels) { } | |
public void onPageSelected(int position) { | |
- if (position == POSITION_OPEN && mOpenListener != null) { | |
- mOpenListener.onOpen(); | |
- } else if (position == POSITION_CLOSE && mCloseListener != null) { | |
+ if (position == POSITION_LEFT_MENU && mOpenListener != null) { | |
+ mOpenListener.onOpen(position); | |
+ } else if (position == POSITION_RIGHT_MENU && mOpenListener != null) { | |
+ mOpenListener.onOpen(position); | |
+ } else if (position == POSITION_CONTENT && mCloseListener != null) { | |
mCloseListener.onClose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment