Java 类android.support.v4.view.ViewGroupCompat 实例源码

项目:ShoppingMall    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:DragPaneLayout    文件:DragPaneLayout.java   
public DragPaneLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mDensity = context.getResources().getDisplayMetrics().density;

    mViewDragCallback = new ViewDragCallback();
    mDragHelper = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mViewDragCallback);
    mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * mDensity);

    ViewCompat.setImportantForAccessibility(this,
               ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO);

    // So that we can catch the back button ?
       setFocusableInTouchMode(true);
       setClickable(true);
       ViewGroupCompat.setMotionEventSplittingEnabled(this, false);

       mGestureDetector = new GestureDetectorCompat(context, mGestureListener);
}
项目:MiBandDecompiled    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attributeset, int i1)
{
    super(context, attributeset, i1);
    k = 0x99000000;
    m = new Paint();
    t = true;
    float f1 = getResources().getDisplayMetrics().density;
    j = (int)(0.5F + 64F * f1);
    float f2 = f1 * 400F;
    p = new h(this, 3);
    q = new h(this, 5);
    n = ViewDragHelper.create(this, 1.0F, p);
    n.setEdgeTrackingEnabled(1);
    n.setMinVelocity(f2);
    p.a(n);
    o = ViewDragHelper.create(this, 1.0F, q);
    o.setEdgeTrackingEnabled(2);
    o.setMinVelocity(f2);
    q.a(o);
    setFocusableInTouchMode(true);
    ViewCompat.setAccessibilityDelegate(this, new f(this));
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:CodenameOne    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, 0.5f, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, 0.5f, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:generator-android    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:something.apk    文件:MarginDrawerLayout.java   
public MarginDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:informant-droid    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:Klyph    文件:KlyphDrawerLayout.java   
public KlyphDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, 0.5f, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, 0.5f, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:android-recipes-app    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:bitcast    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:V.FlyoutTest    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:guideshow    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:Dreamer    文件:TopSwipeLayout.java   
public TopSwipeLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:COCO-Accessory    文件:SliderPanel.java   
/**
 * Initialize the slider panel
 */
private void init() {
    mScreenWidth = getResources().getDisplayMetrics().widthPixels;

    final float density = getResources().getDisplayMetrics().density;
    final float minVel = MIN_FLING_VELOCITY * density;

    mDragHelper = ViewDragHelper.create(this, 1f, mCallback);
    mDragHelper.setMinVelocity(minVel);

    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);

    // Setup the dimmer view
    mDimView = new View(getContext());
    mDimView.setBackgroundColor(Color.BLACK);
    ViewCompat.setAlpha(mDimView, MAX_DIM_ALPHA);

    // Add the dimmer view to the layout
    addView(mDimView);

}
项目:MoSeS--Client-    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:android.support.v4    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:letv    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    this.mChildAccessibilityDelegate = new ChildAccessibilityDelegate();
    this.mScrimColor = DEFAULT_SCRIM_COLOR;
    this.mScrimPaint = new Paint();
    this.mFirstLayout = true;
    this.mLockModeLeft = 3;
    this.mLockModeRight = 3;
    this.mLockModeStart = 3;
    this.mLockModeEnd = 3;
    this.mShadowStart = null;
    this.mShadowEnd = null;
    this.mShadowLeft = null;
    this.mShadowRight = null;
    setDescendantFocusability(262144);
    float density = getResources().getDisplayMetrics().density;
    this.mMinDrawerMargin = (int) ((64.0f * density) + 0.5f);
    float minVel = 400.0f * density;
    this.mLeftCallback = new ViewDragCallback(3);
    this.mRightCallback = new ViewDragCallback(5);
    this.mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, this.mLeftCallback);
    this.mLeftDragger.setEdgeTrackingEnabled(1);
    this.mLeftDragger.setMinVelocity(minVel);
    this.mLeftCallback.setDragger(this.mLeftDragger);
    this.mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, this.mRightCallback);
    this.mRightDragger.setEdgeTrackingEnabled(2);
    this.mRightDragger.setMinVelocity(minVel);
    this.mRightCallback.setDragger(this.mRightDragger);
    setFocusableInTouchMode(true);
    ViewCompat.setImportantForAccessibility(this, 1);
    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
    if (ViewCompat.getFitsSystemWindows(this)) {
        IMPL.configureApplyInsets(this);
        this.mStatusBarBackground = IMPL.getDefaultStatusBarBackground(context);
    }
    this.mDrawerElevation = TitleBar.SHAREBTN_RIGHT_MARGIN * density;
    this.mNonDrawerViews = new ArrayList();
}
项目:superglue    文件:DebugDrawerLayout.java   
public DebugDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
  super(context, attrs, defStyle);
  setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
  final float density = getResources().getDisplayMetrics().density;
  mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
  final float minVel = MIN_FLING_VELOCITY * density;

  mLeftCallback = new ViewDragCallback(Gravity.LEFT);
  mRightCallback = new ViewDragCallback(Gravity.RIGHT);

  mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
  mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
  mLeftDragger.setMinVelocity(minVel);
  mLeftCallback.setDragger(mLeftDragger);

  mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
  mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
  mRightDragger.setMinVelocity(minVel);
  mRightCallback.setDragger(mRightDragger);

  // So that we can catch the back button
  setFocusableInTouchMode(true);

  ViewCompat.setImportantForAccessibility(this,
      ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

  ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
  ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
  if (ViewCompat.getFitsSystemWindows(this)) {
    IMPL.configureApplyInsets(this);
    mStatusBarBackground = IMPL.getDefaultStatusBarBackground(context);
  }
}
项目:superglue    文件:DebugDrawerLayout.java   
public DebugDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
  super(context, attrs, defStyle);
  setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
  final float density = getResources().getDisplayMetrics().density;
  mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
  final float minVel = MIN_FLING_VELOCITY * density;

  mLeftCallback = new ViewDragCallback(Gravity.LEFT);
  mRightCallback = new ViewDragCallback(Gravity.RIGHT);

  mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
  mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
  mLeftDragger.setMinVelocity(minVel);
  mLeftCallback.setDragger(mLeftDragger);

  mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
  mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
  mRightDragger.setMinVelocity(minVel);
  mRightCallback.setDragger(mRightDragger);

  // So that we can catch the back button
  setFocusableInTouchMode(true);

  ViewCompat.setImportantForAccessibility(this,
      ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

  ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
  ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
  if (ViewCompat.getFitsSystemWindows(this)) {
    IMPL.configureApplyInsets(this);
    mStatusBarBackground = IMPL.getDefaultStatusBarBackground(context);
  }
}
项目:boohee_v5.6    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    this.mChildAccessibilityDelegate = new ChildAccessibilityDelegate();
    this.mScrimColor = DEFAULT_SCRIM_COLOR;
    this.mScrimPaint = new Paint();
    this.mFirstLayout = true;
    this.mLockModeLeft = 3;
    this.mLockModeRight = 3;
    this.mLockModeStart = 3;
    this.mLockModeEnd = 3;
    this.mShadowStart = null;
    this.mShadowEnd = null;
    this.mShadowLeft = null;
    this.mShadowRight = null;
    setDescendantFocusability(262144);
    float density = getResources().getDisplayMetrics().density;
    this.mMinDrawerMargin = (int) ((64.0f * density) + 0.5f);
    float minVel = 400.0f * density;
    this.mLeftCallback = new ViewDragCallback(3);
    this.mRightCallback = new ViewDragCallback(5);
    this.mLeftDragger = ViewDragHelper.create(this, 1.0f, this.mLeftCallback);
    this.mLeftDragger.setEdgeTrackingEnabled(1);
    this.mLeftDragger.setMinVelocity(minVel);
    this.mLeftCallback.setDragger(this.mLeftDragger);
    this.mRightDragger = ViewDragHelper.create(this, 1.0f, this.mRightCallback);
    this.mRightDragger.setEdgeTrackingEnabled(2);
    this.mRightDragger.setMinVelocity(minVel);
    this.mRightCallback.setDragger(this.mRightDragger);
    setFocusableInTouchMode(true);
    ViewCompat.setImportantForAccessibility(this, 1);
    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
    if (ViewCompat.getFitsSystemWindows(this)) {
        IMPL.configureApplyInsets(this);
        this.mStatusBarBackground = IMPL.getDefaultStatusBarBackground(context);
    }
    this.mDrawerElevation = 10.0f * density;
    this.mNonDrawerViews = new ArrayList();
}
项目:920-text-editor-v2    文件:TranslucentDrawerLayout.java   
public TranslucentDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setImportantForAccessibility(this,
            ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
    if (ViewCompat.getFitsSystemWindows(this)) {
        IMPL.configureApplyInsets(this);
        mStatusBarBackground = IMPL.getDefaultStatusBarBackground(context);
    }

    mDrawerElevation = DRAWER_ELEVATION * density;

    mNonDrawerViews = new ArrayList<View>();
}
项目:FMTech    文件:DrawerLayout.java   
public DrawerLayout(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
  super(paramContext, paramAttributeSet, paramInt);
  setDescendantFocusability(262144);
  float f1 = getResources().getDisplayMetrics().density;
  this.mMinDrawerMargin = ((int)(0.5F + 64.0F * f1));
  float f2 = 400.0F * f1;
  this.mLeftCallback = new ViewDragCallback(3);
  this.mRightCallback = new ViewDragCallback(5);
  this.mLeftDragger = ViewDragHelper.create(this, 1.0F, this.mLeftCallback);
  this.mLeftDragger.mTrackingEdges = 1;
  this.mLeftDragger.mMinVelocity = f2;
  this.mLeftCallback.mDragger = this.mLeftDragger;
  this.mRightDragger = ViewDragHelper.create(this, 1.0F, this.mRightCallback);
  this.mRightDragger.mTrackingEdges = 2;
  this.mRightDragger.mMinVelocity = f2;
  this.mRightCallback.mDragger = this.mRightDragger;
  setFocusableInTouchMode(true);
  ViewCompat.setImportantForAccessibility(this, 1);
  ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
  ViewGroupCompat.setMotionEventSplittingEnabled$4d3af60(this);
  if (ViewCompat.getFitsSystemWindows(this))
  {
    IMPL.configureApplyInsets(this);
    this.mStatusBarBackground = IMPL.getDefaultStatusBarBackground(paramContext);
  }
  this.mDrawerElevation = (10.0F * f1);
  this.mNonDrawerViews = new ArrayList();
}
项目:MyCTFWriteUps    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attributeset, int i)
{
    super(context, attributeset, i);
    mChildAccessibilityDelegate = new ChildAccessibilityDelegate();
    mScrimColor = 0x99000000;
    mScrimPaint = new Paint();
    mFirstLayout = true;
    mShadowStart = null;
    mShadowEnd = null;
    mShadowLeft = null;
    mShadowRight = null;
    setDescendantFocusability(0x40000);
    float f = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int)(64F * f + 0.5F);
    float f1 = 400F * f;
    mLeftCallback = new ViewDragCallback(3);
    mRightCallback = new ViewDragCallback(5);
    mLeftDragger = ViewDragHelper.create(this, 1.0F, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(1);
    mLeftDragger.setMinVelocity(f1);
    mLeftCallback.setDragger(mLeftDragger);
    mRightDragger = ViewDragHelper.create(this, 1.0F, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(2);
    mRightDragger.setMinVelocity(f1);
    mRightCallback.setDragger(mRightDragger);
    setFocusableInTouchMode(true);
    ViewCompat.setImportantForAccessibility(this, 1);
    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
    if (ViewCompat.getFitsSystemWindows(this))
    {
        IMPL.configureApplyInsets(this);
        mStatusBarBackground = IMPL.getDefaultStatusBarBackground(context);
    }
    mDrawerElevation = 10F * f;
    mNonDrawerViews = new ArrayList();
}
项目:adt-leanback-support    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setImportantForAccessibility(this,
            ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
    if (ViewCompat.getFitsSystemWindows(this)) {
        IMPL.configureApplyInsets(this);
    }
}
项目:ReverseDrawerLayout    文件:ReverseDrawerLayout.java   
public ReverseDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final float density = getResources().getDisplayMetrics().density;

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ReverseDrawerLayout, 0, 0);
    try {
        mDrawerOverhang = (int) a.getDimension(R.styleable.ReverseDrawerLayout_drawerOverhang,
                (int) (DRAWER_OVERHANG * density + 0.5f));
    } finally {
        a.recycle();
    }

    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
}
项目:IntranetEpitechV2    文件:DrawerLayout.java   
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
    final float density = getResources().getDisplayMetrics().density;
    mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
    final float minVel = MIN_FLING_VELOCITY * density;

    mLeftCallback = new ViewDragCallback(Gravity.LEFT);
    mRightCallback = new ViewDragCallback(Gravity.RIGHT);

    mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
    mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
    mLeftDragger.setMinVelocity(minVel);
    mLeftCallback.setDragger(mLeftDragger);

    mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
    mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
    mRightDragger.setMinVelocity(minVel);
    mRightCallback.setDragger(mRightDragger);

    // So that we can catch the back button
    setFocusableInTouchMode(true);

    ViewCompat.setImportantForAccessibility(this,
            ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

    ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
    if (ViewCompat.getFitsSystemWindows(this)) {
        IMPL.configureApplyInsets(this);
    }
}
项目:u2020    文件:DebugDrawerLayout.java   
public DebugDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
  super(context, attrs, defStyle);
  setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
  final float density = getResources().getDisplayMetrics().density;
  mMinDrawerMargin = (int) (MIN_DRAWER_MARGIN * density + 0.5f);
  final float minVel = MIN_FLING_VELOCITY * density;

  mLeftCallback = new ViewDragCallback(Gravity.LEFT);
  mRightCallback = new ViewDragCallback(Gravity.RIGHT);

  mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback);
  mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);
  mLeftDragger.setMinVelocity(minVel);
  mLeftCallback.setDragger(mLeftDragger);

  mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback);
  mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT);
  mRightDragger.setMinVelocity(minVel);
  mRightCallback.setDragger(mRightDragger);

  // So that we can catch the back button
  setFocusableInTouchMode(true);

  ViewCompat.setImportantForAccessibility(this,
      ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);

  ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate());
  ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
  if (ViewCompat.getFitsSystemWindows(this)) {
    IMPL.configureApplyInsets(this);
    mStatusBarBackground = IMPL.getDefaultStatusBarBackground(context);
  }
}
项目:GracefulMovies    文件:SlideBackLayout.java   
private void initConfig(SlideConfig config) {

        if (config == null) {
            config = new SlideConfig.Builder().create();
        }

        mScreenWidth = getResources().getDisplayMetrics().widthPixels;

        final float density = getResources().getDisplayMetrics().density;
        final float minVel = MIN_FLING_VELOCITY * density;

        ViewGroupCompat.setMotionEventSplittingEnabled(this, false);
        SlideLeftCallback slideLeftCallback = new SlideLeftCallback();
        mDragHelper = ViewDragHelper.create(this, 1.0f, slideLeftCallback);
        // 最小拖动速度
        mDragHelper.setMinVelocity(minVel);
        mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT);

        mCacheDrawView = new CacheDrawView(getContext());
        mCacheDrawView.setVisibility(INVISIBLE);
        addView(mCacheDrawView);

        mShadowView = new ShadowView(getContext());
        mShadowView.setVisibility(INVISIBLE);
        addView(mShadowView, mScreenWidth / 28, LayoutParams.MATCH_PARENT);

        addView(mContentView);

        mEdgeOnly = config.isEdgeOnly();
        mLock = config.isLock();
        mRotateScreen = config.isRotateScreen();

        mSlideOutRangePercent = config.getSlideOutPercent();
        mEdgeRangePercent = config.getEdgePercent();

        mSlideOutRange = mScreenWidth * mSlideOutRangePercent;
        mEdgeRange = mScreenWidth * mEdgeRangePercent;
        mSlideOutVelocity = config.getSlideOutVelocity();

        mSlidDistantX = mScreenWidth / 20.0f;

        mContentView.setFitsSystemWindows(false);

        if (mRotateScreen) {
            mContentView.findViewById(android.R.id.content).setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    // 屏蔽上个内容页的点击事件
                }
            });
        }

    }
