Some stuff

This commit is contained in:
Ziver Koc 2014-07-29 12:04:55 +02:00
parent 433f60dac7
commit de59e2e27f
8 changed files with 13 additions and 36 deletions

View file

@ -29,10 +29,6 @@ public class MainActivity extends FragmentActivity
private NavigationDrawerFragment navigationDrawerFragment;
private StatusFragment statusFragment;
/**
* Used to store the last screen title. For use in {@link #restoreActionBar()}.
*/
private CharSequence title;
private int currentExecutor;
private static ArrayList<UeControlExecutor> executors;
@ -46,7 +42,6 @@ public class MainActivity extends FragmentActivity
getFragmentManager().findFragmentById(R.id.navigation_drawer);
statusFragment = (StatusFragment)
getFragmentManager().findFragmentById(R.id.status_fragment);
title = getTitle();
// Set up the drawer.
navigationDrawerFragment.setUp(
@ -73,42 +68,24 @@ public class MainActivity extends FragmentActivity
currentExecutor = position;
}
public void onSectionAttached(int number) {
currentExecutor = number;
switch (number) {
case 1:
title = getString(R.string.title_section1);
break;
case 2:
title = getString(R.string.title_section2);
break;
case 3:
title = getString(R.string.title_section3);
break;
}
}
public void restoreActionBar() {
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setTitle(title);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (!navigationDrawerFragment.isDrawerOpen()) {
if (navigationDrawerFragment != null && !navigationDrawerFragment.isDrawerOpen()) {
// Only show items in the action bar relevant to this screen
// if the drawer is not showing. Otherwise, let the drawer
// decide what to show in the action bar.
getMenuInflater().inflate(R.menu.main, menu);
restoreActionBar();
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setDisplayShowTitleEnabled(true);
return true;
}
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will