Download manager fixed

now no need to long tap download button to download externally (select external downloader to download from external app)
This commit is contained in:
aayush262 2024-01-23 17:38:11 +05:30
parent 9fa422ebf3
commit 4218d81c49
3 changed files with 71 additions and 91 deletions

View file

@ -300,11 +300,16 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
extractor.server.name extractor.server.name
media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!.selectedVideo = media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!.selectedVideo =
position position
binding.urlDownload.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) if ((loadData<Int>("settings_download_manager") ?: 0) != 0) {
download(
requireActivity(),
media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!,
media!!.userPreferredName
)
} else {
val episode = media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!! val episode = media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!
val selectedVideo = val selectedVideo =
if (extractor.videos.size > episode.selectedVideo) extractor.videos[episode.selectedVideo] else null if (extractor.videos.size > episode.selectedVideo) extractor.videos[episode.selectedVideo] else null
val subtitles = extractor.subtitles val subtitles = extractor.subtitles
val subtitleNames = subtitles.map { it.language } val subtitleNames = subtitles.map { it.language }
var subtitleToDownload: Subtitle? = null var subtitleToDownload: Subtitle? = null
@ -372,25 +377,9 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
snackString("No Video Selected") snackString("No Video Selected")
} }
} }
}
dismiss() dismiss()
} }
binding.urlDownload.setOnLongClickListener {
binding.urlDownload.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
if ((loadData<Int>("settings_download_manager") ?: 0) != 0) {
media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!.selectedExtractor =
extractor.server.name
media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!.selectedVideo =
position
download(
requireActivity(),
media!!.anime!!.episodes!![media!!.anime!!.selectedEpisode!!]!!,
media!!.userPreferredName
)
} else {
snackString("No Download Manager Selected")
}
true
}
if (video.format == VideoType.CONTAINER) { if (video.format == VideoType.CONTAINER) {
binding.urlSize.visibility = if (video.size != null) View.VISIBLE else View.GONE binding.urlSize.visibility = if (video.size != null) View.VISIBLE else View.GONE
binding.urlSize.text = binding.urlSize.text =

View file

@ -719,14 +719,6 @@
app:iconPadding="16dp" app:iconPadding="16dp"
app:iconSize="24dp" /> app:iconSize="24dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:alpha="0.58"
android:fontFamily="@font/poppins_family"
android:text="@string/long_press_download"
android:textSize="14sp" />
<!--TODO: Add support for SD card--> <!--TODO: Add support for SD card-->
<com.google.android.material.materialswitch.MaterialSwitch <com.google.android.material.materialswitch.MaterialSwitch

View file

@ -647,7 +647,6 @@
<string name="app_widget_description">This is an app widget description</string> <string name="app_widget_description">This is an app widget description</string>
<string name="airing_image">Airing Image</string> <string name="airing_image">Airing Image</string>
<string name="anime_downloads">animeDownloads</string> <string name="anime_downloads">animeDownloads</string>
<string name="long_press_download">Long press the download button to download using the selected download manager</string>
<string name="purge_anime_downloads">Delete all anime downloads</string> <string name="purge_anime_downloads">Delete all anime downloads</string>
<string name="purge_manga_downloads">Delete all Manga Downloads</string> <string name="purge_manga_downloads">Delete all Manga Downloads</string>
<string name="purge_novel_downloads">Delete all Novel Downloads</string> <string name="purge_novel_downloads">Delete all Novel Downloads</string>