Skip to content

Commit 9402c1a

Browse files
author
Maruti Borker
committed
Adding OnOpenListner for Secondary Menu
1 parent 8fcae2c commit 9402c1a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class SlidingMenu extends RelativeLayout {
6969
private CustomViewBehind mViewBehind;
7070

7171
private OnOpenListener mOpenListener;
72+
73+
private OnOpenListener mSecondaryOpenListner;
7274

7375
private OnCloseListener mCloseListener;
7476

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

216219
public void onPageScrolled(int position, float positionOffset,
217220
int positionOffsetPixels) { }
@@ -221,6 +224,8 @@ public void onPageSelected(int position) {
221224
mOpenListener.onOpen();
222225
} else if (position == POSITION_CLOSE && mCloseListener != null) {
223226
mCloseListener.onClose();
227+
} else if (position == POSITION_SECONDARY_OPEN && mSecondaryOpenListner != null ) {
228+
mSecondaryOpenListner.onOpen();
224229
}
225230
}
226231
});
@@ -878,8 +883,19 @@ public void setOnOpenListener(OnOpenListener listener) {
878883
mOpenListener = listener;
879884
}
880885

886+
887+
/**
888+
* Sets the OnOpenListner for secondary menu {@link OnOpenListener#onOpen() OnOpenListener.onOpen()} will be called when the secondary SlidingMenu is opened
889+
*
890+
* @param listener the new OnOpenListener
891+
*/
892+
893+
public void setSecondaryOnOpenListner(OnOpenListener listener) {
894+
mSecondaryOpenListner = listener;
895+
}
896+
881897
/**
882-
* Sets the OnCloseListener. {@link OnCloseListener#onClose() OnCloseListener.onClose()} will be called when the SlidingMenu is closed
898+
* Sets the OnCloseListener. {@link OnCloseListener#onClose() OnCloseListener.onClose()} will be called when nay one of the SlidingMenu is closed
883899
*
884900
* @param listener the new setOnCloseListener
885901
*/
@@ -1005,4 +1021,4 @@ public void run() {
10051021
}
10061022
}
10071023

1008-
}
1024+
}

0 commit comments

Comments
 (0)