本文整理汇总了Java中android.support.v4.widget.DrawerLayout.DrawerListener类的典型用法代码示例。如果您正苦于以下问题:Java DrawerListener类的具体用法?Java DrawerListener怎么用?Java DrawerListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DrawerListener类属于android.support.v4.widget.DrawerLayout包,在下文中一共展示了DrawerListener类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import android.support.v4.widget.DrawerLayout.DrawerListener; //导入依赖的package包/类
public static Observable<Irrelevant> close(final DrawerLayout drawer) {
return Observable.create(emitter -> {
drawer.closeDrawer(GravityCompat.START);
DrawerListener listener = new DrawerLayout.SimpleDrawerListener() {
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
if (slideOffset < OFFSET_THRESHOLD) {
emitter.onNext(Irrelevant.INSTANCE);
emitter.onComplete();
drawer.removeDrawerListener(this);
}
}
};
drawer.addDrawerListener(listener);
});
}
示例2: registerListener
import android.support.v4.widget.DrawerLayout.DrawerListener; //导入依赖的package包/类
/**
* Returns a {@link ViewAction} that adds an {@link IdlingDrawerListener} as a drawer listener to
* the {@link DrawerLayout}. The idling drawer listener wraps any listener that already exists.
*/
private static ViewAction registerListener() {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return isAssignableFrom(DrawerLayout.class);
}
@Override
public String getDescription() {
return "register idling drawer listener";
}
@Override
public void perform(UiController uiController, View view) {
DrawerLayout drawer = (DrawerLayout) view;
DrawerListener existingListener = getDrawerListener(drawer);
if (existingListener instanceof IdlingDrawerListener) {
// listener is already registered. No need to assign.
return;
}
drawer.setDrawerListener(IdlingDrawerListener.getInstance(existingListener));
}
};
}
示例3: getInstance
import android.support.v4.widget.DrawerLayout.DrawerListener; //导入依赖的package包/类
private static IdlingDrawerListener getInstance(DrawerListener parentListener) {
if (instance == null) {
instance = new IdlingDrawerListener();
Espresso.registerIdlingResources(instance);
}
instance.setParentListener(parentListener);
return instance;
}
示例4: setDrawerListener
import android.support.v4.widget.DrawerLayout.DrawerListener; //导入依赖的package包/类
public void setDrawerListener(DrawerListener drawerListener, boolean oneTimeListener) {
this.drawerListener = drawerListener;
this.oneTimeListener = oneTimeListener;
}
示例5: setDrawerListener
import android.support.v4.widget.DrawerLayout.DrawerListener; //导入依赖的package包/类
public final void setDrawerListener(DrawerLayout.DrawerListener paramDrawerListener)
{
this.mDrawerListener = paramDrawerListener;
}
示例6: setParentListener
import android.support.v4.widget.DrawerLayout.DrawerListener; //导入依赖的package包/类
public void setParentListener(@Nullable DrawerListener parentListener) {
this.parentListener = parentListener;
}