Detailed Docs
Android SwipeDrawer sliding drawer library
  • Attribute explain
  • mode
  • open
  • mask
  • mainLayout
  • leftLayout
  • topLayout
  • rightLayout
  • bottomLayout
  • mainType
  • leftType
  • topType
  • rightType
  • bottomType
  • leftMode
  • topMode
  • rightMode
  • bottomMode
  • mainOpen
  • parentDrawer
  • mainScroll
  • leftScroll
  • topScroll
  • rightScroll
  • bottomScroll
  • leftDragOpen
  • topDragOpen
  • rightDragOpen
  • bottomDragOpen
  • showLayout
  • autoClose
  • maskClose
  • maskColor
  • dragClose
  • dragCloseType
  • scrollOuterDrag
  • autoLayout
  • shrinkRange
  • dragDamping
  • dragRange
  • leftDragRange
  • topDragRange
  • rightDragRange
  • bottomDragRange
  • leftOffset
  • topOffset
  • rightOffset
  • bottomOffset
  • dragSlop
  • turnCancel
  • maxDragSize
  • duration
  • interpolator
  • Call interface
  • OnDrawerState
  • OnDrawerSwitch
  • OnDrawerChange
  • Call method
  • openDrawer
  • closeDrawer
  • toggleDrawer
  • setIntercept
  • drawerLayout
  • Static method
  • setAllIntercept
  • getAllIntercept
  • getParentDrawer
  • Other
  • DrawerHolder

Attribute explain

mode

There are three open modes:

  • : Drawer mode, The main layout moves simultaneously with the drawer layoutView Preview
  • : Cover mode, Drawer layout move onlyView Preview
  • : Fixed mode, Main layout move onlyView Preview


open

Initialization status, The specified direction is turned on by default:

  • : Left is on by defaultView Preview
  • : Top is on by defaultView Preview
  • : Right is on by defaultView Preview
  • : Bottom is on by defaultView Preview


mask

Background mask:

  • : Not openView Preview
  • : Fixed colorView Preview
  • : Gradual depthView Preview


mainLayout

Specifies the main layout ID:

  • If this attribute is not specified, It defaults to the first sub layout with no ID specified
<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:mainLayout="@+id/mainDrawer">
    <RelativeLayout
        android:id="@+id/mainDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000" />
    ...
</cn.leaqi.drawer.SwipeDrawer>


leftLayout

Specifies the left layout ID:

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:leftLayout="@+id/leftDrawer">
    <RelativeLayout
        android:id="@+id/leftDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000" />
    ...
</cn.leaqi.drawer.SwipeDrawer>


topLayout

Specifies the top layout ID:

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:topLayout="@+id/topDrawer">
    <RelativeLayout
        android:id="@+id/topDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000" />
    ...
</cn.leaqi.drawer.SwipeDrawer>


rightLayout

Specifies the right layout ID:

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:rightLayout="@+id/rightDrawer">
    <RelativeLayout
        android:id="@+id/rightDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000" />
    ...
</cn.leaqi.drawer.SwipeDrawer>


bottomLayout

Specifies the bottom layout ID:

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:bottomLayout="@+id/bottomDrawer">
    <RelativeLayout
        android:id="@+id/bottomDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000" />
    ...
</cn.leaqi.drawer.SwipeDrawer>


mainType

Main layout type:

  • : Non sliding layout, The default is this item
  • : Vertical sliding layout, Must be a direct child, For childrenSpecify ID
  • : Horizontal sliding layout, Must be a direct child, For childrenSpecify ID
<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:mainLayout="@+id/mainDrawer"
    app:mainType="scrollY">
    <ScrollView
        android:id="@+id/mainDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000">
        ...
    </ScrollView>
    ...
</cn.leaqi.drawer.SwipeDrawer>


leftType

Left layout type:

  • : Non sliding layout, The default is this item
  • : Vertical sliding layout, Must be a direct child, For childrenSpecify ID
  • : Horizontal sliding layout, Must be a direct child, For childrenSpecify ID
