Drawer nav method cleanup

This commit is contained in:
Dominik Schürmann 2014-09-06 16:36:58 +02:00
parent 30978384af
commit 59f32c4fca
6 changed files with 12 additions and 13 deletions

View File

@ -30,7 +30,7 @@ public class AppsListActivity extends DrawerActivity {
setContentView(R.layout.api_apps_list_activity);
setupDrawerNavigation(savedInstanceState);
activateDrawerNavigation(savedInstanceState);
}
}

View File

@ -67,7 +67,7 @@ public class DecryptActivity extends DrawerActivity {
initView();
setupDrawerNavigation(savedInstanceState);
activateDrawerNavigation(savedInstanceState);
// Handle intent actions, maybe changes the bundles
handleActions(getIntent());

View File

@ -56,7 +56,11 @@ public class DrawerActivity extends ActionBarActivity {
private static final int MENU_ID_PREFERENCE = 222;
private static final int MENU_ID_HELP = 223;
protected void setupDrawerNavigation(Bundle savedInstanceState) {
protected void deactivateDrawerNavigation() {
((DrawerLayout) findViewById(R.id.drawer_layout)).setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
protected void activateDrawerNavigation(Bundle savedInstanceState) {
mDrawerTitle = getString(R.string.app_name);
mDrawerLayout = (FixedDrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);

View File

@ -26,7 +26,6 @@ import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import android.support.v4.app.Fragment;
import android.support.v4.widget.DrawerLayout;
import android.view.Menu;
import android.view.MenuItem;
@ -428,10 +427,10 @@ public class EncryptFileActivity extends DrawerActivity implements EncryptActivi
// if called with an intent action, do not init drawer navigation
if (ACTION_ENCRYPT_FILE.equals(getIntent().getAction())) {
// lock drawer
((DrawerLayout) findViewById(R.id.drawer_layout)).setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
deactivateDrawerNavigation();
// TODO: back button to key?
} else {
setupDrawerNavigation(savedInstanceState);
activateDrawerNavigation(savedInstanceState);
}
// Handle intent actions

View File

@ -26,7 +26,6 @@ import android.os.Handler;
import android.os.Message;
import android.os.Messenger;
import android.support.v4.app.Fragment;
import android.support.v4.widget.DrawerLayout;
import android.view.Menu;
import android.view.MenuItem;
@ -396,10 +395,10 @@ public class EncryptTextActivity extends DrawerActivity implements EncryptActivi
// if called with an intent action, do not init drawer navigation
if (ACTION_ENCRYPT_TEXT.equals(getIntent().getAction())) {
// lock drawer
((DrawerLayout) findViewById(R.id.drawer_layout)).setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
deactivateDrawerNavigation();
// TODO: back button to key?
} else {
setupDrawerNavigation(savedInstanceState);
activateDrawerNavigation(savedInstanceState);
}
// Handle intent actions

View File

@ -19,15 +19,12 @@
package org.sufficientlysecure.keychain.ui;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.os.Messenger;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
@ -65,7 +62,7 @@ public class KeyListActivity extends DrawerActivity {
setContentView(R.layout.key_list_activity);
// now setup navigation drawer in DrawerActivity...
setupDrawerNavigation(savedInstanceState);
activateDrawerNavigation(savedInstanceState);
}
@Override