feat: Open playlist video in player, string update
This commit is contained in:
parent
96ec510f40
commit
c23c17d2ef
@ -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)
|
||||
|
@ -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 {
|
||||
|
@ -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,
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -384,4 +384,8 @@
|
||||
<string name="video_owner_fqdn_line">%1$s@%2$s</string>
|
||||
<string name="video_sub_del_alert_title">Unsubscribe</string>
|
||||
<string name="video_sub_del_alert_msg">Are you sure you would like to unsubscribe?</string>
|
||||
<string name="saved_to_playlist">Saved to playlist</string>
|
||||
<string name="remove_video">Remove Video</string>
|
||||
<string name="remove_video_warning_message">Are you sure you want to remove this video from playlist?</string>
|
||||
<string name="playlist">Playlist</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user