From 1afb9cdba93ebf6b744d26a1b13010ee2aded19e Mon Sep 17 00:00:00 2001 From: pratyaksh1610 Date: Sun, 4 Dec 2022 17:59:22 +0530 Subject: [PATCH] added Language suffix for subtitle downloads --- .../newpipe/download/DownloadDialog.java | 18 ++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 19 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java index 2975fe43a..c54fd5173 100644 --- a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java +++ b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java @@ -562,6 +562,24 @@ public class DownloadDialog extends DialogFragment selectedSubtitleIndex = position; break; } + onItemSelectedSetFileName(); + } + + private void onItemSelectedSetFileName() { + final String setSubtitleLanguageCode = subtitleStreamsAdapter.getItem(selectedSubtitleIndex) + .getLanguageTag(); + switch (dialogBinding.videoAudioGroup.getCheckedRadioButtonId()) { + case R.id.audio_button: + case R.id.video_button: + dialogBinding.fileName.setText(FilenameUtils.createFilename(getContext(), + currentInfo.getName())); + break; + case R.id.subtitle_button: + dialogBinding.fileName.setText(FilenameUtils.createFilename(getContext(), + currentInfo.getName() + getString( + R.string.caption_file_name, setSubtitleLanguageCode))); + break; + } } @Override diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3fa37155a..fefba2c77 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -452,6 +452,7 @@ Zoom Auto-generated + -%s Captions Modify player caption text scale and background styles. Requires app restart to take effect