diff --git a/app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt b/app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt index 40f02d508..e3ca4b0b2 100644 --- a/app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/WatchHistoryAdapter.kt @@ -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, private val childFragmentManager: FragmentManager diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index 0add6dc33..c2e73a982 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -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) + } } } } diff --git a/app/src/main/java/com/github/libretube/fragments/WatchHistoryFragment.kt b/app/src/main/java/com/github/libretube/fragments/WatchHistoryFragment.kt index a4060cfd5..29e01175c 100644 --- a/app/src/main/java/com/github/libretube/fragments/WatchHistoryFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/WatchHistoryFragment.kt @@ -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() diff --git a/app/src/main/java/com/github/libretube/util/PreferenceHelper.kt b/app/src/main/java/com/github/libretube/util/PreferenceHelper.kt index 751aef848..045ed4626 100644 --- a/app/src/main/java/com/github/libretube/util/PreferenceHelper.kt +++ b/app/src/main/java/com/github/libretube/util/PreferenceHelper.kt @@ -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)