Skip to content

Commit

Permalink
Adding OnOpenListner for Secondary Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Maruti Borker committed Jul 18, 2013
1 parent 8fcae2c commit 9402c1a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions library/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public class SlidingMenu extends RelativeLayout {
private CustomViewBehind mViewBehind;

private OnOpenListener mOpenListener;

private OnOpenListener mSecondaryOpenListner;

private OnCloseListener mCloseListener;

Expand Down Expand Up @@ -212,6 +214,7 @@ public SlidingMenu(Context context, AttributeSet attrs, int defStyle) {
mViewAbove.setOnPageChangeListener(new OnPageChangeListener() {
public static final int POSITION_OPEN = 0;
public static final int POSITION_CLOSE = 1;
public static final int POSITION_SECONDARY_OPEN = 2;

public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) { }
Expand All @@ -221,6 +224,8 @@ public void onPageSelected(int position) {
mOpenListener.onOpen();
} else if (position == POSITION_CLOSE && mCloseListener != null) {
mCloseListener.onClose();
} else if (position == POSITION_SECONDARY_OPEN && mSecondaryOpenListner != null ) {
mSecondaryOpenListner.onOpen();
}
}
});
Expand Down Expand Up @@ -878,8 +883,19 @@ public void setOnOpenListener(OnOpenListener listener) {
mOpenListener = listener;
}


/**
* Sets the OnOpenListner for secondary menu {@link OnOpenListener#onOpen() OnOpenListener.onOpen()} will be called when the secondary SlidingMenu is opened
*
* @param listener the new OnOpenListener
*/

public void setSecondaryOnOpenListner(OnOpenListener listener) {
mSecondaryOpenListner = listener;
}

/**
* Sets the OnCloseListener. {@link OnCloseListener#onClose() OnCloseListener.onClose()} will be called when the SlidingMenu is closed
* Sets the OnCloseListener. {@link OnCloseListener#onClose() OnCloseListener.onClose()} will be called when nay one of the SlidingMenu is closed
*
* @param listener the new setOnCloseListener
*/
Expand Down Expand Up @@ -1005,4 +1021,4 @@ public void run() {
}
}

}
}

0 comments on commit 9402c1a

Please sign in to comment.