项目:YGank    文件:SliderPanel.java   
/**
 * Initialize the slider panel
 *
 */
private void init(){
    mScreenWidth = getResources().getDisplayMetrics().widthPixels;

    final float density = getResources().getDisplayMetrics().density;
    final float minVel = MIN_FLING_VELOCITY * density;

    ViewDragHelper.Callback callback;
    switch (mConfig.getPosition()){
        case LEFT:
            callback = mLeftCallback;
            mEdgePosition = ViewDragHelper.EDGE_LEFT;
            break;
        case RIGHT:
            callback = mRightCallback;
            mEdgePosition = ViewDragHelper.EDGE_RIGHT;
            break;
        case TOP:
            callback = mTopCallback;
            mEdgePosition = ViewDragHelper.EDGE_TOP;
            break;
        case BOTTOM:
            callback = mBottomCallback;
            mEdgePosition = ViewDragHelper.EDGE_BOTTOM;
            break;
        case VERTICAL:
            callback = mVerticalCallback;
            mEdgePosition = ViewDragHelper.EDGE_TOP | ViewDragHelper.EDGE_BOTTOM;
            break;
        case HORIZONTAL:
            callback = mHorizontalCallback;
            mEdgePosition = ViewDragHelper.EDGE_LEFT | ViewDragHelper.EDGE_RIGHT;
            break;
        default:
            callback = mLeftCallback;
            mEdgePosition = ViewDragHelper.EDGE_LEFT;
    }

    mDragHelper = ViewDragHelper.create(this, mConfig.getSensitivity(), callback);
    mDragHelper.setMinVelocity(minVel);
    mDragHelper.setEdgeTrackingEnabled(mEdgePosition);

    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);

    // Setup the dimmer view
    mDimView = new View(getContext());
    mDimView.setBackgroundColor(mConfig.getScrimColor());
    mDimView.setAlpha(mConfig.getScrimStartAlpha());

    // Add the dimmer view to the layout
    addView(mDimView);

    /*
     * This is so we can get the height of the view and
     * ignore the system navigation that would be included if we
     * retrieved this value from the DisplayMetrics
     */
    post(new Runnable() {
        @Override
        public void run() {
            mScreenHeight = getHeight();
        }
    });

    final int[] screenSize = getScreenSize((Activity) getContext());
    mSlidrDistantX = screenSize[0] / 100.0f;
    mSlidrDistantY = screenSize[1] / 80.0f;

}
项目:Slide-Master    文件:SliderPanel.java   
/**
 * Initialize the slider panel
 *
 * TODO: Based on SlidrPosition configure the ViewDragHelper to the appropriate position.
 *
 */
