This commit is contained in:
Bnyro 2022-07-01 19:48:20 +02:00
parent 31cf6f608e
commit 7f130dedb7
4 changed files with 2 additions and 6 deletions

View File

@ -1,6 +1,5 @@
package com.github.libretube.adapters
import android.R.attr.data
import android.os.Bundle
import android.text.format.DateUtils
import android.view.LayoutInflater
@ -19,7 +18,6 @@ import com.github.libretube.fragments.PlayerFragment
import com.github.libretube.obj.WatchHistoryItem
import com.squareup.picasso.Picasso
class WatchHistoryAdapter(
private val watchHistory: MutableList<WatchHistoryItem>,
private val childFragmentManager: FragmentManager

View File

@ -457,8 +457,9 @@ class PlayerFragment : Fragment() {
initAutoPlay()
val watchHistoryEnabled =
PreferenceHelper.getBoolean(requireContext(), "Watch_history_toggle", true)
if (watchHistoryEnabled)
if (watchHistoryEnabled) {
PreferenceHelper.addToWatchHistory(requireContext(), videoId!!, response)
}
}
}
}

View File

@ -30,7 +30,6 @@ class WatchHistoryFragment : Fragment() {
val watchHistoryAdapter = WatchHistoryAdapter(watchHistory, childFragmentManager)
binding.watchHistoryRecView.adapter = watchHistoryAdapter
binding.clearHistory.setOnClickListener {
PreferenceHelper.removePreference(requireContext(), "watch_history")
watchHistoryAdapter.clear()

View File

@ -2,7 +2,6 @@ package com.github.libretube.util
import android.content.Context
import android.content.SharedPreferences
import android.util.Log
import androidx.preference.PreferenceManager
import com.github.libretube.obj.CustomInstance
import com.github.libretube.obj.Streams
@ -151,7 +150,6 @@ object PreferenceHelper {
}
if (indexToRemove != Int.MAX_VALUE) watchHistory.removeAt(indexToRemove)
watchHistory += watchHistoryItem
val json = gson.toJson(watchHistory)