mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
use better tags
This commit is contained in:
parent
71fcfc075f
commit
57b3053b58
@ -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!!)
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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!!)
|
||||
|
@ -51,7 +51,7 @@ class WatchHistoryAdapter(
|
||||
}
|
||||
root.setOnLongClickListener {
|
||||
VideoOptionsDialog(video.videoId!!)
|
||||
.show(childFragmentManager, "VideoOptionsDialog")
|
||||
.show(childFragmentManager, VideoOptionsDialog::class.java.name)
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
package com.github.libretube.extensions
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
||||
class BaseActivity: AppCompatActivity() {
|
||||
}
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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(
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user