|
@@ -159,7 +159,7 @@ public class RenameFileDialogFragment
|
|
newFileName = binding.userInput.getText().toString().trim();
|
|
newFileName = binding.userInput.getText().toString().trim();
|
|
}
|
|
}
|
|
|
|
|
|
- String errorMessage = FileNameValidator.INSTANCE.isValid(newFileName, requireContext());
|
|
|
|
|
|
+ String errorMessage = FileNameValidator.INSTANCE.isValid(newFileName, requireContext(), null);
|
|
if (errorMessage != null) {
|
|
if (errorMessage != null) {
|
|
DisplayUtils.showSnackMessage(requireActivity(), errorMessage);
|
|
DisplayUtils.showSnackMessage(requireActivity(), errorMessage);
|
|
return;
|
|
return;
|
|
@@ -193,16 +193,13 @@ public class RenameFileDialogFragment
|
|
newFileName = binding.userInput.getText().toString().trim();
|
|
newFileName = binding.userInput.getText().toString().trim();
|
|
}
|
|
}
|
|
|
|
|
|
- String errorMessage = FileNameValidator.INSTANCE.isValid(newFileName, requireContext());
|
|
|
|
|
|
+ String errorMessage = FileNameValidator.INSTANCE.isValid(newFileName, requireContext(), fileNames);
|
|
|
|
|
|
- if (!TextUtils.isEmpty(newFileName) && newFileName.charAt(0) == '.') {
|
|
|
|
|
|
+ if (FileNameValidator.INSTANCE.isFileHidden(newFileName)) {
|
|
binding.userInputContainer.setError(getText(R.string.hidden_file_name_warning));
|
|
binding.userInputContainer.setError(getText(R.string.hidden_file_name_warning));
|
|
} else if (errorMessage != null) {
|
|
} else if (errorMessage != null) {
|
|
binding.userInputContainer.setError(errorMessage);
|
|
binding.userInputContainer.setError(errorMessage);
|
|
positiveButton.setEnabled(false);
|
|
positiveButton.setEnabled(false);
|
|
- } else if (fileNames.contains(newFileName)) {
|
|
|
|
- binding.userInputContainer.setError(getText(R.string.file_already_exists));
|
|
|
|
- positiveButton.setEnabled(false);
|
|
|
|
} else if (binding.userInputContainer.getError() != null) {
|
|
} else if (binding.userInputContainer.getError() != null) {
|
|
binding.userInputContainer.setError(null);
|
|
binding.userInputContainer.setError(null);
|
|
// Called to remove extra padding
|
|
// Called to remove extra padding
|