<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:leftLayout="@+id/leftDrawer"
    app:leftType="scrollY">
    <HorizontalScrollView
        android:id="@+id/leftDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000">
        ...
    </HorizontalScrollView>
    ...
</cn.leaqi.drawer.SwipeDrawer>


topType

Top layout type:

  • : Non sliding layout, The default is this item
  • : Vertical sliding layout, Must be a direct child, For childrenSpecify ID
  • : Horizontal sliding layout, Must be a direct child, For childrenSpecify ID
<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:topLayout="@+id/topDrawer"
    app:topType="scrollY">
    <ScrollView
        android:id="@+id/topDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000">
        ...
    </ScrollView>
    ...
</cn.leaqi.drawer.SwipeDrawer>


rightType

Right layout type:

  • : Non sliding layout, The default is this item
  • : Vertical sliding layout, Must be a direct child, For childrenSpecify ID
  • : Horizontal sliding layout, Must be a direct child, For childrenSpecify ID
<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:rightLayout="@+id/rightDrawer"
    app:rightType="scrollY">
    <HorizontalScrollView
        android:id="@+id/rightDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000">
        ...
    </HorizontalScrollView>
    ...
</cn.leaqi.drawer.SwipeDrawer>


bottomType

Bottom layout type:

  • : Non sliding layout, The default is this item
  • : Vertical sliding layout, Must be a direct child, For childrenSpecify ID
  • : Horizontal sliding layout, Must be a direct child, For childrenSpecify ID
<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:bottomLayout="@+id/bottomDrawer"
    app:bottomType="scrollY">
    <ScrollView
        android:id="@+id/bottomDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000">
        ...
    </ScrollView>
    ...
</cn.leaqi.drawer.SwipeDrawer>


leftMode

  • This attribute specifies the left direction on mode
  • If it is not set, it inherits the opening mode of


topMode

  • This attribute specifies the top direction on mode
  • If it is not set, it inherits the opening mode of


rightMode

  • This attribute specifies the right direction on mode
  • If it is not set, it inherits the opening mode of


bottomMode

  • This attribute specifies the bottom direction on mode
  • If it is not set, it inherits the opening mode of


mainOpen

Main layout touch event after opening: This property setting is invalid when the mask is turned on

  • : UnshieldedView Preview
  • : Click onlyView Preview
  • : Disable all touch eventsView Preview


parentDrawer

Specifies the layout ID of the previous level, Use when nesting: more layers of nesting are used to push in

<cn.leaqi.drawer.SwipeDrawer
    android:id="@+id/rootSwipe"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:mainLayout="@+id/mainDrawer">
    <RelativeLayout
        android:id="@+id/mainDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#FF0000">
        <cn.leaqi.drawer.SwipeDrawer
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:mainLayout="@+id/sonMainDrawer"
            app:parentDrawer="@+id/rootSwipe">
            <RelativeLayout
                android:id="@+id/sonMainDrawer"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#3F51B5" />
            ...
        </cn.leaqi.drawer.SwipeDrawer>
    </RelativeLayout>
    ...
</cn.leaqi.drawer.SwipeDrawer>


mainScroll

Specifies the sliding layout ID under the main layout: If the sub layout has a sliding layout and the sliding direction is consistent with , this attribute should be set to solve the problem of sliding priority

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:mainLayout="@+id/mainDrawer"
    app:mainScroll="@+id/mainScroll">
    <RelativeLayout
        android:id="@+id/mainDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ListView
            android:id="@+id/mainScroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </RelativeLayout>
    ...
</cn.leaqi.drawer.SwipeDrawer>


leftScroll

Specifies the sliding layout ID under the left layout: If the sub layout has a sliding layout and the sliding direction is consistent with , this attribute should be set to solve the problem of sliding priority

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:leftLayout="@+id/leftDrawer"
    app:leftScroll="@+id/leftScroll">
    <RelativeLayout
        android:id="@+id/leftDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <HorizontalScrollView
            android:id="@+id/leftScroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            ...
        </HorizontalScrollView>
    </RelativeLayout>
    ...
