|
@@ -289,7 +289,7 @@ public class FileActivity extends AppCompatActivity
|
|
// Sync the toggle state after onRestoreInstanceState has occurred.
|
|
// Sync the toggle state after onRestoreInstanceState has occurred.
|
|
if (mDrawerToggle != null) {
|
|
if (mDrawerToggle != null) {
|
|
mDrawerToggle.syncState();
|
|
mDrawerToggle.syncState();
|
|
- if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
|
|
|
|
|
|
+ if (isDrawerOpen()) {
|
|
getSupportActionBar().setTitle(R.string.app_name);
|
|
getSupportActionBar().setTitle(R.string.app_name);
|
|
mDrawerToggle.setDrawerIndicatorEnabled(true);
|
|
mDrawerToggle.setDrawerIndicatorEnabled(true);
|
|
}
|
|
}
|
|
@@ -304,6 +304,23 @@ public class FileActivity extends AppCompatActivity
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void onBackPressed() {
|
|
|
|
+ if (isDrawerOpen()) {
|
|
|
|
+ closeNavDrawer();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ super.onBackPressed();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isDrawerOpen() {
|
|
|
|
+ return mDrawerLayout.isDrawerOpen(GravityCompat.START);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void closeNavDrawer() {
|
|
|
|
+ mDrawerLayout.closeDrawer(GravityCompat.START);
|
|
|
|
+ }
|
|
|
|
+
|
|
protected void initDrawer(){
|
|
protected void initDrawer(){
|
|
// constant settings for action bar when navigation drawer is inited
|
|
// constant settings for action bar when navigation drawer is inited
|
|
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
|
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|