consistent ui

This commit is contained in:
Ashley Hughes 2014-02-08 16:18:30 +00:00
parent 5def251e62
commit 33f41e66a0

View File

@ -306,22 +306,19 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
} }
} }
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// show menu only on edit
if (mDataUri != null) {
return super.onPrepareOptionsMenu(menu);
} else {
return false;
}
}
@Override @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu); super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.key_edit, menu); getMenuInflater().inflate(R.menu.key_edit, menu);
mSaveButton = (MenuItem) menu.findItem(R.id.menu_key_edit_save); mSaveButton = (MenuItem) menu.findItem(R.id.menu_key_edit_save);
mSaveButton.setEnabled(needsSaving()); mSaveButton.setEnabled(needsSaving());
//totally get rid of some actions for new keys
if (mDataUri == null) {
MenuItem mButton = (MenuItem) menu.findItem(R.id.menu_key_edit_export_file);
mButton.setVisible(false);
mButton = (MenuItem) menu.findItem(R.id.menu_key_edit_delete);
mButton.setVisible(false);
}
return true; return true;
} }