use better tags

This commit is contained in:
Bnyro 2022-08-08 11:38:50 +02:00
parent 71fcfc075f
commit 57b3053b58
18 changed files with 33 additions and 29 deletions

View File

@ -52,7 +52,7 @@ class ChannelAdapter(
val videoId = trending.url.toID()
root.setOnLongClickListener {
VideoOptionsDialog(videoId)
.show(childFragmentManager, "VideoOptionsDialog")
.show(childFragmentManager, VideoOptionsDialog::class.java.name)
true
}
watchProgress.setWatchProgressLength(videoId, trending.duration!!)

View File

@ -61,7 +61,7 @@ class PlaylistAdapter(
val videoId = streamItem.url.toID()
root.setOnLongClickListener {
VideoOptionsDialog(videoId)
.show(childFragmentManager, "VideoOptionsDialog")
.show(childFragmentManager, VideoOptionsDialog::class.java.name)
true
}

View File

@ -48,7 +48,6 @@ class PlaylistsAdapter(
val playlist = playlists[position]
holder.binding.apply {
// set imageview drawable as empty playlist if imageview empty
Log.e(TAG, playlist.thumbnail.toString())
if (playlist.thumbnail!!.split("/").size <= 4) {
playlistThumbnail.setImageResource(R.drawable.ic_empty_playlist)
playlistThumbnail.setBackgroundColor(R.attr.colorSurface)

View File

@ -103,7 +103,7 @@ class SearchAdapter(
val videoId = item.url.toID()
root.setOnLongClickListener {
VideoOptionsDialog(videoId)
.show(childFragmentManager, "VideoOptionsDialog")
.show(childFragmentManager, VideoOptionsDialog::class.java.name)
true
}
channelImage.setOnClickListener {
@ -176,7 +176,7 @@ class SearchAdapter(
root.setOnLongClickListener {
val playlistId = item.url!!.toID()
PlaylistOptionsDialog(playlistId, false)
.show(childFragmentManager, "PlaylistOptionsDialog")
.show(childFragmentManager, PlaylistOptionsDialog::class.java.name)
true
}
}

View File

@ -66,7 +66,7 @@ class TrendingAdapter(
val videoId = trending.url!!.toID()
root.setOnLongClickListener {
VideoOptionsDialog(videoId)
.show(childFragmentManager, "VideoOptionsDialog")
.show(childFragmentManager, VideoOptionsDialog::class.java.name)
true
}
watchProgress.setWatchProgressLength(videoId, trending.duration!!)

View File

@ -51,7 +51,7 @@ class WatchHistoryAdapter(
}
root.setOnLongClickListener {
VideoOptionsDialog(video.videoId!!)
.show(childFragmentManager, "VideoOptionsDialog")
.show(childFragmentManager, VideoOptionsDialog::class.java.name)
true
}

View File

@ -57,7 +57,7 @@ class DeleteAccountDialog : DialogFragment() {
Toast.makeText(context, R.string.success, Toast.LENGTH_SHORT).show()
logout()
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
restartDialog.show(childFragmentManager, RequireRestartDialog::class.java.name)
}
}
run()

View File

@ -81,7 +81,7 @@ class PlaylistOptionsDialog(
context?.getString(R.string.share) -> {
val shareDialog = ShareDialog(playlistId, true)
// using parentFragmentManager, childFragmentManager doesn't work here
shareDialog.show(parentFragmentManager, "ShareDialog")
shareDialog.show(parentFragmentManager, ShareDialog::class.java.name)
}
context?.getString(R.string.deletePlaylist) -> {
val token = PreferenceHelper.getToken()

View File

@ -55,7 +55,7 @@ class VideoOptionsDialog(
val bundle = Bundle()
bundle.putString("videoId", videoId)
newFragment.arguments = bundle
newFragment.show(parentFragmentManager, "AddToPlaylist")
newFragment.show(parentFragmentManager, AddToPlaylistDialog::class.java.name)
} else {
Toast.makeText(context, R.string.login_first, Toast.LENGTH_SHORT).show()
}
@ -63,7 +63,7 @@ class VideoOptionsDialog(
context?.getString(R.string.share) -> {
val shareDialog = ShareDialog(videoId, false)
// using parentFragmentManager is important here
shareDialog.show(parentFragmentManager, "ShareDialog")
shareDialog.show(parentFragmentManager, ShareDialog::class.java.name)
}
}
}

View File

@ -0,0 +1,6 @@
package com.github.libretube.extensions
import androidx.appcompat.app.AppCompatActivity
class BaseActivity: AppCompatActivity() {
}

View File

@ -68,7 +68,7 @@ class LibraryFragment : Fragment() {
}
binding.createPlaylist.setOnClickListener {
val newFragment = CreatePlaylistDialog()
newFragment.show(childFragmentManager, "Create Playlist")
newFragment.show(childFragmentManager, CreatePlaylistDialog::class.java.name)
}
} else {
binding.playlistRefresh.isEnabled = false

View File

@ -523,7 +523,7 @@ class PlayerFragment : Fragment() {
// share button
binding.relPlayerShare.setOnClickListener {
val shareDialog = ShareDialog(videoId!!, false, exoPlayer.currentPosition)
shareDialog.show(childFragmentManager, "ShareDialog")
shareDialog.show(childFragmentManager, ShareDialog::class.java.name)
}
binding.relPlayerBackground.setOnClickListener {
@ -979,7 +979,7 @@ class PlayerFragment : Fragment() {
val bundle = Bundle()
bundle.putString("video_id", videoId)
newFragment.arguments = bundle
newFragment.show(childFragmentManager, "DownloadDialog")
newFragment.show(childFragmentManager, DownloadDialog::class.java.name)
} else {
Toast.makeText(context, R.string.dlisinprogress, Toast.LENGTH_SHORT)
.show()
@ -1045,7 +1045,7 @@ class PlayerFragment : Fragment() {
val bundle = Bundle()
bundle.putString("videoId", videoId)
newFragment.arguments = bundle
newFragment.show(childFragmentManager, "AddToPlaylist")
newFragment.show(childFragmentManager, AddToPlaylistDialog::class.java.name)
}
} else {
binding.relPlayerSave.setOnClickListener {

View File

@ -87,7 +87,7 @@ class PlaylistFragment : Fragment() {
binding.optionsMenu.setOnClickListener {
val optionsDialog =
PlaylistOptionsDialog(playlistId!!, isOwner)
optionsDialog.show(childFragmentManager, "PlaylistOptionsDialog")
optionsDialog.show(childFragmentManager, PlaylistOptionsDialog::class.java.name)
}
playlistAdapter = PlaylistAdapter(

View File

@ -26,14 +26,14 @@ class AppearanceSettings : MaterialPreferenceFragment() {
val themeToggle = findPreference<ListPreference>(PreferenceKeys.THEME_MODE)
themeToggle?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
restartDialog.show(childFragmentManager, RequireRestartDialog::class.java.name)
true
}
val pureTheme = findPreference<SwitchPreferenceCompat>(PreferenceKeys.PURE_THEME)
pureTheme?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
restartDialog.show(childFragmentManager, RequireRestartDialog::class.java.name)
true
}
@ -41,7 +41,7 @@ class AppearanceSettings : MaterialPreferenceFragment() {
updateAccentColorValues(accentColor!!)
accentColor.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
restartDialog.show(childFragmentManager, RequireRestartDialog::class.java.name)
true
}
@ -54,7 +54,7 @@ class AppearanceSettings : MaterialPreferenceFragment() {
val labelVisibilityMode = findPreference<ListPreference>(PreferenceKeys.LABEL_VISIBILITY)
labelVisibilityMode?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
restartDialog.show(childFragmentManager, RequireRestartDialog::class.java.name)
true
}

View File

@ -20,21 +20,21 @@ class GeneralSettings : MaterialPreferenceFragment() {
val language = findPreference<ListPreference>("language")
language?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
restartDialog.show(childFragmentManager, RequireRestartDialog::class.java.name)
true
}
val autoRotation = findPreference<SwitchPreferenceCompat>(PreferenceKeys.AUTO_ROTATION)
autoRotation?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
restartDialog.show(childFragmentManager, RequireRestartDialog::class.java.name)
true
}
val hideTrending = findPreference<SwitchPreferenceCompat>(PreferenceKeys.HIDE_TRENDING_PAGE)
hideTrending?.setOnPreferenceChangeListener { _, _ ->
val restartDialog = RequireRestartDialog()
restartDialog.show(childFragmentManager, "RequireRestartDialog")
restartDialog.show(childFragmentManager, RequireRestartDialog::class.java.name)
true
}
}

View File

@ -99,7 +99,7 @@ class InstanceSettings : MaterialPreferenceFragment() {
val customInstance = findPreference<Preference>(PreferenceKeys.CUSTOM_INSTANCE)
customInstance?.setOnPreferenceClickListener {
val newFragment = CustomInstanceDialog()
newFragment.show(childFragmentManager, "CustomInstanceDialog")
newFragment.show(childFragmentManager, CustomInstanceDialog::class.java.name)
true
}
@ -117,10 +117,10 @@ class InstanceSettings : MaterialPreferenceFragment() {
login?.setOnPreferenceClickListener {
if (token == "") {
val newFragment = LoginDialog()
newFragment.show(childFragmentManager, "Login")
newFragment.show(childFragmentManager, LoginDialog::class.java.name)
} else {
val newFragment = LogoutDialog()
newFragment.show(childFragmentManager, "Logout")
newFragment.show(childFragmentManager, LogoutDialog::class.java.name)
}
true
@ -131,7 +131,7 @@ class InstanceSettings : MaterialPreferenceFragment() {
val token = PreferenceHelper.getToken()
if (token != "") {
val newFragment = DeleteAccountDialog()
newFragment.show(childFragmentManager, "DeleteAccountDialog")
newFragment.show(childFragmentManager, DeleteAccountDialog::class.java.name)
} else {
Toast.makeText(context, R.string.login_first, Toast.LENGTH_SHORT).show()
}

View File

@ -101,7 +101,7 @@ class MainSettings : MaterialPreferenceFragment() {
} else if (BuildConfig.VERSION_NAME != updateInfo.name) {
// show the UpdateAvailableDialog if there's an update available
val updateAvailableDialog = UpdateDialog(updateInfo)
updateAvailableDialog.show(childFragmentManager, "UpdateAvailableDialog")
updateAvailableDialog.show(childFragmentManager, UpdateDialog::class.java.name)
} else {
// otherwise show the no update available snackBar
val settingsActivity = activity as SettingsActivity

View File

@ -205,7 +205,6 @@ class BackgroundMode : Service() {
nextStreamId = streams?.relatedStreams!![0].url.toID()
}
return
if (playlistId == null) return
if (!this::autoPlayHelper.isInitialized) autoPlayHelper = AutoPlayHelper(playlistId!!)
// search for the next videoId in the playlist