| 1 |
|
| 2 |
@Override |
| 3 |
public boolean onCreateOptionsMenu(Menu menu) { |
| 4 |
if (!mNavigationDrawerFragment.isDrawerOpen()) { |
| 5 |
// Only show items in the action bar relevant to this screen |
| 6 |
// if the drawer is not showing. Otherwise, let the drawer |
| 7 |
// decide what to show in the action bar. |
| 8 |
getMenuInflater().inflate(R.menu.${menuName}, menu); |
| 9 |
restoreActionBar(); |
| 10 |
return true; |
| 11 |
} |
| 12 |
return super.onCreateOptionsMenu(menu); |
| 13 |
} |
| 14 |
|
| 15 |
@Override |
| 16 |
public boolean onOptionsItemSelected(MenuItem item) { |
| 17 |
// Handle action bar item clicks here. The action bar will |
| 18 |
// automatically handle clicks on the Home/Up button, so long |
| 19 |
// as you specify a parent activity in AndroidManifest.xml. |
| 20 |
int id = item.getItemId(); |
| 21 |
|
| 22 |
//noinspection SimplifiableIfStatement |
| 23 |
if (id == R.id.action_settings) { |
| 24 |
return true; |
| 25 |
} |
| 26 |
|
| 27 |
return super.onOptionsItemSelected(item); |
| 28 |
} |