diff --git a/app/src/main/java/com/github/libretube/activities/MainActivity.kt b/app/src/main/java/com/github/libretube/activities/MainActivity.kt index e47cc3605..eb4b5eef5 100644 --- a/app/src/main/java/com/github/libretube/activities/MainActivity.kt +++ b/app/src/main/java/com/github/libretube/activities/MainActivity.kt @@ -79,28 +79,28 @@ class MainActivity : AppCompatActivity() { // hide the trending page if enabled val hideTrendingPage = PreferenceHelper.getBoolean(this, "hide_trending_page", false) - if (hideTrendingPage) bottomNavigationView.menu.findItem(R.id.home2).isVisible = false + if (hideTrendingPage) bottomNavigationView.menu.findItem(R.id.homeFragment).isVisible = false // navigate to the default start tab when (PreferenceHelper.getString(this, "default_tab", "home")) { - "home" -> navController.navigate(R.id.home2) - "subscriptions" -> navController.navigate(R.id.subscriptions) - "library" -> navController.navigate(R.id.library) + "home" -> navController.navigate(R.id.homeFragment) + "subscriptions" -> navController.navigate(R.id.subscriptionsFragment) + "library" -> navController.navigate(R.id.libraryFragment) } binding.bottomNav.setOnItemSelectedListener { when (it.itemId) { - R.id.home2 -> { + R.id.homeFragment -> { navController.backQueue.clear() - navController.navigate(R.id.home2) + navController.navigate(R.id.homeFragment) } - R.id.subscriptions -> { + R.id.subscriptionsFragment -> { // navController.backQueue.clear() - navController.navigate(R.id.subscriptions) + navController.navigate(R.id.subscriptionsFragment) } - R.id.library -> { + R.id.libraryFragment -> { // navController.backQueue.clear() - navController.navigate(R.id.library) + navController.navigate(R.id.libraryFragment) } } false @@ -176,7 +176,7 @@ class MainActivity : AppCompatActivity() { channel = channel!!.replace("/c/", "") channel = channel.replace("/user/", "") val bundle = bundleOf("channel_id" to channel) - navController.navigate(R.id.channel, bundle) + navController.navigate(R.id.channelFragment, bundle) } else if (data.path!!.contains("/playlist")) { Log.i(TAG, "URI Type: Playlist") var playlist = data.query!! diff --git a/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt b/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt index b66c0a207..70ba92bd4 100644 --- a/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt @@ -69,7 +69,7 @@ class CommentsAdapter( commentorImage.setOnClickListener { val activity = holder.v.context as MainActivity val bundle = bundleOf("channel_id" to comment.commentorUrl) - activity.navController.navigate(R.id.channel, bundle) + activity.navController.navigate(R.id.channelFragment, bundle) try { val mainMotionLayout = activity.findViewById(R.id.mainMotionLayout) diff --git a/app/src/main/java/com/github/libretube/adapters/RepliesAdapter.kt b/app/src/main/java/com/github/libretube/adapters/RepliesAdapter.kt index 534ae0267..744b864ec 100644 --- a/app/src/main/java/com/github/libretube/adapters/RepliesAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/RepliesAdapter.kt @@ -61,7 +61,7 @@ class RepliesAdapter( commentorImage.setOnClickListener { val activity = holder.v.context as MainActivity val bundle = bundleOf("channel_id" to reply.commentorUrl) - activity.navController.navigate(R.id.channel, bundle) + activity.navController.navigate(R.id.channelFragment, bundle) try { val mainMotionLayout = activity.findViewById(R.id.mainMotionLayout) diff --git a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt index 3706143eb..e57e740a8 100644 --- a/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/SearchAdapter.kt @@ -117,7 +117,7 @@ class SearchViewHolder( channelImage.setOnClickListener { val activity = v.context as MainActivity val bundle = bundleOf("channel_id" to item.uploaderUrl) - activity.navController.navigate(R.id.channel, bundle) + activity.navController.navigate(R.id.channelFragment, bundle) } } @@ -134,7 +134,7 @@ class SearchViewHolder( v.setOnClickListener { val activity = v.context as MainActivity val bundle = bundleOf("channel_id" to item.url) - activity.navController.navigate(R.id.channel, bundle) + activity.navController.navigate(R.id.channelFragment, bundle) } // todo sub button } diff --git a/app/src/main/java/com/github/libretube/adapters/SubscriptionAdapter.kt b/app/src/main/java/com/github/libretube/adapters/SubscriptionAdapter.kt index a0813914c..bab7f497d 100644 --- a/app/src/main/java/com/github/libretube/adapters/SubscriptionAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/SubscriptionAdapter.kt @@ -62,7 +62,7 @@ class SubscriptionAdapter( channelImage.setOnClickListener { val activity = holder.v.context as MainActivity val bundle = bundleOf("channel_id" to trending.uploaderUrl) - activity.navController.navigate(R.id.channel, bundle) + activity.navController.navigate(R.id.channelFragment, bundle) try { val mainMotionLayout = activity.findViewById(R.id.mainMotionLayout) diff --git a/app/src/main/java/com/github/libretube/adapters/SubscriptionChannelAdapter.kt b/app/src/main/java/com/github/libretube/adapters/SubscriptionChannelAdapter.kt index de1e78664..a53a7b8e2 100644 --- a/app/src/main/java/com/github/libretube/adapters/SubscriptionChannelAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/SubscriptionChannelAdapter.kt @@ -48,7 +48,7 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList(R.id.mainMotionLayout) diff --git a/app/src/main/java/com/github/libretube/fragments/LibraryFragment.kt b/app/src/main/java/com/github/libretube/fragments/LibraryFragment.kt index b66ce1fc3..62a00d7ec 100644 --- a/app/src/main/java/com/github/libretube/fragments/LibraryFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/LibraryFragment.kt @@ -8,6 +8,7 @@ import android.view.ViewGroup import android.widget.Toast import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope +import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager import com.github.libretube.R import com.github.libretube.adapters.PlaylistsAdapter @@ -43,6 +44,11 @@ class LibraryFragment : Fragment() { super.onViewCreated(view, savedInstanceState) binding.playlistRecView.layoutManager = LinearLayoutManager(view.context) token = PreferenceHelper.getToken(requireContext()) + + binding.showWatchHistory.setOnClickListener { + findNavController().navigate(R.id.watchHistoryFragment) + } + if (token != "") { binding.boogh.visibility = View.GONE binding.textLike.visibility = View.GONE 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 7549c82c5..0add6dc33 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -746,7 +746,7 @@ class PlayerFragment : Fragment() { binding.playerChannel.setOnClickListener { val activity = view.context as MainActivity val bundle = bundleOf("channel_id" to response.uploaderUrl) - activity.navController.navigate(R.id.channel, bundle) + activity.navController.navigate(R.id.channelFragment, bundle) activity.binding.mainMotionLayout.transitionToEnd() binding.playerMotionLayout.transitionToEnd() } diff --git a/app/src/main/java/com/github/libretube/fragments/WatchHistoryFragment.kt b/app/src/main/java/com/github/libretube/fragments/WatchHistoryFragment.kt new file mode 100644 index 000000000..4e30fe416 --- /dev/null +++ b/app/src/main/java/com/github/libretube/fragments/WatchHistoryFragment.kt @@ -0,0 +1,26 @@ +package com.github.libretube.fragments + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import com.github.libretube.databinding.FragmentWatchHistoryBinding + +class WatchHistoryFragment : Fragment() { + private val TAG = "WatchHistoryFragment" + private lateinit var binding: FragmentWatchHistoryBinding + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + binding = FragmentWatchHistoryBinding.inflate(layoutInflater, container, false) + return binding.root + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + } +} \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index a81923388..32339cec3 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -6,6 +6,26 @@ android:layout_height="match_parent" tools:context=".fragments.LibraryFragment"> + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/bottom_menu.xml b/app/src/main/res/menu/bottom_menu.xml index 809c8b2ee..f5badbc88 100644 --- a/app/src/main/res/menu/bottom_menu.xml +++ b/app/src/main/res/menu/bottom_menu.xml @@ -2,15 +2,15 @@ diff --git a/app/src/main/res/navigation/nav.xml b/app/src/main/res/navigation/nav.xml index 1fc46ab85..31d75575c 100644 --- a/app/src/main/res/navigation/nav.xml +++ b/app/src/main/res/navigation/nav.xml @@ -3,20 +3,20 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/nav" - app:startDestination="@id/home2"> + app:startDestination="@id/homeFragment"> @@ -26,7 +26,7 @@ android:label="fragment_search" tools:layout="@layout/fragment_search" /> @@ -44,7 +44,8 @@ app:argType="string" /> + android:id="@+id/watchHistoryFragment" + android:name="com.github.libretube.fragments.WatchHistoryFragment" + android:label="@string/watch_history" + tools:layout="@layout/fragment_watch_history"/> \ No newline at end of file