mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
cleanup
This commit is contained in:
parent
8958b90515
commit
13ba954c6d
@ -5,13 +5,10 @@ import android.text.format.DateUtils
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.databinding.ChannelSubscriptionRowBinding
|
|
||||||
import com.github.libretube.databinding.VideoChannelRowBinding
|
import com.github.libretube.databinding.VideoChannelRowBinding
|
||||||
import com.github.libretube.dialogs.VideoOptionsDialog
|
import com.github.libretube.dialogs.VideoOptionsDialog
|
||||||
import com.github.libretube.fragments.PlayerFragment
|
import com.github.libretube.fragments.PlayerFragment
|
||||||
@ -47,7 +44,7 @@ class ChannelAdapter(
|
|||||||
channelDescription.text = trending.title
|
channelDescription.text = trending.title
|
||||||
channelViews.text =
|
channelViews.text =
|
||||||
trending.views.formatShort() + " • " +
|
trending.views.formatShort() + " • " +
|
||||||
DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
|
DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
|
||||||
channelDuration.text =
|
channelDuration.text =
|
||||||
DateUtils.formatElapsedTime(trending.duration!!)
|
DateUtils.formatElapsedTime(trending.duration!!)
|
||||||
Picasso.get().load(trending.thumbnail).into(channelThumbnail)
|
Picasso.get().load(trending.thumbnail).into(channelThumbnail)
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package com.github.libretube.adapters
|
package com.github.libretube.adapters
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
@ -54,7 +51,7 @@ class CommentsAdapter(
|
|||||||
binding.apply {
|
binding.apply {
|
||||||
commentInfos.text =
|
commentInfos.text =
|
||||||
comment.author.toString() +
|
comment.author.toString() +
|
||||||
" • " + comment.commentedTime.toString()
|
" • " + comment.commentedTime.toString()
|
||||||
commentText.text =
|
commentText.text =
|
||||||
comment.commentText.toString()
|
comment.commentText.toString()
|
||||||
Picasso.get().load(comment.thumbnail).fit().centerCrop().into(commentorImage)
|
Picasso.get().load(comment.thumbnail).fit().centerCrop().into(commentorImage)
|
||||||
@ -74,10 +71,12 @@ class CommentsAdapter(
|
|||||||
val bundle = bundleOf("channel_id" to comment.commentorUrl)
|
val bundle = bundleOf("channel_id" to comment.commentorUrl)
|
||||||
activity.navController.navigate(R.id.channel, bundle)
|
activity.navController.navigate(R.id.channel, bundle)
|
||||||
try {
|
try {
|
||||||
val mainMotionLayout = activity.findViewById<MotionLayout>(R.id.mainMotionLayout)
|
val mainMotionLayout =
|
||||||
|
activity.findViewById<MotionLayout>(R.id.mainMotionLayout)
|
||||||
if (mainMotionLayout.progress == 0.toFloat()) {
|
if (mainMotionLayout.progress == 0.toFloat()) {
|
||||||
mainMotionLayout.transitionToEnd()
|
mainMotionLayout.transitionToEnd()
|
||||||
activity.findViewById<MotionLayout>(R.id.playerMotionLayout).transitionToEnd()
|
activity.findViewById<MotionLayout>(R.id.playerMotionLayout)
|
||||||
|
.transitionToEnd()
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
@ -91,7 +90,8 @@ class CommentsAdapter(
|
|||||||
nextpage = comment.repliesPage
|
nextpage = comment.repliesPage
|
||||||
fetchReplies(nextpage, repliesAdapter)
|
fetchReplies(nextpage, repliesAdapter)
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(holder.v.context, R.string.no_replies, Toast.LENGTH_SHORT).show()
|
Toast.makeText(holder.v.context, R.string.no_replies, Toast.LENGTH_SHORT)
|
||||||
|
.show()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
repliesAdapter.clear()
|
repliesAdapter.clear()
|
||||||
|
@ -7,14 +7,11 @@ import android.util.Log
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.databinding.PlaylistRowBinding
|
import com.github.libretube.databinding.PlaylistRowBinding
|
||||||
import com.github.libretube.databinding.PlaylistsRowBinding
|
|
||||||
import com.github.libretube.dialogs.VideoOptionsDialog
|
import com.github.libretube.dialogs.VideoOptionsDialog
|
||||||
import com.github.libretube.fragments.PlayerFragment
|
import com.github.libretube.fragments.PlayerFragment
|
||||||
import com.github.libretube.obj.PlaylistId
|
import com.github.libretube.obj.PlaylistId
|
||||||
|
@ -5,8 +5,6 @@ import android.util.Log
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.MainActivity
|
import com.github.libretube.MainActivity
|
||||||
|
@ -3,8 +3,6 @@ package com.github.libretube.adapters
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
@ -45,7 +43,7 @@ class RepliesAdapter(
|
|||||||
val reply = replies[position]
|
val reply = replies[position]
|
||||||
commentInfos.text =
|
commentInfos.text =
|
||||||
reply.author.toString() +
|
reply.author.toString() +
|
||||||
" • " + reply.commentedTime.toString()
|
" • " + reply.commentedTime.toString()
|
||||||
commentText.text =
|
commentText.text =
|
||||||
reply.commentText.toString()
|
reply.commentText.toString()
|
||||||
Picasso.get().load(reply.thumbnail).fit().centerCrop().into(commentorImage)
|
Picasso.get().load(reply.thumbnail).fit().centerCrop().into(commentorImage)
|
||||||
@ -65,10 +63,12 @@ class RepliesAdapter(
|
|||||||
val bundle = bundleOf("channel_id" to reply.commentorUrl)
|
val bundle = bundleOf("channel_id" to reply.commentorUrl)
|
||||||
activity.navController.navigate(R.id.channel, bundle)
|
activity.navController.navigate(R.id.channel, bundle)
|
||||||
try {
|
try {
|
||||||
val mainMotionLayout = activity.findViewById<MotionLayout>(R.id.mainMotionLayout)
|
val mainMotionLayout =
|
||||||
|
activity.findViewById<MotionLayout>(R.id.mainMotionLayout)
|
||||||
if (mainMotionLayout.progress == 0.toFloat()) {
|
if (mainMotionLayout.progress == 0.toFloat()) {
|
||||||
mainMotionLayout.transitionToEnd()
|
mainMotionLayout.transitionToEnd()
|
||||||
activity.findViewById<MotionLayout>(R.id.playerMotionLayout).transitionToEnd()
|
activity.findViewById<MotionLayout>(R.id.playerMotionLayout)
|
||||||
|
.transitionToEnd()
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
|
@ -5,12 +5,8 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.R
|
|
||||||
import com.github.libretube.databinding.SearchhistoryRowBinding
|
import com.github.libretube.databinding.SearchhistoryRowBinding
|
||||||
import com.github.libretube.databinding.SearchsuggestionRowBinding
|
|
||||||
import com.github.libretube.fragments.SearchFragment
|
import com.github.libretube.fragments.SearchFragment
|
||||||
import com.github.libretube.util.PreferenceHelper
|
import com.github.libretube.util.PreferenceHelper
|
||||||
|
|
||||||
|
@ -64,10 +64,12 @@ class SubscriptionAdapter(
|
|||||||
val bundle = bundleOf("channel_id" to trending.uploaderUrl)
|
val bundle = bundleOf("channel_id" to trending.uploaderUrl)
|
||||||
activity.navController.navigate(R.id.channel, bundle)
|
activity.navController.navigate(R.id.channel, bundle)
|
||||||
try {
|
try {
|
||||||
val mainMotionLayout = activity.findViewById<MotionLayout>(R.id.mainMotionLayout)
|
val mainMotionLayout =
|
||||||
|
activity.findViewById<MotionLayout>(R.id.mainMotionLayout)
|
||||||
if (mainMotionLayout.progress == 0.toFloat()) {
|
if (mainMotionLayout.progress == 0.toFloat()) {
|
||||||
mainMotionLayout.transitionToEnd()
|
mainMotionLayout.transitionToEnd()
|
||||||
activity.findViewById<MotionLayout>(R.id.playerMotionLayout).transitionToEnd()
|
activity.findViewById<MotionLayout>(R.id.playerMotionLayout)
|
||||||
|
.transitionToEnd()
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@ import android.util.Log
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.MainActivity
|
import com.github.libretube.MainActivity
|
||||||
@ -61,7 +59,8 @@ class SubscriptionChannelAdapter(private val subscriptions: MutableList<Subscrip
|
|||||||
subscriptionSubscribe.text = holder.v.context.getString(R.string.subscribe)
|
subscriptionSubscribe.text = holder.v.context.getString(R.string.subscribe)
|
||||||
} else {
|
} else {
|
||||||
subscribe(root.context, channelId)
|
subscribe(root.context, channelId)
|
||||||
subscriptionSubscribe.text = holder.v.context.getString(R.string.unsubscribe)
|
subscriptionSubscribe.text =
|
||||||
|
holder.v.context.getString(R.string.unsubscribe)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@ import android.text.format.DateUtils
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
@ -14,7 +12,6 @@ import androidx.fragment.app.FragmentManager
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.MainActivity
|
import com.github.libretube.MainActivity
|
||||||
import com.github.libretube.R
|
import com.github.libretube.R
|
||||||
import com.github.libretube.databinding.ChannelSubscriptionRowBinding
|
|
||||||
import com.github.libretube.databinding.TrendingRowBinding
|
import com.github.libretube.databinding.TrendingRowBinding
|
||||||
import com.github.libretube.dialogs.VideoOptionsDialog
|
import com.github.libretube.dialogs.VideoOptionsDialog
|
||||||
import com.github.libretube.fragments.PlayerFragment
|
import com.github.libretube.fragments.PlayerFragment
|
||||||
@ -27,7 +24,7 @@ class TrendingAdapter(
|
|||||||
private val childFragmentManager: FragmentManager
|
private val childFragmentManager: FragmentManager
|
||||||
) : RecyclerView.Adapter<TrendingViewHolder>() {
|
) : RecyclerView.Adapter<TrendingViewHolder>() {
|
||||||
private val TAG = "TrendingAdapter"
|
private val TAG = "TrendingAdapter"
|
||||||
private lateinit var binding: TrendingRowBinding
|
private lateinit var binding: TrendingRowBinding
|
||||||
|
|
||||||
override fun getItemCount(): Int {
|
override fun getItemCount(): Int {
|
||||||
return videoFeed.size
|
return videoFeed.size
|
||||||
@ -45,8 +42,8 @@ class TrendingAdapter(
|
|||||||
textViewTitle.text = trending.title
|
textViewTitle.text = trending.title
|
||||||
textViewChannel.text =
|
textViewChannel.text =
|
||||||
trending.uploaderName + " • " +
|
trending.uploaderName + " • " +
|
||||||
trending.views.formatShort() + " • " +
|
trending.views.formatShort() + " • " +
|
||||||
DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
|
DateUtils.getRelativeTimeSpanString(trending.uploaded!!)
|
||||||
if (trending.duration != -1L) {
|
if (trending.duration != -1L) {
|
||||||
thumbnailDuration.text = DateUtils.formatElapsedTime(trending.duration!!)
|
thumbnailDuration.text = DateUtils.formatElapsedTime(trending.duration!!)
|
||||||
} else {
|
} else {
|
||||||
@ -58,10 +55,12 @@ class TrendingAdapter(
|
|||||||
val bundle = bundleOf("channel_id" to trending.uploaderUrl)
|
val bundle = bundleOf("channel_id" to trending.uploaderUrl)
|
||||||
activity.navController.navigate(R.id.channel, bundle)
|
activity.navController.navigate(R.id.channel, bundle)
|
||||||
try {
|
try {
|
||||||
val mainMotionLayout = activity.findViewById<MotionLayout>(R.id.mainMotionLayout)
|
val mainMotionLayout =
|
||||||
|
activity.findViewById<MotionLayout>(R.id.mainMotionLayout)
|
||||||
if (mainMotionLayout.progress == 0.toFloat()) {
|
if (mainMotionLayout.progress == 0.toFloat()) {
|
||||||
mainMotionLayout.transitionToEnd()
|
mainMotionLayout.transitionToEnd()
|
||||||
activity.findViewById<MotionLayout>(R.id.playerMotionLayout).transitionToEnd()
|
activity.findViewById<MotionLayout>(R.id.playerMotionLayout)
|
||||||
|
.transitionToEnd()
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,12 @@ class SearchFragment : Fragment() {
|
|||||||
val historyList = PreferenceHelper.getHistory(requireContext())
|
val historyList = PreferenceHelper.getHistory(requireContext())
|
||||||
if (historyList.isNotEmpty()) {
|
if (historyList.isNotEmpty()) {
|
||||||
binding.historyRecycler.adapter =
|
binding.historyRecycler.adapter =
|
||||||
SearchHistoryAdapter(requireContext(), historyList, binding.autoCompleteTextView, this)
|
SearchHistoryAdapter(
|
||||||
|
requireContext(),
|
||||||
|
historyList,
|
||||||
|
binding.autoCompleteTextView,
|
||||||
|
this
|
||||||
|
)
|
||||||
binding.historyRecycler.visibility = VISIBLE
|
binding.historyRecycler.visibility = VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user