Skip to content

Instantly share code, notes, and snippets.

@drakestone
Last active December 13, 2015 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drakestone/4950611 to your computer and use it in GitHub Desktop.
Save drakestone/4950611 to your computer and use it in GitHub Desktop.
This is SlidingMenu patch code to get notice when SlidingMenu is opening.
--- 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