</cn.leaqi.drawer.SwipeDrawer>


topScroll

Specifies the sliding layout ID under the top layout: If the sub layout has a sliding layout and the sliding direction is consistent with , this attribute should be set to solve the problem of sliding priority

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:topLayout="@+id/topDrawer"
    app:topScroll="@+id/topScroll">
    <RelativeLayout
        android:id="@+id/topDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ScrollView
            android:id="@+id/topScroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            ...
        </ScrollView>
    </RelativeLayout>
    ...
</cn.leaqi.drawer.SwipeDrawer>


rightScroll

Specifies the sliding layout ID under the right layout: If the sub layout has a sliding layout and the sliding direction is consistent with , this attribute should be set to solve the problem of sliding priority

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:rightLayout="@+id/rightDrawer"
    app:rightScroll="@+id/rightScroll">
    <RelativeLayout
        android:id="@+id/rightDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <HorizontalScrollView
            android:id="@+id/rightScroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            ...
        </HorizontalScrollView>
    </RelativeLayout>
    ...
</cn.leaqi.drawer.SwipeDrawer>


bottomScroll

Specifies the sliding layout ID under the bottom layout: If the sub layout has a sliding layout and the sliding direction is consistent with , this attribute should be set to solve the problem of sliding priority

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:bottomLayout="@+id/bottomDrawer"
    app:bottomScroll="@+id/bottomScroll">
    <RelativeLayout
        android:id="@+id/bottomDrawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ScrollView
            android:id="@+id/bottomScroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            ...
        </ScrollView>
    </RelativeLayout>
    ...
</cn.leaqi.drawer.SwipeDrawer>


leftDragOpen

Left layout drag open: When set to , the left layout cannot be opened by dragging, However, closing is not subject to this restriction, Default value:

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:leftDragOpen="false">
    ...
</cn.leaqi.drawer.SwipeDrawer>


topDragOpen

Top layout drag open: When set to , the top layout cannot be opened by dragging, However, closing is not subject to this restriction, Default value:

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:topDragOpen="false">
    ...
</cn.leaqi.drawer.SwipeDrawer>


rightDragOpen

Right layout drag open: When set to , the right layout cannot be opened by dragging, However, closing is not subject to this restriction, Default value:

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:rightDragOpen="false">
    ...
</cn.leaqi.drawer.SwipeDrawer>


bottomDragOpen

Bottom layout drag open: When set to , the bottom layout cannot be opened by dragging, However, closing is not subject to this restriction, Default value:

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:bottomDragOpen="false">
    ...
</cn.leaqi.drawer.SwipeDrawer>


showLayout

Whether the layout of non current operation is hidden, Default value

The figure shows in fixed mode, 50% demonstration of overall layout transparency

  • : showView Preview
  • : hideView Preview


autoClose

Close other after opening: Set to , and other whose is will be closed after opening

  • : Auto offView Preview
  • : Default value, Multiple can be opened at the same timeView Preview


maskClose

Click the mask and close : Set to , and click the mask background after opening to close the current

  • : Click closeView Preview
  • : Default value, No operation


maskColor

Mask color: The default color is

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:mask="gradual"
    app:maskColor="#B3FF0000">
    ...
</cn.leaqi.drawer.SwipeDrawer>


dragClose

Allow drag close: AndDrag open is the same

If it is set to it cannot be closed by dragging, However, opening is not subject to this restriction, Default value:

<cn.leaqi.drawer.SwipeDrawer
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:dragClose="false">
    ...
</cn.leaqi.drawer.SwipeDrawer>


dragCloseTypeWarn:Minimum version required >= 1.4

Drag Close Type:Restrict the main layout, drawer layout, or global dragging closing, Default value:

  • :Whole LayoutView Preview
  • :Main LayoutView Preview
  • :Drawer LayoutView Preview


scrollOuterDrag

