Java Code Examples for android.support.v4.widget.DrawerLayout#DrawerListener

The following examples show how to use android.support.v4.widget.DrawerLayout#DrawerListener . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ObligatoryDrawerListenerTest.java    From fogger with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldInvokeAddtionalListenerOnDrawerSlideWhenListenerSet() {
    //given
    DrawerLayout.DrawerListener userDrawerListener = mock(DrawerLayout.DrawerListener.class);
    obligatoryDrawerListener.setUserDrawerListener(userDrawerListener);
    View view = mock(View.class);
    float slideOffset = 0.4f;

    //when
    obligatoryDrawerListener.onDrawerSlide(view, slideOffset);

    //then
    verify(userDrawerListener, times(1)).onDrawerSlide(view, slideOffset);
}
 
Example 2
Source File: ObligatoryDrawerListenerTest.java    From fogger with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldInvokeAddtionalListenerOnDrawerStateChangedWhenListenerSet() {
    //given
    DrawerLayout.DrawerListener userDrawerListener = mock(DrawerLayout.DrawerListener.class);
    obligatoryDrawerListener.setUserDrawerListener(userDrawerListener);
    int drawerState = 2;

    //when
    obligatoryDrawerListener.onDrawerStateChanged(drawerState);

    //then
    verify(userDrawerListener, times(1)).onDrawerStateChanged(drawerState);
}
 
Example 3
Source File: ObligatoryDrawerListenerTest.java    From fogger with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldInvokeAddtionalListenerOnDrawerOpenedWhenListenerSet() {
    //given
    DrawerLayout.DrawerListener userDrawerListener = mock(DrawerLayout.DrawerListener.class);
    obligatoryDrawerListener.setUserDrawerListener(userDrawerListener);
    View view = mock(View.class);

    //when
    obligatoryDrawerListener.onDrawerOpened(view);

    //then
    verify(userDrawerListener, times(1)).onDrawerOpened(view);
}
 
Example 4
Source File: ObligatoryDrawerListenerTest.java    From fogger with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldInvokeAddtionalListenerOnDrawerClosedWhenListenerSet() {
    //given
    DrawerLayout.DrawerListener userDrawerListener = mock(DrawerLayout.DrawerListener.class);
    obligatoryDrawerListener.setUserDrawerListener(userDrawerListener);
    View view = mock(View.class);

    //when
    obligatoryDrawerListener.onDrawerClosed(view);

    //then
    verify(userDrawerListener, times(1)).onDrawerClosed(view);
}
 
Example 5
Source File: DrawerListenerAdapter.java    From SlidingRootNav with Apache License 2.0 4 votes vote down vote up
public DrawerListenerAdapter(DrawerLayout.DrawerListener adaptee, View drawer) {
    this.adaptee = adaptee;
    this.drawer = drawer;
}
 
Example 6
Source File: ObligatoryDrawerListener.java    From fogger with Apache License 2.0 4 votes vote down vote up
public synchronized void setUserDrawerListener(DrawerLayout.DrawerListener userDrawerListener) {
    this.userDrawerListener = userDrawerListener;
}
 
Example 7
Source File: DebugDrawer.java    From DebugDrawer with Apache License 2.0 4 votes vote down vote up
public Builder setDrawerListener(DrawerLayout.DrawerListener onDrawerListener) {
    this.onDrawerListener = onDrawerListener;
    return this;
}
 
Example 8
Source File: DebugDrawer.java    From DebugDrawer with Apache License 2.0 4 votes vote down vote up
public Builder setDrawerListener(DrawerLayout.DrawerListener onDrawerListener) {
    return this;
}
 
Example 9
Source File: DrawerListenerAdapter.java    From android-transition with Apache License 2.0 4 votes vote down vote up
/**
 * @param mDrawerListener
 */
public void setDrawerListener(@Nullable DrawerLayout.DrawerListener mDrawerListener) {
    this.mDrawerListener = mDrawerListener;
}
 
Example 10
Source File: MaterialNavigationDrawer.java    From AdvancedMaterialDrawer with Apache License 2.0 4 votes vote down vote up
public void setDrawerStateListener(DrawerLayout.DrawerListener listener) {
    this.drawerStateListener = listener;
}
 
Example 11
Source File: MaterialNavigationDrawer.java    From MaterialNavigationDrawer with Apache License 2.0 4 votes vote down vote up
public void setDrawerListener(DrawerLayout.DrawerListener listener) {
    this.drawerListener = listener;
}