android.support.v4.widget.DrawerLayout.getDrawerLockMode()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中android.support.v4.widget.DrawerLayout.getDrawerLockMode()方法的一些代码示例,展示了DrawerLayout.getDrawerLockMode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DrawerLayout.getDrawerLockMode()方法的具体详情如下:
包路径:android.support.v4.widget.DrawerLayout
类名称:DrawerLayout
方法名:getDrawerLockMode

DrawerLayout.getDrawerLockMode介绍

[英]Check the lock mode of the drawer with the given gravity.
[中]在给定重力下检查抽屉的锁定模式。

代码示例

代码示例来源:origin: willowtreeapps/Hyperion-Android

@NonNull
@Override
public List<ViewAttribute> collect(DrawerLayout view, AttributeTranslator attributeTranslator) {
  List<ViewAttribute> attributes = new ArrayList<>();
  attributes.add(new ViewAttribute<>("DrawerElevation", view.getDrawerElevation()));
  attributes.add(new ViewAttribute<>("DrawerTitleStart",
      view.getDrawerTitle(Gravity.START)));
  attributes.add(new ViewAttribute<>("DrawerTitleEnd",
      view.isDrawerVisible(Gravity.END)));
  attributes.add(new ViewAttribute<>("DrawerLockModeStart",
      new DrawerLayoutLockModeValue(view.getDrawerLockMode(Gravity.START))));
  attributes.add(new ViewAttribute<>("DrawerLockModeEnd",
      new DrawerLayoutLockModeValue(view.getDrawerLockMode(Gravity.END))));
  attributes.add(new ViewAttribute<>("DrawerOpenStart",
      view.isDrawerOpen(Gravity.START)));
  attributes.add(new ViewAttribute<>("DrawerOpenEnd",
      view.isDrawerOpen(Gravity.END)));
  attributes.add(new ViewAttribute<>("DrawerVisibleStart",
      view.isDrawerVisible(Gravity.START)));
  attributes.add(new ViewAttribute<>("DrawerVisibleEnd",
      view.isDrawerVisible(Gravity.END)));
  attributes.add(new ViewAttribute<Void>("StatusBarBackgroundDrawable",
      view.getStatusBarBackgroundDrawable()));
  return attributes;
}

代码示例来源:origin: OceanLabs/Android-Print-SDK

private void toggle()
 {
 int drawerLockMode = mDrawerLayout.getDrawerLockMode( GravityCompat.START );
 if ( mDrawerLayout.isDrawerVisible( GravityCompat.START )
     && ( drawerLockMode != DrawerLayout.LOCK_MODE_LOCKED_OPEN ) )
  {
  mDrawerLayout.closeDrawer( GravityCompat.START );
  }
 else if ( drawerLockMode != DrawerLayout.LOCK_MODE_LOCKED_CLOSED )
  {
  mDrawerLayout.openDrawer( GravityCompat.START );
  }
 }

代码示例来源:origin: jbruchanov/AnUitor

@Override
  protected HashMap<String, Object> fillValues(View v, HashMap<String, Object> data,
                       HashMap<String, Object> parentData) {
    super.fillValues(v, data, parentData);

    DrawerLayout dl = (DrawerLayout) v;

    Translator translator = getTranslator();
    data.put("DrawerLockModeLeft", translator.drawerLockMode(dl.getDrawerLockMode(Gravity.LEFT)));
    data.put("DrawerLockModeRight", translator.drawerLockMode(dl.getDrawerLockMode(Gravity.RIGHT)));
    data.put("IsDrawerLeftOpen", dl.isDrawerOpen(Gravity.LEFT));
    data.put("IsDrawerRightOpen", dl.isDrawerOpen(Gravity.RIGHT));
    data.put("IsDrawerLeftVisible", dl.isDrawerVisible(Gravity.LEFT));
    data.put("IsDrawerRightVisible", dl.isDrawerVisible(Gravity.RIGHT));

    return data;
  }
}

代码示例来源:origin: kingargyle/adt-leanback-support

@Override
public boolean tryCaptureView(View child, int pointerId) {
  // Only capture views where the gravity matches what we're looking for.
  // This lets us use two ViewDragHelpers, one for each side drawer.
  return isDrawerView(child) && checkDrawerViewAbsoluteGravity(child, mAbsGravity)
      && getDrawerLockMode(child) == LOCK_MODE_UNLOCKED;
}

代码示例来源:origin: kingargyle/adt-leanback-support

@Override
public void onEdgeDragStarted(int edgeFlags, int pointerId) {
  final View toCapture;
  if ((edgeFlags & ViewDragHelper.EDGE_LEFT) == ViewDragHelper.EDGE_LEFT) {
    toCapture = findDrawerWithGravity(Gravity.LEFT);
  } else {
    toCapture = findDrawerWithGravity(Gravity.RIGHT);
  }
  if (toCapture != null && getDrawerLockMode(toCapture) == LOCK_MODE_UNLOCKED) {
    mDragger.captureChildView(toCapture, pointerId);
  }
}

代码示例来源:origin: kingargyle/adt-leanback-support

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
  if (keyCode == KeyEvent.KEYCODE_BACK) {
    final View visibleDrawer = findVisibleDrawer();
    if (visibleDrawer != null && getDrawerLockMode(visibleDrawer) == LOCK_MODE_UNLOCKED) {
      closeDrawers();
    }
    return visibleDrawer != null;
  }
  return super.onKeyUp(keyCode, event);
}

代码示例来源:origin: kingargyle/adt-leanback-support

private void peekDrawer() {
  final View toCapture;
  final int childLeft;
  final int peekDistance = mDragger.getEdgeSize();
  final boolean leftEdge = mAbsGravity == Gravity.LEFT;
  if (leftEdge) {
    toCapture = findDrawerWithGravity(Gravity.LEFT);
    childLeft = (toCapture != null ? -toCapture.getWidth() : 0) + peekDistance;
  } else {
    toCapture = findDrawerWithGravity(Gravity.RIGHT);
    childLeft = getWidth() - peekDistance;
  }
  // Only peek if it would mean making the drawer more visible and the drawer isn't locked
  if (toCapture != null && ((leftEdge && toCapture.getLeft() < childLeft) ||
      (!leftEdge && toCapture.getLeft() > childLeft)) &&
      getDrawerLockMode(toCapture) == LOCK_MODE_UNLOCKED) {
    final LayoutParams lp = (LayoutParams) toCapture.getLayoutParams();
    mDragger.smoothSlideViewTo(toCapture, childLeft, toCapture.getTop());
    lp.isPeeking = true;
    invalidate();
    closeOtherDrawer();
    cancelChildViewTouch();
  }
}

代码示例来源:origin: kingargyle/adt-leanback-support

peekingOnly = getDrawerLockMode(openDrawer) == LOCK_MODE_LOCKED_OPEN;

相关文章