diff --git a/app/src/main/java/com/github/libretube/helpers/ImportHelper.kt b/app/src/main/java/com/github/libretube/helpers/ImportHelper.kt index f6a1d2b32..3294ac40c 100644 --- a/app/src/main/java/com/github/libretube/helpers/ImportHelper.kt +++ b/app/src/main/java/com/github/libretube/helpers/ImportHelper.kt @@ -19,11 +19,11 @@ import com.github.libretube.obj.NewPipeSubscription import com.github.libretube.obj.NewPipeSubscriptions import com.github.libretube.obj.PipedImportPlaylist import com.github.libretube.obj.PipedImportPlaylistFile +import java.util.stream.Collectors import kotlin.streams.toList import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.decodeFromStream import kotlinx.serialization.json.encodeToStream -import java.util.stream.Collectors object ImportHelper { /** diff --git a/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt b/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt index 42452f6cc..079c7a2bb 100644 --- a/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt +++ b/app/src/main/java/com/github/libretube/ui/dialogs/AddToPlaylistDialog.kt @@ -62,7 +62,11 @@ class AddToPlaylistDialog( if (playlists.isEmpty()) return@repeatOnLifecycle binding.playlistsSpinner.adapter = - ArrayAdapter(requireContext(), R.layout.dropdown_item, playlists.map { it.name!! }) + ArrayAdapter( + requireContext(), + R.layout.dropdown_item, + playlists.map { it.name!! } + ) // select the last used playlist viewModel.lastSelectedPlaylistId?.let { id -> diff --git a/app/src/main/java/com/github/libretube/ui/extensions/TrySetTooltip.kt b/app/src/main/java/com/github/libretube/ui/extensions/TrySetTooltip.kt new file mode 100644 index 000000000..f5860cfe4 --- /dev/null +++ b/app/src/main/java/com/github/libretube/ui/extensions/TrySetTooltip.kt @@ -0,0 +1,15 @@ +package com.github.libretube.ui.extensions + +import android.os.Build +import android.widget.ImageView + +/** + * Attempts to set the tooltip for the ImageView. + * If the OS does not support tooltips, this function will have no effect. + * @param tooltip The tooltip of the image + */ +fun ImageView.trySetTooltip(tooltip: String) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + tooltipText = tooltip + } +} diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt index 4080717a4..01250cdbd 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt @@ -5,7 +5,6 @@ import android.app.Activity import android.content.Context import android.content.res.Configuration import android.graphics.Color -import android.os.Build import android.os.Handler import android.os.Looper import android.text.format.DateUtils @@ -50,6 +49,7 @@ import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.obj.BottomSheetItem import com.github.libretube.ui.base.BaseActivity import com.github.libretube.ui.extensions.toggleSystemBars +import com.github.libretube.ui.extensions.trySetTooltip import com.github.libretube.ui.interfaces.PlayerGestureOptions import com.github.libretube.ui.interfaces.PlayerOptions import com.github.libretube.ui.listeners.PlayerGestureController @@ -128,11 +128,15 @@ open class CustomExoPlayerView( // locking the player binding.lockPlayer.setOnClickListener { // change the locked/unlocked icon - val icon = if (!isPlayerLocked) R.drawable.ic_locked else R.drawable.ic_unlocked; - val tooltip = if (!isPlayerLocked) R.string.tooltip_unlocked else R.string.tooltip_locked; + val icon = if (!isPlayerLocked) R.drawable.ic_locked else R.drawable.ic_unlocked + val tooltip = if (!isPlayerLocked) { + R.string.tooltip_unlocked + } else { + R.string.tooltip_locked + } + binding.lockPlayer.setImageResource(icon) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - binding.lockPlayer.tooltipText = context.getString(tooltip) + binding.lockPlayer.trySetTooltip(context.getString(tooltip)) // show/hide all the controls lockPlayer(isPlayerLocked) diff --git a/app/src/main/res/layout-v26/queue_bottom_sheet.xml b/app/src/main/res/layout-v26/queue_bottom_sheet.xml deleted file mode 100644 index c739db968..000000000 --- a/app/src/main/res/layout-v26/queue_bottom_sheet.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/playback_bottom_sheet.xml b/app/src/main/res/layout/playback_bottom_sheet.xml index 1d6c3c50b..063ba4e2d 100644 --- a/app/src/main/res/layout/playback_bottom_sheet.xml +++ b/app/src/main/res/layout/playback_bottom_sheet.xml @@ -57,6 +57,7 @@