diff --git a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt index 9ac5fca43..67a7c92e7 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt @@ -9,7 +9,7 @@ import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.github.libretube.api.PlaylistsHelper import com.github.libretube.api.obj.StreamItem -import com.github.libretube.databinding.PlaylistRowBinding +import com.github.libretube.databinding.VideoRowBinding import com.github.libretube.enums.PlaylistType import com.github.libretube.extensions.TAG import com.github.libretube.extensions.toID @@ -43,17 +43,18 @@ class PlaylistAdapter( override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PlaylistViewHolder { val layoutInflater = LayoutInflater.from(parent.context) - val binding = PlaylistRowBinding.inflate(layoutInflater, parent, false) + val binding = VideoRowBinding.inflate(layoutInflater, parent, false) return PlaylistViewHolder(binding) } override fun onBindViewHolder(holder: PlaylistViewHolder, position: Int) { val streamItem = videoFeed[position] holder.binding.apply { - playlistTitle.text = streamItem.title - playlistDescription.text = streamItem.uploaderName + videoTitle.text = streamItem.title + videoInfo.text = streamItem.uploaderName + channelImage.visibility = View.GONE thumbnailDuration.setFormattedDuration(streamItem.duration!!) - ImageHelper.loadImage(streamItem.thumbnail, playlistThumbnail) + ImageHelper.loadImage(streamItem.thumbnail, thumbnail) root.setOnClickListener { NavigationHelper.navigateVideo(root.context, streamItem.url, playlistId) } @@ -68,9 +69,13 @@ class PlaylistAdapter( true } + channelContainer.setOnClickListener { + streamItem.url?.toID()?.let { NavigationHelper.navigateChannel(root.context, it) } + } + if (playlistType != PlaylistType.PUBLIC) { - deletePlaylist.visibility = View.VISIBLE - deletePlaylist.setOnClickListener { + deleteVideo.visibility = View.VISIBLE + deleteVideo.setOnClickListener { removeFromPlaylist(root.context, position) } } diff --git a/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt index 04ca8ba02..c329996a2 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/WatchHistoryAdapter.kt @@ -1,9 +1,10 @@ package com.github.libretube.ui.adapters import android.view.LayoutInflater +import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView -import com.github.libretube.databinding.WatchHistoryRowBinding +import com.github.libretube.databinding.VideoRowBinding import com.github.libretube.db.DatabaseHolder import com.github.libretube.db.obj.WatchHistoryItem import com.github.libretube.extensions.query @@ -32,7 +33,7 @@ class WatchHistoryAdapter( override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WatchHistoryViewHolder { val layoutInflater = LayoutInflater.from(parent.context) - val binding = WatchHistoryRowBinding.inflate(layoutInflater, parent, false) + val binding = VideoRowBinding.inflate(layoutInflater, parent, false) return WatchHistoryViewHolder(binding) } @@ -50,7 +51,8 @@ class WatchHistoryAdapter( NavigationHelper.navigateChannel(root.context, video.uploaderUrl) } - deleteBTN.setOnClickListener { + deleteVideo.visibility = View.VISIBLE + deleteVideo.setOnClickListener { removeFromWatchHistory(position) } diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistViewHolder.kt index 4d7f50a00..dab3945d1 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/PlaylistViewHolder.kt @@ -1,8 +1,8 @@ package com.github.libretube.ui.viewholders import androidx.recyclerview.widget.RecyclerView -import com.github.libretube.databinding.PlaylistRowBinding +import com.github.libretube.databinding.VideoRowBinding class PlaylistViewHolder( - val binding: PlaylistRowBinding + val binding: VideoRowBinding ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/java/com/github/libretube/ui/viewholders/WatchHistoryViewHolder.kt b/app/src/main/java/com/github/libretube/ui/viewholders/WatchHistoryViewHolder.kt index d73390195..e2c48cfaa 100644 --- a/app/src/main/java/com/github/libretube/ui/viewholders/WatchHistoryViewHolder.kt +++ b/app/src/main/java/com/github/libretube/ui/viewholders/WatchHistoryViewHolder.kt @@ -1,8 +1,8 @@ package com.github.libretube.ui.viewholders import androidx.recyclerview.widget.RecyclerView -import com.github.libretube.databinding.WatchHistoryRowBinding +import com.github.libretube.databinding.VideoRowBinding class WatchHistoryViewHolder( - val binding: WatchHistoryRowBinding + val binding: VideoRowBinding ) : RecyclerView.ViewHolder(binding.root) diff --git a/app/src/main/res/layout/playlist_row.xml b/app/src/main/res/layout/playlist_row.xml deleted file mode 100644 index 478936c35..000000000 --- a/app/src/main/res/layout/playlist_row.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/video_row.xml b/app/src/main/res/layout/video_row.xml index 5a8fe277b..165098b27 100644 --- a/app/src/main/res/layout/video_row.xml +++ b/app/src/main/res/layout/video_row.xml @@ -74,7 +74,7 @@ android:layout_marginStart="8dp" android:ellipsize="end" android:maxLines="2" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toStartOf="@id/delete_video" app:layout_constraintStart_toEndOf="@id/thumbnail_card" app:layout_constraintTop_toTopOf="parent" /> @@ -116,4 +116,16 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/watch_history_row.xml b/app/src/main/res/layout/watch_history_row.xml deleted file mode 100644 index 423c1023f..000000000 --- a/app/src/main/res/layout/watch_history_row.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file