From 1700bbfe0d93450cde2a2ad881ad136184772fe0 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 6 Dec 2022 12:08:12 +0100 Subject: [PATCH] Toast when no download source selected --- .../java/com/github/libretube/ui/adapters/VideosAdapter.kt | 2 +- .../java/com/github/libretube/ui/dialogs/DownloadDialog.kt | 5 ++++- .../com/github/libretube/ui/fragments/PlaylistFragment.kt | 2 +- .../github/libretube/ui/preferences/AppearanceSettings.kt | 2 -- app/src/main/res/values/strings.xml | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt index 5b009b8d2..f404fdd72 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/VideosAdapter.kt @@ -17,8 +17,8 @@ import com.github.libretube.databinding.AllCaughtUpRowBinding import com.github.libretube.databinding.TrendingRowBinding import com.github.libretube.databinding.VideoRowBinding import com.github.libretube.extensions.formatShort -import com.github.libretube.extensions.toPixel import com.github.libretube.extensions.toID +import com.github.libretube.extensions.toPixel import com.github.libretube.ui.base.BaseActivity import com.github.libretube.ui.extensions.setFormattedDuration import com.github.libretube.ui.extensions.setWatchProgressLength diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt index 6169c1c81..74c507505 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt @@ -132,7 +132,10 @@ class DownloadDialog( val vidUrl = videoUrl[binding.videoSpinner.selectedItemPosition] val audUrl = audioUrl[binding.audioSpinner.selectedItemPosition] - if (audUrl == "" && vidUrl == "") return@setOnClickListener + if (audUrl == "" && vidUrl == "") { + Toast.makeText(context, R.string.nothing_selected, Toast.LENGTH_SHORT).show() + return@setOnClickListener + } val fileName = binding.fileName.text.toString().sanitize() diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt index cb98de13a..2df77a88d 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlaylistFragment.kt @@ -23,8 +23,8 @@ import com.github.libretube.enums.PlaylistType import com.github.libretube.extensions.TAG import com.github.libretube.extensions.awaitQuery import com.github.libretube.extensions.query -import com.github.libretube.extensions.toPixel import com.github.libretube.extensions.toID +import com.github.libretube.extensions.toPixel import com.github.libretube.ui.adapters.PlaylistAdapter import com.github.libretube.ui.base.BaseFragment import com.github.libretube.ui.extensions.serializable diff --git a/app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt index 92ef4b7cc..0cac9ea62 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/AppearanceSettings.kt @@ -5,7 +5,6 @@ import android.os.Bundle import androidx.preference.ListPreference import androidx.preference.Preference import androidx.preference.SwitchPreferenceCompat -import com.github.libretube.BuildConfig import com.github.libretube.R import com.github.libretube.constants.PreferenceKeys import com.github.libretube.ui.adapters.IconsSheetAdapter @@ -14,7 +13,6 @@ import com.github.libretube.ui.dialogs.NavBarOptionsDialog import com.github.libretube.ui.dialogs.RequireRestartDialog import com.github.libretube.ui.sheets.IconsBottomSheet import com.github.libretube.util.PreferenceHelper -import com.google.android.material.color.DynamicColors class AppearanceSettings : BasePreferenceFragment() { override val titleResourceId: Int = R.string.appearance diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index adbe50fbc..8f566d40c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -415,6 +415,7 @@ Proceed with an e-mail address that isn\'t recommended\? Proceed Play latest videos + Nothing selected! Download Service