|
@@ -217,9 +217,18 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
|
|
@Override
|
|
@Override
|
|
public void onClick(Template template) {
|
|
public void onClick(Template template) {
|
|
adapter.setTemplateAsActive(template);
|
|
adapter.setTemplateAsActive(template);
|
|
|
|
+ prefillFilenameIfEmpty(template);
|
|
checkEnablingCreateButton();
|
|
checkEnablingCreateButton();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void prefillFilenameIfEmpty(Template template) {
|
|
|
|
+ String name = binding.filename.getText().toString();
|
|
|
|
+ if (name.isEmpty() || name.equalsIgnoreCase(DOT + template.getExtension())) {
|
|
|
|
+ binding.filename.setText(String.format("%s.%s", template.title, template.extension));
|
|
|
|
+ }
|
|
|
|
+ binding.filename.setSelection(binding.filename.getText().toString().lastIndexOf('.'));
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void onClick(View v) {
|
|
public void onClick(View v) {
|
|
String name = binding.filename.getText().toString();
|
|
String name = binding.filename.getText().toString();
|