mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 14:50:30 +05:30
watch history fragment
This commit is contained in:
parent
e7e4cf7c07
commit
e9226313f4
@ -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!!
|
||||
|
@ -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<MotionLayout>(R.id.mainMotionLayout)
|
||||
|
@ -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<MotionLayout>(R.id.mainMotionLayout)
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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<MotionLayout>(R.id.mainMotionLayout)
|
||||
|
@ -48,7 +48,7 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
|
||||
root.setOnClickListener {
|
||||
val activity = holder.v.context as MainActivity
|
||||
val bundle = bundleOf("channel_id" to subscription.url)
|
||||
activity.navController.navigate(R.id.channel, bundle)
|
||||
activity.navController.navigate(R.id.channelFragment, bundle)
|
||||
}
|
||||
subscriptionSubscribe.setOnClickListener {
|
||||
if (!isLoading) {
|
||||
|
@ -53,7 +53,7 @@ class TrendingAdapter(
|
||||
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<MotionLayout>(R.id.mainMotionLayout)
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
@ -6,6 +6,26 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".fragments.LibraryFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/showWatchHistory"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/watch_history"
|
||||
android:textSize="20sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/loginOrRegister2"
|
||||
android:layout_width="match_parent"
|
||||
@ -64,6 +84,8 @@
|
||||
</ScrollView>
|
||||
</com.github.libretube.util.CustomSwipeToRefresh>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/create_playlist"
|
||||
android:layout_width="wrap_content"
|
||||
|
18
app/src/main/res/layout/fragment_watch_history.xml
Normal file
18
app/src/main/res/layout/fragment_watch_history.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/watch_history" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/watchHistoryRecView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false"/>
|
||||
|
||||
</LinearLayout>
|
@ -2,15 +2,15 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/home2"
|
||||
android:id="@+id/homeFragment"
|
||||
android:icon="@drawable/ic_home"
|
||||
android:title="@string/startpage" />
|
||||
<item
|
||||
android:id="@+id/subscriptions"
|
||||
android:id="@+id/subscriptionsFragment"
|
||||
android:icon="@drawable/ic_subscriptions"
|
||||
android:title="@string/subscriptions" />
|
||||
<item
|
||||
android:id="@+id/library"
|
||||
android:id="@+id/libraryFragment"
|
||||
android:icon="@drawable/ic_library"
|
||||
android:title="@string/library" />
|
||||
|
||||
|
@ -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">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/home2"
|
||||
android:id="@+id/homeFragment"
|
||||
android:name="com.github.libretube.fragments.HomeFragment"
|
||||
android:label="fragment_home"
|
||||
tools:layout="@layout/fragment_home" />
|
||||
<fragment
|
||||
android:id="@+id/subscriptions"
|
||||
android:id="@+id/subscriptionsFragment"
|
||||
android:name="com.github.libretube.fragments.SubscriptionsFragment"
|
||||
android:label="fragment_subscriptions"
|
||||
tools:layout="@layout/fragment_subscriptions" />
|
||||
<fragment
|
||||
android:id="@+id/library"
|
||||
android:id="@+id/libraryFragment"
|
||||
android:name="com.github.libretube.fragments.LibraryFragment"
|
||||
android:label="fragment_library"
|
||||
tools:layout="@layout/fragment_library"></fragment>
|
||||
@ -26,7 +26,7 @@
|
||||
android:label="fragment_search"
|
||||
tools:layout="@layout/fragment_search" />
|
||||
<fragment
|
||||
android:id="@+id/channel"
|
||||
android:id="@+id/channelFragment"
|
||||
android:name="com.github.libretube.fragments.ChannelFragment"
|
||||
android:label="channel"
|
||||
tools:layout="@layout/fragment_channel">
|
||||
@ -44,7 +44,8 @@
|
||||
app:argType="string" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/settings"
|
||||
android:name="com.github.libretube.SettingsActivity$SettingsFragment"
|
||||
android:label="Settings" />
|
||||
android:id="@+id/watchHistoryFragment"
|
||||
android:name="com.github.libretube.fragments.WatchHistoryFragment"
|
||||
android:label="@string/watch_history"
|
||||
tools:layout="@layout/fragment_watch_history"/>
|
||||
</navigation>
|
Loading…
Reference in New Issue
Block a user