private void init(){
    mScreenWidth = getResources().getDisplayMetrics().widthPixels;

    final float density = getResources().getDisplayMetrics().density;
    final float minVel = MIN_FLING_VELOCITY * density;

    ViewDragHelper.Callback callback;
    int position;
    switch (mConfig.getPosition()){
        case LEFT:
            callback = mLeftCallback;
            position = ViewDragHelper.EDGE_LEFT;
            break;
        case RIGHT:
            callback = mRightCallback;
            position = ViewDragHelper.EDGE_RIGHT;
            break;
        case TOP:
            callback = mTopCallback;
            position = ViewDragHelper.EDGE_TOP;
            break;
        case BOTTOM:
            callback = mBottomCallback;
            position = ViewDragHelper.EDGE_BOTTOM;
            break;
        default:
            callback = mLeftCallback;
            position = ViewDragHelper.EDGE_LEFT;
    }

    mDragHelper = ViewDragHelper.create(this, mConfig.getSensitivity(), callback);
    mDragHelper.setMinVelocity(minVel);
    mDragHelper.setEdgeTrackingEnabled(position);


    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);

    // Setup the dimmer view
    mDimView = new View(getContext());
    mDimView.setBackgroundColor(Color.BLACK);
    mDimView.setAlpha(MAX_DIM_ALPHA);

    // Add the dimmer view to the layout
    addView(mDimView);

    /*
     * This is so we can get the height of the view and
     * ignore the system navigation that would be included if we
     * retrieved this value from the DisplayMetrics
     */
    post(new Runnable() {
        @Override
        public void run() {
            mScreenHeight = getHeight();
        }
    });

}
项目:Slidr    文件:SliderPanel.java   
private void init(){
    setWillNotDraw(false);
    screenWidth = getResources().getDisplayMetrics().widthPixels;

    final float density = getResources().getDisplayMetrics().density;
    final float minVel = MIN_FLING_VELOCITY * density;

    ViewDragHelper.Callback callback;
    switch (config.getPosition()){
        case LEFT:
            callback = leftCallback;
            edgePosition = ViewDragHelper.EDGE_LEFT;
            break;
        case RIGHT:
            callback = rightCallback;
            edgePosition = ViewDragHelper.EDGE_RIGHT;
            break;
        case TOP:
            callback = topCallback;
            edgePosition = ViewDragHelper.EDGE_TOP;
            break;
        case BOTTOM:
            callback = bottomCallback;
            edgePosition = ViewDragHelper.EDGE_BOTTOM;
            break;
        case VERTICAL:
            callback = verticalCallback;
            edgePosition = ViewDragHelper.EDGE_TOP | ViewDragHelper.EDGE_BOTTOM;
            break;
        case HORIZONTAL:
            callback = horizontalCallback;
            edgePosition = ViewDragHelper.EDGE_LEFT | ViewDragHelper.EDGE_RIGHT;
            break;
        default:
            callback = leftCallback;
            edgePosition = ViewDragHelper.EDGE_LEFT;
    }

    dragHelper = ViewDragHelper.create(this, config.getSensitivity(), callback);
    dragHelper.setMinVelocity(minVel);
    dragHelper.setEdgeTrackingEnabled(edgePosition);

    ViewGroupCompat.setMotionEventSplittingEnabled(this, false);

    // Setup the dimmer view
    scrimPaint = new Paint();
    scrimPaint.setColor(config.getScrimColor());
    scrimPaint.setAlpha(toAlpha(config.getScrimStartAlpha()));
    scrimRenderer = new ScrimRenderer(this, decorView);

    /*
     * This is so we can get the height of the view and
     * ignore the system navigation that would be included if we
     * retrieved this value from the DisplayMetrics
     */
    post(new Runnable() {
        @Override
        public void run() {
            screenHeight = getHeight();
        }
    });

}
项目:CustomViews    文件:BottomDrawer.java   
private void init(Context context, AttributeSet attrs) {
       TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BottomDrawer);
       mResIdDragHandle = a.getResourceId(R.styleable.BottomDrawer_drag_handle, -1 );
       mResIdToggleButton = a.getResourceId(R.styleable.BottomDrawer_toggle_button, -1 );
       mFriction = a.getFloat(R.styleable.BottomDrawer_overscroll_friction, mFriction);

       int initStateVal = a.getInt(R.styleable.BottomDrawer_initial_state, State.COLLAPSED.getValue());

       mState = State.getState(initStateVal);
       if( mState == State.UNDEFINED ){
        mState = State.COLLAPSED;
       }

       if( a.hasValue(R.styleable.BottomDrawer_overscroll_color) ){
        mOverscrollCollor = a.getColor(R.styleable.BottomDrawer_overscroll_color, -1);
        mUseOverscrollCollor = true;
       }else{
        mUseOverscrollCollor = false;
       }
       if( a.hasValue(R.styleable.BottomDrawer_obscure_color) ){
        mObscureCollor = a.getColor(R.styleable.BottomDrawer_obscure_color, -1);
        mUseObscureCollor = true;
       }else{
        mUseObscureCollor = false;
       }
       a.recycle();
    int n = getChildCount();
    if( n > 3 ){
        throw new RuntimeException("BottomHidingPanelLayout cannot have more than 3 child elements");
    }


    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = configuration.getScaledTouchSlop() / 2;
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity() * 3;

       final float density = getResources().getDisplayMetrics().density;
       final float minVel = MIN_FLING_VELOCITY * density;
       mMoveOffset = (int)(MOVE_OFFSET*density);

       mDragHelperCallback = new DragHelperCallback();
    mDragger = ViewDragHelper.create(this, 1.0f, mDragHelperCallback);
    mDragger.setMinVelocity(minVel);
       ViewGroupCompat.setMotionEventSplittingEnabled(this, true);

       setWillNotDraw(false);
}