This commit is contained in:
Bnyro 2022-05-30 17:47:54 +02:00
parent 16cccc0a5d
commit a5c0f3154b
3 changed files with 14 additions and 9 deletions

View File

@ -27,11 +27,11 @@ import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.adapters.SearchAdapter
import com.github.libretube.adapters.SearchHistoryAdapter
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.io.IOException
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import retrofit2.HttpException
import java.io.IOException
class SearchFragment : Fragment() {
private val TAG = "SearchFragment"

View File

@ -9,7 +9,6 @@ import android.widget.Toast
import androidx.fragment.app.DialogFragment
import androidx.preference.PreferenceManager
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import java.net.URLEncoder
/**
* Dialog with different options for a selected video.
@ -52,11 +51,12 @@ class VideoOptionsDialog(private val videoId: String, context: Context) : Dialog
}
// Add Video to Playlist Dialog
1 -> {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
val sharedPreferences = PreferenceManager
.getDefaultSharedPreferences(requireContext())
val token = sharedPreferences.getString("token", "")
if (token != "") {
val newFragment = AddtoPlaylistDialog()
var bundle = Bundle()
val bundle = Bundle()
bundle.putString("videoId", videoId)
newFragment.arguments = bundle
newFragment.show(parentFragmentManager, "AddToPlaylist")
@ -65,6 +65,7 @@ class VideoOptionsDialog(private val videoId: String, context: Context) : Dialog
}
}
2 -> {
/* crashes
val sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(requireContext())
val instancePref = sharedPreferences.getString(
@ -77,8 +78,6 @@ class VideoOptionsDialog(private val videoId: String, context: Context) : Dialog
getString(R.string.instance),
getString(R.string.youtube)
)
/*
// crashes
MaterialAlertDialogBuilder(requireContext())
.setTitle(getString(R.string.share))
.setItems(
@ -101,7 +100,10 @@ class VideoOptionsDialog(private val videoId: String, context: Context) : Dialog
*/
val intent = Intent()
intent.action = Intent.ACTION_SEND
intent.putExtra(Intent.EXTRA_TEXT, "https://piped.kavin.rocks/watch?v=$videoId")
intent.putExtra(
Intent.EXTRA_TEXT,
"https://piped.kavin.rocks/watch?v=$videoId"
)
intent.type = "text/plain"
startActivity(Intent.createChooser(intent, "Share Url To:"))
}

View File

@ -11,10 +11,13 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.os.bundleOf
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.*
import com.github.libretube.MainActivity
import com.github.libretube.PlayerFragment
import com.github.libretube.R
import com.github.libretube.VideoOptionsDialog
import com.github.libretube.formatShort
import com.github.libretube.obj.SearchItem
import com.squareup.picasso.Picasso
import kotlinx.coroutines.NonDisposableHandle.parent
class SearchAdapter(
private val searchItems: MutableList<SearchItem>,