hether dragging is allowed outside the sliding layout: Whether the layout other than the sub sliding layout in all directions of the drawer layout can be closed by dragging, Default value:

  • : Under any circumstancesView Preview
  • : Only when the sub sliding layout reaches the top or cannot slide at all can it be allowedView Preview


autoLayoutWarn:Minimum version required >= 1.2

Layout Auto Update:Automatically update when the layout size changes, Default value:

  • :Auto Update
  • :No Auto Update


shrinkRange

Drag distance: View Preview

  • Drag direction height / width divided by , It will not be opened or closed until the drag reaches the distance, otherwise it will return to the original state
  • Default value: , Drag direction 1 / 5 of height / width
  • : Can drag, But it will not turn on or off


dragDampingWarn:When version >= 1.5, the value range is 0-99, the larger the value, the faster the speed

Drag dmping: 0-9View Preview

  • The smaller the value, the greater the dmping
  • Default value: , No dmping


dragRange

Edge drag: View Preview

  • Value type: , After setting, the dragging and pressing position must be the edge position of dip before dragging
  • Default value: , All bureau drag


leftDragRangeWarn:Minimum version required >= 1.5

Left edge drag: View Preview

  • Value type: , After setting, the dragging and pressing position must be the edge position of dip before dragging
  • Default value: , All bureau drag


topDragRangeWarn:Minimum version required >= 1.5

Top edge drag: View Preview

  • Value type: , After setting, the dragging and pressing position must be the edge position of dip before dragging
  • Default value: , All bureau drag


rightDragRangeWarn:Minimum version required >= 1.5

Right edge drag: View Preview

  • Value type: , After setting, the dragging and pressing position must be the edge position of dip before dragging
  • Default value: , All bureau drag


bottomDragRangeWarn:Minimum version required >= 1.5

Bottom edge drag: View Preview

  • Value type: , After setting, the dragging and pressing position must be the edge position of dip before dragging
  • Default value: , All bureau drag


leftOffsetWarn:Minimum version required >= 1.5

Left layout offset:View Preview

  • Value type:, Left layout offset outwarddip, Valid only inmode
  • Default value:px


topOffsetWarn:Minimum version required >= 1.5

Top layout offset:View Preview

  • Value type:, Top layout offset outwarddip, Valid only inmode
  • Default value:px


rightOffsetWarn:Minimum version required >= 1.5

Right layout offset:View Preview

  • Value type:, Right layout offset outwarddip, Valid only inmode
  • Default value:px


bottomOffsetWarn:Minimum version required >= 1.5

Bottom layout offset:View Preview

  • Value type:, Bottom layout offset outwarddip, Valid only inmode
  • Default value:px


dragSlopWarn:Minimum version required >= 1.1

Drag intercept distance:

  • Value type:, The event is intercepted only when the drag distance is greater thandip
  • Default value:px


turnCancelWarn:Minimum version required >= 1.6

Pull back to cancel operation:View Preview

  • Value type:, When the drag reaches the open or closed distance, the operation will be canceled after releasing when the drag back distance is greater than
  • Default value:px


maxDragSize

Maximum drag height / width: View Preview

  • Value type: , After setting, you can drag it to the distance set by
  • Default value: , Layout height / width


duration

Animation speed: View Preview

  • Value type:
  • Default value:


interpolator

Animation interpolator:

  • Slow down: View Preview
  • Uniform speed: View Preview
  • Pinball effect: View Preview
  • Default value: Accelerate first and then slow down


Call Interface

OnDrawerState

Listening start, move, start, close and cancel callback

final SwipeDrawer swipeDrawer = findViewById(R.id.swipeDrawer);
swipeDrawer.setOnDrawerState(new OnDrawerState() {
    @Override
    public void onStart(int type) {
        // Callback at drag start
        // type: Returns the direction of the current operation
    }
    @Override
    public void onMove(int type, float progress) {
        // Callback when dragging and moving
        // type: Returns the direction of the current operation
        // progress: Returns to open progress 0 - 1
    }
    @Override
    public void onOpen(int type) {
        // Callback on open
        // type: Returns the direction of the current operation
    }
    @Override
    public void onClose(int type) {
        // Callback on close
        // type: Returns the direction of the current operation
    }
    @Override
    public void onCancel(int type) {
        // Callback when dragging does not reach the opening or closing distance
        // type: Returns the direction of the current operation
    }
});


