mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
add auto pre-filling of file name upon template chosen
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
299248766c
commit
64ad49163f
1 changed files with 9 additions and 0 deletions
|
@ -217,9 +217,18 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
|
|||
@Override
|
||||
public void onClick(Template template) {
|
||||
adapter.setTemplateAsActive(template);
|
||||
prefillFilenameIfEmpty(template);
|
||||
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
|
||||
public void onClick(View v) {
|
||||
String name = binding.filename.getText().toString();
|
||||
|
|
Loading…
Reference in a new issue