diff --git a/app/src/main/java/net/schueller/peertube/activity/PlaylistActivity.kt b/app/src/main/java/net/schueller/peertube/activity/PlaylistActivity.kt
index 646b37b..30b364a 100644
--- a/app/src/main/java/net/schueller/peertube/activity/PlaylistActivity.kt
+++ b/app/src/main/java/net/schueller/peertube/activity/PlaylistActivity.kt
@@ -18,12 +18,13 @@ package net.schueller.peertube.activity
import android.app.AlertDialog
import android.content.DialogInterface
+import android.content.Intent
import android.os.Bundle
-import android.widget.Toast
import androidx.activity.viewModels
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.RecyclerView
import net.schueller.peertube.R
+import net.schueller.peertube.adapter.MultiViewRecyclerViewHolder
import net.schueller.peertube.adapter.PlaylistAdapter
import net.schueller.peertube.database.Video
import net.schueller.peertube.database.VideoViewModel
@@ -58,7 +59,9 @@ class PlaylistActivity : CommonActivity() {
}
private fun onVideoClick(video: Video) {
- Toast.makeText(this, "Clicked", Toast.LENGTH_SHORT).show()
+ val intent = Intent(this, VideoPlayActivity::class.java)
+ intent.putExtra(MultiViewRecyclerViewHolder.EXTRA_VIDEOID, video.videoUUID)
+ startActivity(intent)
}
private fun showServers() {
@@ -75,8 +78,8 @@ class PlaylistActivity : CommonActivity() {
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
AlertDialog.Builder(this@PlaylistActivity)
- .setTitle("Remove Video")
- .setMessage("Are you sure you want to remove this video from playlist?")
+ .setTitle(getString(R.string.remove_video))
+ .setMessage(getString(R.string.remove_video_warning_message))
.setPositiveButton(android.R.string.ok) { _: DialogInterface?, _: Int ->
val position = viewHolder.bindingAdapterPosition
val video = adapter.getVideoAtPosition(position)
diff --git a/app/src/main/java/net/schueller/peertube/adapter/MultiViewRecyclerViewHolder.kt b/app/src/main/java/net/schueller/peertube/adapter/MultiViewRecyclerViewHolder.kt
index af85876..1631698 100644
--- a/app/src/main/java/net/schueller/peertube/adapter/MultiViewRecyclerViewHolder.kt
+++ b/app/src/main/java/net/schueller/peertube/adapter/MultiViewRecyclerViewHolder.kt
@@ -136,7 +136,7 @@ sealed class MultiViewRecyclerViewHolder(binding: ViewBinding) : RecyclerView.Vi
// Add to playlist
binding.videoAddToPlaylistWrapper.setOnClickListener {
videoMetaDataFragment.saveToPlaylist(video)
- Toast.makeText(context, "Saved to playlist", Toast.LENGTH_SHORT).show()
+ Toast.makeText(context, context.getString(string.saved_to_playlist), Toast.LENGTH_SHORT).show()
}
binding.videoBlockWrapper.setOnClickListener {
diff --git a/app/src/main/java/net/schueller/peertube/database/Video.kt b/app/src/main/java/net/schueller/peertube/database/Video.kt
index 1ac17f9..76c311c 100644
--- a/app/src/main/java/net/schueller/peertube/database/Video.kt
+++ b/app/src/main/java/net/schueller/peertube/database/Video.kt
@@ -5,6 +5,7 @@ import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.parcelize.Parcelize
+import java.util.*
@Parcelize
@Entity(tableName = "watch_later")
@@ -12,6 +13,9 @@ data class Video(
@PrimaryKey(autoGenerate = true)
var id: Int = 0,
+ @ColumnInfo(name = "video_uuid")
+ var videoUUID: String,
+
@ColumnInfo(name = "video_name")
var videoName: String,
diff --git a/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.kt b/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.kt
index f594bb1..746b4fd 100644
--- a/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.kt
+++ b/app/src/main/java/net/schueller/peertube/fragment/VideoMetaDataFragment.kt
@@ -220,7 +220,7 @@ class VideoMetaDataFragment : Fragment() {
}
fun saveToPlaylist(video: Video) {
- val playlistVideo: net.schueller.peertube.database.Video = net.schueller.peertube.database.Video(videoName = video.name, videoDescription = video.description)
+ val playlistVideo: net.schueller.peertube.database.Video = net.schueller.peertube.database.Video(videoUUID = video.uuid, videoName = video.name, videoDescription = video.description)
mVideoViewModel.insert(playlistVideo)
}
diff --git a/app/src/main/res/layout/activity_me.xml b/app/src/main/res/layout/activity_me.xml
index 349c8ad..e9ccf91 100644
--- a/app/src/main/res/layout/activity_me.xml
+++ b/app/src/main/res/layout/activity_me.xml
@@ -116,7 +116,7 @@
android:drawablePadding="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="Playlist"
+ android:text="@string/playlist"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Title"/>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index df6be17..47203a9 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -384,4 +384,8 @@
%1$s@%2$s
Unsubscribe
Are you sure you would like to unsubscribe?
+ Saved to playlist
+ Remove Video
+ Are you sure you want to remove this video from playlist?
+ Playlist
\ No newline at end of file