Java Code Examples for androidx.drawerlayout.widget.DrawerLayout#LOCK_MODE_LOCKED_OPEN

The following examples show how to use androidx.drawerlayout.widget.DrawerLayout#LOCK_MODE_LOCKED_OPEN . 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: LockableDrawerLayout.java    From revolution-irc with GNU General Public License v3.0 6 votes vote down vote up
private void updateLockState() {
    if (isCurrentlyLocked()) {
        if (getDrawerLockMode(Gravity.START) == DrawerLayout.LOCK_MODE_LOCKED_OPEN)
            return;
        openDrawer(Gravity.START, false);
        setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN, GravityCompat.START);
        setScrimColor(Color.TRANSPARENT);
    } else {
        if (getDrawerLockMode(Gravity.START) == DrawerLayout.LOCK_MODE_UNLOCKED)
            return;
        closeDrawer(Gravity.START, false);
        setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, GravityCompat.START);
        setScrimColor(0x99000000);
    }
    requestLayout();
    Iterator<WeakReference<LockableStateListener>> iterator = mLockableListener.iterator();
    while (iterator.hasNext()) {
        LockableStateListener listener = iterator.next().get();
        if (listener != null)
            listener.onLockableStateChanged(isCurrentlyLocked());
        else
            iterator.remove();
    }
}
 
Example 2
Source File: DynamicDrawerActivity.java    From dynamic-support with Apache License 2.0 5 votes vote down vote up
/**
 * Checks whether the drawer is in the locked mode.
 *
 * @return {@code true} if the drawer is in the locked mode.
 */
public boolean isDrawerLocked() {
    return mDrawer.getDrawerLockMode(GravityCompat.START)
            == DrawerLayout.LOCK_MODE_LOCKED_OPEN
            || mDrawer.getDrawerLockMode(GravityCompat.END)
            == DrawerLayout.LOCK_MODE_LOCKED_OPEN;
}
 
Example 3
Source File: DynamicDrawerActivity.java    From dynamic-support with Apache License 2.0 3 votes vote down vote up
/**
 * Close the drawer if it is not in the locked state.
 *
 * @param gravity The gravity of the drawer to close it.
 *
 * @see DrawerLayout#LOCK_MODE_LOCKED_OPEN
 */
public void closeDrawer(int gravity) {
    if (mDrawer.isDrawerVisible(gravity) && mDrawer.getDrawerLockMode(gravity)
            != DrawerLayout.LOCK_MODE_LOCKED_OPEN) {
        mDrawer.closeDrawer(gravity);
    }
}