mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
commit
3d404b2dbb
@ -80,7 +80,8 @@ class PlaylistFragment : Fragment() {
|
|||||||
response.relatedStreams!!.toMutableList(),
|
response.relatedStreams!!.toMutableList(),
|
||||||
playlist_id!!,
|
playlist_id!!,
|
||||||
isOwner,
|
isOwner,
|
||||||
requireActivity()
|
requireActivity(),
|
||||||
|
childFragmentManager
|
||||||
)
|
)
|
||||||
view.findViewById<RecyclerView>(R.id.playlist_recView).adapter = playlistAdapter
|
view.findViewById<RecyclerView>(R.id.playlist_recView).adapter = playlistAdapter
|
||||||
val scrollView = view.findViewById<ScrollView>(R.id.playlist_scrollview)
|
val scrollView = view.findViewById<ScrollView>(R.id.playlist_scrollview)
|
||||||
|
@ -172,7 +172,7 @@ class SettingsActivity :
|
|||||||
|
|
||||||
val login = findPreference<Preference>("login_register")
|
val login = findPreference<Preference>("login_register")
|
||||||
login?.setOnPreferenceClickListener {
|
login?.setOnPreferenceClickListener {
|
||||||
|
requireMainActivityRestart = true
|
||||||
val newFragment = LoginDialog()
|
val newFragment = LoginDialog()
|
||||||
newFragment.show(childFragmentManager, "Login")
|
newFragment.show(childFragmentManager, "Login")
|
||||||
true
|
true
|
||||||
|
@ -7,7 +7,6 @@ import android.os.Bundle
|
|||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import androidx.preference.PreferenceManager
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,9 +50,11 @@ class VideoOptionsDialog(private val videoId: String, context: Context) : Dialog
|
|||||||
}
|
}
|
||||||
// Add Video to Playlist Dialog
|
// Add Video to Playlist Dialog
|
||||||
1 -> {
|
1 -> {
|
||||||
val sharedPreferences = PreferenceManager
|
val sharedPref = context?.getSharedPreferences(
|
||||||
.getDefaultSharedPreferences(requireContext())
|
"token",
|
||||||
val token = sharedPreferences.getString("token", "")
|
Context.MODE_PRIVATE
|
||||||
|
)
|
||||||
|
val token = sharedPref?.getString("token", "")
|
||||||
if (token != "") {
|
if (token != "") {
|
||||||
val newFragment = AddtoPlaylistDialog()
|
val newFragment = AddtoPlaylistDialog()
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
|
@ -11,10 +11,12 @@ import android.view.ViewGroup
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.PlayerFragment
|
import com.github.libretube.PlayerFragment
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.RetrofitInstance
|
import com.github.libretube.RetrofitInstance
|
||||||
|
import com.github.libretube.VideoOptionsDialog
|
||||||
import com.github.libretube.obj.PlaylistId
|
import com.github.libretube.obj.PlaylistId
|
||||||
import com.github.libretube.obj.StreamItem
|
import com.github.libretube.obj.StreamItem
|
||||||
import com.squareup.picasso.Picasso
|
import com.squareup.picasso.Picasso
|
||||||
@ -27,7 +29,8 @@ class PlaylistAdapter(
|
|||||||
private val videoFeed: MutableList<StreamItem>,
|
private val videoFeed: MutableList<StreamItem>,
|
||||||
private val playlistId: String,
|
private val playlistId: String,
|
||||||
private val isOwner: Boolean,
|
private val isOwner: Boolean,
|
||||||
private val activity: Activity
|
private val activity: Activity,
|
||||||
|
private val childFragmentManager: FragmentManager
|
||||||
) : RecyclerView.Adapter<PlaylistViewHolder>() {
|
) : RecyclerView.Adapter<PlaylistViewHolder>() {
|
||||||
private val TAG = "PlaylistAdapter"
|
private val TAG = "PlaylistAdapter"
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
@ -66,6 +69,13 @@ class PlaylistAdapter(
|
|||||||
.replace(R.id.container, frag)
|
.replace(R.id.container, frag)
|
||||||
.commitNow()
|
.commitNow()
|
||||||
}
|
}
|
||||||
|
holder.v.setOnLongClickListener {
|
||||||
|
val videoId = streamItem.url!!.replace("/watch?v=", "")
|
||||||
|
VideoOptionsDialog(videoId, holder.v.context)
|
||||||
|
.show(childFragmentManager, VideoOptionsDialog.TAG)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
if (isOwner) {
|
if (isOwner) {
|
||||||
val delete = holder.v.findViewById<ImageView>(R.id.delete_playlist)
|
val delete = holder.v.findViewById<ImageView>(R.id.delete_playlist)
|
||||||
delete.visibility = View.VISIBLE
|
delete.visibility = View.VISIBLE
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -49,15 +48,6 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/create_playlist"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/createPlaylist"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_margin="8dp"
|
|
||||||
android:textColor="?attr/colorSurface"
|
|
||||||
android:drawableLeft="@drawable/ic_add" />
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@ -73,4 +63,28 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</com.github.libretube.CustomSwipeToRefresh>
|
</com.github.libretube.CustomSwipeToRefresh>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:id="@+id/create_playlist"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:layout_width="50dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:insetLeft="0dp"
|
||||||
|
android:insetTop="0dp"
|
||||||
|
android:insetRight="0dp"
|
||||||
|
android:insetBottom="0dp"
|
||||||
|
app:cornerRadius="16dp"
|
||||||
|
app:icon="@drawable/ic_add"
|
||||||
|
android:backgroundTint="?attr/colorSecondary"
|
||||||
|
app:iconGravity="textStart"
|
||||||
|
app:iconPadding="0dp" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
Loading…
Reference in New Issue
Block a user