OnDrawerSwitch

Listening on / off callback

final SwipeDrawer swipeDrawer = findViewById(R.id.swipeDrawer);
swipeDrawer.setOnDrawerSwitch(new OnDrawerSwitch() {
    @Override
    public void onOpen(SwipeDrawer view) {
        // Callback on open
        // view: Returns SwipeDrawer of the current operation
    }
    @Override
    public void onClose(SwipeDrawer view) {
        // Callback on close
        // view: Returns SwipeDrawer of the current operation
    }
});


OnDrawerChange

Monitor changes and return various statuses by parameters

final SwipeDrawer swipeDrawer = findViewById(R.id.swipeDrawer);
swipeDrawer.setOnDrawerChange(new OnDrawerChange() {
    @Override
    public void onChange(SwipeDrawer view, int state, float progress) {
        // view: Returns SwipeDrawer of the current operation
        // state: Returns to current status
        // progress: Returns to open progress 0 - 1
        switch (state) {
            case SwipeDrawer.STATE_START:
                // Callback at drag start
                break;
            case SwipeDrawer.STATE_OPEN:
                // Callback on open
                break;
            case SwipeDrawer.STATE_CLOSE :
                // Callback on close
                break;
            case SwipeDrawer.STATE_PROGRESS :
                // Callback when dragging and moving, progress: Get progress
                break;
            case SwipeDrawer.STATE_ANIM_OVER:
                // Callback at the end of animation execution
                break;
            case SwipeDrawer.STATE_CALL_OPEN:
                // Callback when openDrawer method is called to open
                break;
            case SwipeDrawer.STATE_CALL_CLOSE:
                // Callback on closing by calling closeDrawer method
                break;
            case SwipeDrawer.STATE_CANCEL:
                // Callback when dragging does not reach the opening or closing distance
                break;
            case SwipeDrawer.STATE_DRAG_INTO:
                // Callback when drag exceeds shrinkRange distance
                break;
            case SwipeDrawer.STATE_DRAG_OUT:
                // Callback when the drag does not exceed the shrinkRange distance
                break;
        }
    }
});


Call method

openDrawer

Call open method

final SwipeDrawer swipeDrawer = findViewById(R.id.swipeDrawer);

// Open left direction
swipeDrawer.openDrawer(SwipeDrawer.DIRECTION_LEFT);

// Open top direction, Do not use animation
swipeDrawer.openDrawer(SwipeDrawer.DIRECTION_TOP, false);

// Open right direction, Use animation, Do not use callback interface
swipeDrawer.openDrawer(SwipeDrawer.DIRECTION_RIGHT, true, false);


closeDrawer

调用关闭方法

final SwipeDrawer swipeDrawer = findViewById(R.id.swipeDrawer);

// Turn off the opened direction
swipeDrawer.closeDrawer();

// Turn off the opened direction, Do not use animation
swipeDrawer.closeDrawer(false);

// Turn off the opened direction, Use animation, Do not use callback interface
swipeDrawer.closeDrawer(true, false);

// Close left direction
swipeDrawer.closeDrawer(SwipeDrawer.DIRECTION_LEFT);

// Close top direction, Do not use animation
swipeDrawer.closeDrawer(SwipeDrawer.DIRECTION_TOP, false);

// Close right direction, Use animation, Do not use callback interface
swipeDrawer.closeDrawer(SwipeDrawer.DIRECTION_RIGHT, true, false);


toggleDrawer

Call the open or close method

final SwipeDrawer swipeDrawer = findViewById(R.id.swipeDrawer);

// Open or close left direction
swipeDrawer.toggleDrawer(SwipeDrawer.DIRECTION_LEFT);

// Open or close top direction, Do not use animation
swipeDrawer.toggleDrawer(SwipeDrawer.DIRECTION_TOP, false);

