Java Code Examples for android.support.v4.widget.DrawerLayout#isDrawerOpen()

The following examples show how to use android.support.v4.widget.DrawerLayout#isDrawerOpen() . 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: Simulator.java    From BuildmLearn-Toolkit-Android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onBackPressed() {

    int count = getSupportFragmentManager().getBackStackEntryCount();
    if (count == 1) {
        finish();
    }
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer != null) {
        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
        } else {
            super.onBackPressed();
        }
    } else {
        super.onBackPressed();
    }
}
 
Example 2
Source File: MainActivity.java    From android-recycler-view-wrap-content with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 3
Source File: MainActivity.java    From TimeTable with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 4
Source File: MainActivity.java    From android-app with The Unlicense 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 5
Source File: MainActivity.java    From XMouse with MIT License 5 votes vote down vote up
@Override
public void onBackPressed() {
	DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
	if (drawer.isDrawerOpen(GravityCompat.START)) {
		drawer.closeDrawer(GravityCompat.START);
	} else {
		super.onBackPressed();
	}
}
 
Example 6
Source File: MainActivity.java    From Girls with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 7
Source File: MainActivity.java    From SystemUITuner2 with MIT License 5 votes vote down vote up
@Override
public void onBackPressed() { //the drawer is annoying to drag out, so let's open it on back press instead
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else if (!drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.openDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 8
Source File: MainActivity.java    From Learning-Resources with MIT License 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 9
Source File: MainActivity.java    From find-client-android with MIT License 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {

        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 10
Source File: Permission.java    From soundcom with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 11
Source File: MainActivity.java    From QuickNote with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 12
Source File: HomeActivity.java    From Hillffair17 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBackPressed(){
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 13
Source File: MainActivity.java    From Gank with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 14
Source File: MainActivity.java    From Xndroid with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 15
Source File: MainActivity.java    From AndroidUI with MIT License 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 16
Source File: MainActivity.java    From jus with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 17
Source File: MainActivity.java    From Travel-Mate with MIT License 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    if (drawer != null && drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 18
Source File: BaseActivity.java    From privacy-friendly-weather with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        super.onBackPressed();
    }
}
 
Example 19
Source File: MainActivity.java    From Android-POS with MIT License 4 votes vote down vote up
public void closeNavBar(){
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    }
}
 
Example 20
Source File: MainPresenter.java    From FastAccess with GNU General Public License v3.0 4 votes vote down vote up
@Override public boolean canBackPress(@NonNull DrawerLayout drawerLayout) {
    return !drawerLayout.isDrawerOpen(GravityCompat.START);
}