diff --git a/app/src/main/java/com/deniscerri/ytdl/database/viewmodel/DownloadViewModel.kt b/app/src/main/java/com/deniscerri/ytdl/database/viewmodel/DownloadViewModel.kt index 971b8032..1fc9926e 100644 --- a/app/src/main/java/com/deniscerri/ytdl/database/viewmodel/DownloadViewModel.kt +++ b/app/src/main/java/com/deniscerri/ytdl/database/viewmodel/DownloadViewModel.kt @@ -937,7 +937,7 @@ class DownloadViewModel(private val application: Application) : AndroidViewModel }else { it.status = DownloadRepository.Status.Queued.toString() } - if (it.rowNumber == 0) { + if (it.rowNumber == 0 && items.size > 1) { it.rowNumber = idx + 1 } diff --git a/app/src/main/java/com/deniscerri/ytdl/ui/more/settings/FolderSettingsFragment.kt b/app/src/main/java/com/deniscerri/ytdl/ui/more/settings/FolderSettingsFragment.kt index ba44db3e..409bfeeb 100644 --- a/app/src/main/java/com/deniscerri/ytdl/ui/more/settings/FolderSettingsFragment.kt +++ b/app/src/main/java/com/deniscerri/ytdl/ui/more/settings/FolderSettingsFragment.kt @@ -190,7 +190,12 @@ class FolderSettingsFragment : BaseSettingsFragment() { } var cacheSize = File(FileUtil.getCachePath(requireContext())).walkBottomUp().fold(0L) { acc, file -> acc + file.length() } - clearCache!!.summary = "(${FileUtil.convertFileSize(cacheSize)}) ${resources.getString(R.string.clear_temporary_files_summary)}" + val filesize = if (cacheSize < 10000) { + "0B" + }else { + FileUtil.convertFileSize(cacheSize) + } + clearCache!!.summary = "(${filesize}) ${resources.getString(R.string.clear_temporary_files_summary)}" clearCache!!.onPreferenceClickListener = Preference.OnPreferenceClickListener { lifecycleScope.launch { @@ -214,7 +219,12 @@ class FolderSettingsFragment : BaseSettingsFragment() { Snackbar.make(requireView(), getString(R.string.cache_cleared), Snackbar.LENGTH_SHORT).show() cacheSize = File(FileUtil.getCachePath(requireContext())).walkBottomUp().fold(0L) { acc, file -> acc + file.length() } - clearCache!!.summary = "(${FileUtil.convertFileSize(cacheSize)}) ${resources.getString(R.string.clear_temporary_files_summary)}" + val filesize = if (cacheSize < 10000) { + "0B" + }else { + FileUtil.convertFileSize(cacheSize) + } + clearCache!!.summary = "(${filesize}) ${resources.getString(R.string.clear_temporary_files_summary)}" }else{ Snackbar.make(requireView(), getString(R.string.downloads_running_try_later), Snackbar.LENGTH_SHORT).show() } diff --git a/app/src/main/java/com/deniscerri/ytdl/util/Extensions.kt b/app/src/main/java/com/deniscerri/ytdl/util/Extensions.kt index 219f46a0..5f4b710e 100644 --- a/app/src/main/java/com/deniscerri/ytdl/util/Extensions.kt +++ b/app/src/main/java/com/deniscerri/ytdl/util/Extensions.kt @@ -320,7 +320,7 @@ object Extensions { Picasso.get() .load(imageURL) .resize(1280, 0) - .transform(BlurTransformation(context, 7, 1)) + .transform(BlurTransformation(context, 1, 1)) .onlyScaleDown() .into(this) diff --git a/app/src/main/java/com/deniscerri/ytdl/util/FormatUtil.kt b/app/src/main/java/com/deniscerri/ytdl/util/FormatUtil.kt index cabc016c..c00080dc 100644 --- a/app/src/main/java/com/deniscerri/ytdl/util/FormatUtil.kt +++ b/app/src/main/java/com/deniscerri/ytdl/util/FormatUtil.kt @@ -27,15 +27,15 @@ class FormatUtil(private var context: Context) { this.reverse() } - - private val preferSmallerFormats = sharedPreferences.getBoolean("prefer_smaller_formats", false) - @SuppressLint("RestrictedApi") fun getAudioFormatImportance() : List { + val preferredFormatSize = sharedPreferences.getString("preferred_format_size", "") + if (sharedPreferences.getBoolean("use_format_sorting", false)) { val itemValues = context.getStringArray(R.array.format_importance_audio_values).toMutableList() val orderPreferences = sharedPreferences.getString("format_importance_audio", itemValues.joinToString(","))!!.split(",").toMutableList() - if (preferSmallerFormats) { + + if (preferredFormatSize == "smallest") { orderPreferences.remove("file_size") orderPreferences.add(0,"smallsize") } @@ -47,10 +47,11 @@ class FormatUtil(private var context: Context) { return orderPreferences }else { - val formatImportance = mutableListOf("id","codec", "container", "language", "file_size") - if (sharedPreferences.getBoolean("prefer_smaller_formats", false)) { - formatImportance.add(0, "smallsize") - formatImportance.remove("file_size") + val formatImportance = mutableListOf("id","codec", "container", "language") + if (preferredFormatSize == "smallest") { + formatImportance.add("smallsize") + }else if (preferredFormatSize == "biggest") { + formatImportance.add("file_size") } val preferContainerOverCodec = sharedPreferences.getBoolean("prefer_container_over_codec_audio", false) @@ -64,20 +65,24 @@ class FormatUtil(private var context: Context) { @SuppressLint("RestrictedApi") fun getVideoFormatImportance() : List { + val preferredFormatSize = sharedPreferences.getString("preferred_format_size", "") + if (sharedPreferences.getBoolean("use_format_sorting", false)) { val itemValues = context.getStringArray(R.array.format_importance_video_values).toList() val orderPreferences = sharedPreferences.getString("format_importance_video", itemValues.joinToString(","))!!.split(",").toMutableList() - if (preferSmallerFormats) { + + if (preferredFormatSize == "smallest") { orderPreferences.remove("file_size") orderPreferences.add("smallsize") } return orderPreferences }else { - val formatImportance = mutableListOf("id","resolution", "codec", "container", "file_size") - if (sharedPreferences.getBoolean("prefer_smaller_formats", false)) { + val formatImportance = mutableListOf("id","resolution", "codec", "container") + if (preferredFormatSize == "smallest") { formatImportance.add("smallsize") - formatImportance.remove("file_size") + }else if (preferredFormatSize == "biggest") { + formatImportance.add("file_size") } return formatImportance @@ -101,9 +106,13 @@ class FormatUtil(private var context: Context) { result } "id" -> { - (audioFormatIDPreference.contains(b.format_id)).compareTo( - audioFormatIDPreference.contains(a.format_id) - ) + if (audioFormatIDPreference.isEmpty()) { + 0 + }else { + (audioFormatIDPreference.contains(b.format_id)).compareTo( + audioFormatIDPreference.contains(a.format_id) + ) + } } "language" -> { @@ -119,18 +128,27 @@ class FormatUtil(private var context: Context) { } "codec" -> { - ("^(${audioCodecPreference}).*$".toRegex(RegexOption.IGNORE_CASE) + if (audioCodecPreference.isBlank()) { + 0 + }else { + ("^(${audioCodecPreference}).*$".toRegex(RegexOption.IGNORE_CASE) .matches(b.acodec)) .compareTo( "^(${audioCodecPreference}).*$".toRegex(RegexOption.IGNORE_CASE) .matches(a.acodec) ) + } } "container" -> { - (audioContainerPreference == b.container).compareTo( - audioContainerPreference == a.container - ) + if (audioContainerPreference.isBlank()) { + 0 + }else { + (audioContainerPreference == b.container).compareTo( + audioContainerPreference == a.container + ) + } + } else -> 0 @@ -160,12 +178,20 @@ class FormatUtil(private var context: Context) { result } "id" -> { - videoFormatIDPreference.contains(b.format_id).compareTo(videoFormatIDPreference.contains(a.format_id)) + if (videoFormatIDPreference.isEmpty()) { + 0 + }else { + videoFormatIDPreference.contains(b.format_id).compareTo(videoFormatIDPreference.contains(a.format_id)) + } } "codec" -> { - val first = videoCodecPreference.toRegex(RegexOption.IGNORE_CASE).containsMatchIn(b.vcodec.uppercase()) - val second = videoCodecPreference.toRegex(RegexOption.IGNORE_CASE).containsMatchIn(a.vcodec.uppercase()) - first.compareTo(second) + if (videoCodecPreference.isBlank()) { + 0 + }else { + val first = videoCodecPreference.toRegex(RegexOption.IGNORE_CASE).containsMatchIn(b.vcodec.uppercase()) + val second = videoCodecPreference.toRegex(RegexOption.IGNORE_CASE).containsMatchIn(a.vcodec.uppercase()) + first.compareTo(second) + } } "resolution" -> { when (videoQualityPreference) { @@ -201,8 +227,12 @@ class FormatUtil(private var context: Context) { (b.acodec == "none" || b.acodec == "").compareTo(a.acodec == "none" || a.acodec == "") } "container" -> { - videoContainerPreference.equals(b.container, ignoreCase = true) - .compareTo(videoContainerPreference.equals(a.container, ignoreCase = true)) + if (videoContainerPreference.isBlank()) { + 0 + }else { + videoContainerPreference.equals(b.container, ignoreCase = true) + .compareTo(videoContainerPreference.equals(a.container, ignoreCase = true)) + } } else -> 0 } diff --git a/app/src/main/res/layout/active_download_card.xml b/app/src/main/res/layout/active_download_card.xml index 5ac74130..593704cc 100644 --- a/app/src/main/res/layout/active_download_card.xml +++ b/app/src/main/res/layout/active_download_card.xml @@ -18,7 +18,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" app:cardCornerRadius="20dp" - app:cardElevation="5dp" + app:cardElevation="0dp" android:checkable="true" app:strokeWidth="0dp" app:cardPreventCornerOverlap="true" @@ -126,7 +126,6 @@ android:maxLines="2" android:paddingStart="10dp" android:paddingEnd="5dp" - android:shadowColor="@color/black" android:shadowDx="2" android:shadowDy="2" android:shadowRadius="1" @@ -162,11 +161,10 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:animateLayoutChanges="true" - app:layout_constraintBottom_toTopOf="@+id/output" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="5dp" - app:layout_constraintTop_toBottomOf="@+id/linearlayout2_horizontalscrollview" - app:layout_constraintVertical_bias="0.51" + app:layout_constraintTop_toTopOf="parent" > + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/active_pause_cancel_btns" /> diff --git a/app/src/main/res/layout/adjust_audio.xml b/app/src/main/res/layout/adjust_audio.xml index a9088558..4e118a57 100644 --- a/app/src/main/res/layout/adjust_audio.xml +++ b/app/src/main/res/layout/adjust_audio.xml @@ -29,6 +29,7 @@ style="@style/Widget.Material3.Chip.Filter.Elevated" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:outlineProvider="none" android:checked="false" android:text="@string/embed_thumb"/> @@ -47,6 +48,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="false" + android:outlineProvider="none" android:text="@string/split_by_chapters"/> @@ -54,15 +56,15 @@ + android:layout_height="wrap_content" + android:scrollbars="none"> + app:singleLine="true"> - + @@ -130,6 +135,8 @@ android:layout_height="wrap_content" android:gravity="center" android:text="@string/use_extra_commands" + android:outlineProvider="none" + app:chipIconVisible="true" app:chipIcon="@drawable/ic_terminal" android:minWidth="30dp" @@ -145,6 +152,7 @@ android:layout_height="wrap_content" android:gravity="center" app:chipIconVisible="true" + android:outlineProvider="none" app:chipIcon="@drawable/ic_cut" android:text="@string/cut" android:minWidth="30dp" diff --git a/app/src/main/res/layout/adjust_video.xml b/app/src/main/res/layout/adjust_video.xml index 0d4f42a5..713e253b 100644 --- a/app/src/main/res/layout/adjust_video.xml +++ b/app/src/main/res/layout/adjust_video.xml @@ -31,6 +31,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="false" + android:outlineProvider="none" android:text="@string/save_thumb" /> @@ -76,6 +79,7 @@ app:chipIcon="@drawable/ic_subtitles" android:minWidth="30dp" app:cornerRadius="10dp" + android:outlineProvider="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -90,6 +94,7 @@ android:text="@string/remove_audio" android:visibility="gone" app:cornerRadius="10dp" + android:outlineProvider="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -105,6 +110,7 @@ app:chipIcon="@drawable/ic_music" android:minWidth="30dp" app:cornerRadius="10dp" + android:outlineProvider="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -116,6 +122,7 @@ android:layout_height="wrap_content" android:checked="false" app:chipIconVisible="true" + android:outlineProvider="none" app:chipIcon="@drawable/baseline_video_metadata" android:text="@string/recode_video" /> @@ -130,6 +137,7 @@ app:chipIcon="@drawable/baseline_live_tv_24" android:minWidth="30dp" app:cornerRadius="10dp" + android:outlineProvider="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -160,6 +168,7 @@ app:chipIcon="@drawable/ic_money" android:minWidth="30dp" app:cornerRadius="10dp" + android:outlineProvider="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -175,6 +184,7 @@ app:chipIcon="@drawable/ic_edit" android:minWidth="30dp" app:cornerRadius="10dp" + android:outlineProvider="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -204,6 +214,7 @@ app:chipIcon="@drawable/ic_terminal" android:minWidth="30dp" app:cornerRadius="10dp" + android:outlineProvider="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -219,6 +230,7 @@ android:minWidth="30dp" android:text="@string/cut" app:cornerRadius="10dp" + android:outlineProvider="none" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/cut_video_sheet.xml b/app/src/main/res/layout/cut_video_sheet.xml index fb99df7d..09303d3f 100644 --- a/app/src/main/res/layout/cut_video_sheet.xml +++ b/app/src/main/res/layout/cut_video_sheet.xml @@ -281,6 +281,7 @@ android:layout_marginEnd="10dp" android:layout_height="wrap_content" android:text="@string/cancel" + android:outlineProvider="none" app:icon="@drawable/ic_baseline_delete_outline_24"/>