// Open or close right direction, Use animation, Do not use callback interface
swipeDrawer.toggleDrawer(SwipeDrawer.DIRECTION_RIGHT, true, false);


setIntercept

Shield touch events

final SwipeDrawer swipeDrawer = findViewById(R.id.swipeDrawer);

// Shield touch events in all directions
swipeDrawer.setIntercept(false);

// Shield Top direction touch event
swipeDrawer.setIntercept(SwipeDrawer.DIRECTION_TOP, false);

// Shield Left direction touch event
final View leftLayout = findViewById(R.id.leftLayout);
swipeDrawer.setIntercept(leftLayout, false);


drawerLayoutWarn:Minimum version required >= 1.2

Update Layout

final SwipeDrawer swipeDrawer = findViewById(R.id.swipeDrawer);

// When autoLayout is closed, you can call this method to update the layout manually
swipeDrawer.drawerLayout();


Static method

setAllIntercept

Set to mask all touch events

// Mask all SwipeDrawer touch events
SwipeDrawer.setAllIntercept(true);

// Unshielded
SwipeDrawer.setAllIntercept(false);


getAllIntercept

Get whether the touch event is shielded

// Gets whether the touch event is masked
if (SwipeDrawer.getAllIntercept()) {
    // Shielded
} else {
    // No shielding
}


getParentDrawer

Get the parent of view

final View view = findViewById(R.id.view);
SwipeDrawer getSwipeDrawer = SwipeDrawer.getParentDrawer(view);
if (getSwipeDrawer != null) {
    // getSwipeDrawer is the parent of view
} else {
    // not found
}


Other

DrawerHolder

The class is used to save layouts with recycling mechanisms such as , when is not automatically closed

Use of DrawerHolder class: DrawerHolder drawerHolder = new DrawerHolder();

// drawerItem: Pass the SwipeDrawer layout of the item
// bindHolder: Pass unique object
drawerHolder.bindHolder(drawerItem, dataItem);

// Clear all saved data, And close the open SwipeDrawer
drawerHolder.clearHolder();

// Clear all saved data
drawerHolder.clear();
ListView Call example: private class ListAdapter extends ArrayAdapter<String> {
    private Context context;
    private List<String> list;
    private DrawerHolder drawerHolder = new DrawerHolder();
    ...
    @NonNull
    public View getView(int position, View convertView, @NonNull ViewGroup parent) {
        View view;
        ViewHolder viewHolder;
        if (convertView == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item, null);
            viewHolder = new ViewHolder();
            viewHolder.item = view.findViewById(R.id.item_drawer);
            view.setTag(viewHolder);
        } else {
            view = convertView;
            viewHolder = (ViewHolder) view.getTag();
        }
        // The first parameter of bindHolder is the SwipeDrawer layout of the item passed to SwipeDrawer
        // The second parameter of bindHolder passes a unique object for Object
        drawerHolder.bindHolder(viewHolder.item, list.get(position));
        return view;
    }
    ...
    private class ViewHolder {
        SwipeDrawer item;
    }
}
RecyclerView Call example: private class ListAdapter extends RecyclerView.Adapter<ListAdapter.ListViewHolder> {
    private Context context;
    private List<String> list;
    private DrawerHolder drawerHolder = new DrawerHolder();
    ...
    @NonNull
    @Override
    public ListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View addView = LayoutInflater.from(context).inflate(R.layout.item, null);
        return new ListViewHolder(addView);
    }
    @Override
    public void onBindViewHolder(@NonNull ListViewHolder holder, int position) {
        // The first parameter of bindHolder is the SwipeDrawer layout of the item passed to SwipeDrawer
        // The second parameter of bindHolder passes a unique object for Object
        drawerHolder.bindHolder(holder.item, list.get(position));
    }
    ...
    private class ListViewHolder extends RecyclerView.ViewHolder {
        SwipeDrawer item;
        private ListViewHolder(View view) {
            super(view);
            item = view.findViewById(R.id.item_drawer);;
        }
        ...
    }
}