use of sugar.free.sightparser.applayer.descriptors.configuration_blocks.NameBlock in project SightRemote by TebbeUbben.
the class EditBRProfileActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
} else if (item.getItemId() == R.id.edit_br_nav_done) {
(confirmationDialog = new ConfirmationDialog(this, HTMLUtil.getHTML(R.string.edit_br_profile_confirmation), () -> {
showManualOverlay();
List<ConfigurationBlock> blocks = new ArrayList<>();
blocks.add(nameBlock);
profileBlock.setProfileBlocks(FixedSizeProfileBlock.convertToRelative(profileBlocks));
blocks.add(profileBlock);
WriteConfigurationTaskRunner taskRunner = new WriteConfigurationTaskRunner(getServiceConnector(), blocks);
showLoadingIndicator();
taskRunner.fetch(this);
})).show();
} else if (item.getItemId() == R.id.edit_br_nav_edit_name) {
EditText editName = new EditText(this);
editName.setInputType(InputType.TYPE_CLASS_TEXT);
editName.setFilters(new InputFilter[] { new InputFilter.LengthFilter(21) });
editName.setText(nameBlock.getName());
AlertDialog alertDialog = new AlertDialog.Builder(this).setTitle(R.string.edit_name).setMessage(R.string.leave_empty_for_default_value).setView(editName).setPositiveButton(R.string.okay, ((dialog, which) -> {
nameBlock.setName(editName.getText().toString());
adjustTitle();
})).setNegativeButton(R.string.cancel, null).create();
alertDialog.show();
}
return super.onOptionsItemSelected(item);
}
Aggregations