mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
fixes
This commit is contained in:
parent
23f22f99bf
commit
f4a4ad41bb
@ -25,8 +25,9 @@ class ChannelAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateItems(newItems: List<StreamItem>) {
|
fun updateItems(newItems: List<StreamItem>) {
|
||||||
|
val feedSize = videoFeed.size
|
||||||
videoFeed.addAll(newItems)
|
videoFeed.addAll(newItems)
|
||||||
notifyDataSetChanged()
|
notifyItemRangeInserted(feedSize, newItems.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChannelViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChannelViewHolder {
|
||||||
|
@ -81,9 +81,8 @@ class LoginDialog : DialogFragment() {
|
|||||||
Toast.makeText(context, R.string.loggedIn, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.loggedIn, Toast.LENGTH_SHORT).show()
|
||||||
PreferenceHelper.setToken(response.token!!)
|
PreferenceHelper.setToken(response.token!!)
|
||||||
PreferenceHelper.setUsername(login.username!!)
|
PreferenceHelper.setUsername(login.username!!)
|
||||||
val restartDialog = RequireRestartDialog()
|
|
||||||
restartDialog.show(parentFragmentManager, "RequireRestartDialog")
|
|
||||||
dialog?.dismiss()
|
dialog?.dismiss()
|
||||||
|
activity?.recreate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ class ChannelFragment : Fragment() {
|
|||||||
if (nextPage != null && !isLoading) {
|
if (nextPage != null && !isLoading) {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
binding.channelRefresh.isRefreshing = true
|
binding.channelRefresh.isRefreshing = true
|
||||||
fetchNextPage()
|
fetchChannelNextPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ class ChannelFragment : Fragment() {
|
|||||||
run()
|
run()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fetchNextPage() {
|
private fun fetchChannelNextPage() {
|
||||||
fun run() {
|
fun run() {
|
||||||
lifecycleScope.launchWhenCreated {
|
lifecycleScope.launchWhenCreated {
|
||||||
val response = try {
|
val response = try {
|
||||||
|
@ -563,7 +563,7 @@ class PlayerFragment : Fragment() {
|
|||||||
exoPlayer.pause()
|
exoPlayer.pause()
|
||||||
|
|
||||||
// start the background mode
|
// start the background mode
|
||||||
BackgroundHelper.playOnBackground(requireContext(), videoId!!)
|
BackgroundHelper.playOnBackground(requireContext(), videoId!!, exoPlayer.currentPosition)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.playerScrollView.viewTreeObserver
|
binding.playerScrollView.viewTreeObserver
|
||||||
@ -1080,7 +1080,7 @@ class PlayerFragment : Fragment() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// check if livestream
|
// check if livestream
|
||||||
if (response.duration!! > 0) {
|
if (response.duration > 0) {
|
||||||
// download clicked
|
// download clicked
|
||||||
binding.relPlayerDownload.setOnClickListener {
|
binding.relPlayerDownload.setOnClickListener {
|
||||||
if (!Globals.IS_DOWNLOAD_RUNNING) {
|
if (!Globals.IS_DOWNLOAD_RUNNING) {
|
||||||
@ -1148,7 +1148,6 @@ class PlayerFragment : Fragment() {
|
|||||||
binding.playerMotionLayout.transitionToEnd()
|
binding.playerMotionLayout.transitionToEnd()
|
||||||
}
|
}
|
||||||
if (token != "") {
|
if (token != "") {
|
||||||
val channelId = response.uploaderUrl?.toID()
|
|
||||||
isSubscribed()
|
isSubscribed()
|
||||||
binding.relPlayerSave.setOnClickListener {
|
binding.relPlayerSave.setOnClickListener {
|
||||||
val newFragment = AddtoPlaylistDialog()
|
val newFragment = AddtoPlaylistDialog()
|
||||||
@ -1241,11 +1240,6 @@ class PlayerFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun toggleController() {
|
|
||||||
if (exoPlayerView.isControllerFullyVisible) exoPlayerView.hideController()
|
|
||||||
else exoPlayerView.showController()
|
|
||||||
}
|
|
||||||
|
|
||||||
// enable seek bar preview
|
// enable seek bar preview
|
||||||
private fun enableSeekbarPreview() {
|
private fun enableSeekbarPreview() {
|
||||||
playerBinding.exoProgress.addListener(object : TimeBar.OnScrubListener {
|
playerBinding.exoProgress.addListener(object : TimeBar.OnScrubListener {
|
||||||
|
@ -7,6 +7,7 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.adapters.SearchAdapter
|
import com.github.libretube.adapters.SearchAdapter
|
||||||
|
@ -66,10 +66,10 @@ class BackgroundMode : Service() {
|
|||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
if (Build.VERSION.SDK_INT >= 26) {
|
if (Build.VERSION.SDK_INT >= 26) {
|
||||||
val channelId = "background service"
|
val channelId = BACKGROUND_CHANNEL_ID
|
||||||
val channel = NotificationChannel(
|
val channel = NotificationChannel(
|
||||||
channelId,
|
channelId,
|
||||||
"BackgroundPlay Service",
|
"Background Service",
|
||||||
NotificationManager.IMPORTANCE_DEFAULT
|
NotificationManager.IMPORTANCE_DEFAULT
|
||||||
)
|
)
|
||||||
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||||
@ -77,7 +77,7 @@ class BackgroundMode : Service() {
|
|||||||
val notification: Notification = Notification.Builder(this, channelId)
|
val notification: Notification = Notification.Builder(this, channelId)
|
||||||
.setContentTitle(getString(R.string.app_name))
|
.setContentTitle(getString(R.string.app_name))
|
||||||
.setContentText(getString(R.string.playingOnBackground)).build()
|
.setContentText(getString(R.string.playingOnBackground)).build()
|
||||||
startForeground(1, notification)
|
startForeground(PLAYER_NOTIFICATION_ID, notification)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ object BackgroundHelper {
|
|||||||
fun playOnBackground(
|
fun playOnBackground(
|
||||||
context: Context,
|
context: Context,
|
||||||
videoId: String,
|
videoId: String,
|
||||||
position: Int? = null
|
position: Long? = null
|
||||||
) {
|
) {
|
||||||
val intent = Intent(context, BackgroundMode::class.java)
|
val intent = Intent(context, BackgroundMode::class.java)
|
||||||
intent.putExtra("videoId", videoId)
|
intent.putExtra("videoId", videoId)
|
||||||
|
@ -172,7 +172,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginStart="5dp">
|
android:layout_marginStart="10dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@id/exo_position"
|
android:id="@id/exo_position"
|
||||||
@ -194,7 +194,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginStart="5dp"
|
android:layout_marginStart="10dp"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingStart="8dp"
|
android:paddingStart="8dp"
|
||||||
android:paddingEnd="8dp"
|
android:paddingEnd="8dp"
|
||||||
|
app:checkedChip="@id/chip_all"
|
||||||
app:selectionRequired="true"
|
app:selectionRequired="true"
|
||||||
app:singleLine="true"
|
app:singleLine="true"
|
||||||
app:singleSelection="true">
|
app:singleSelection="true">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user