mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-12 21:30:30 +05:30
Merge pull request #1603 from Bnyro/master
Minimize the channel description by default
This commit is contained in:
commit
19df0c4ef5
@ -40,9 +40,9 @@
|
||||
|
||||
<activity
|
||||
android:name=".ui.activities.OfflinePlayerActivity"
|
||||
android:supportsPictureInPicture="true"
|
||||
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
|
||||
android:label="@string/player" />
|
||||
android:label="@string/player"
|
||||
android:supportsPictureInPicture="true" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.activities.MainActivity"
|
||||
|
@ -12,5 +12,5 @@ data class Channel(
|
||||
var nextpage: String? = null,
|
||||
var subscriberCount: Long = 0,
|
||||
var verified: Boolean = false,
|
||||
var relatedStreams: List<com.github.libretube.api.obj.StreamItem>? = null
|
||||
var relatedStreams: List<StreamItem>? = null
|
||||
)
|
||||
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
data class CommentsPage(
|
||||
val comments: MutableList<com.github.libretube.api.obj.Comment> = arrayListOf(),
|
||||
val comments: MutableList<Comment> = arrayListOf(),
|
||||
val disabled: Boolean? = null,
|
||||
val nextpage: String? = ""
|
||||
)
|
||||
|
@ -12,5 +12,5 @@ data class Playlist(
|
||||
var uploaderUrl: String? = null,
|
||||
var uploaderAvatar: String? = null,
|
||||
var videos: Int? = 0,
|
||||
var relatedStreams: List<com.github.libretube.api.obj.StreamItem>? = null
|
||||
var relatedStreams: List<StreamItem>? = null
|
||||
)
|
||||
|
@ -4,5 +4,5 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
data class Segments(
|
||||
val segments: MutableList<com.github.libretube.api.obj.Segment> = arrayListOf()
|
||||
val segments: MutableList<Segment> = arrayListOf()
|
||||
)
|
||||
|
@ -19,10 +19,10 @@ fun View?.setWatchProgressLength(videoId: String, duration: Long) {
|
||||
return
|
||||
}
|
||||
|
||||
view.getViewTreeObserver()
|
||||
view.viewTreeObserver
|
||||
.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
|
||||
override fun onGlobalLayout() {
|
||||
this@setWatchProgressLength.getViewTreeObserver().removeOnGlobalLayoutListener(this)
|
||||
this@setWatchProgressLength.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||
if (progress == null || duration == 0L) {
|
||||
view.visibility = View.GONE
|
||||
return
|
||||
|
@ -432,7 +432,12 @@ class MainActivity : BaseActivity() {
|
||||
private fun unsetFullscreen() {
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
|
||||
|
||||
showSystemBars()
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||
@Suppress("DEPRECATION")
|
||||
window.clearFlags(
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
window.attributes.layoutInDisplayCutoutMode =
|
||||
|
@ -74,13 +74,15 @@ class RouterActivity : BaseActivity() {
|
||||
val videoId = uri.getQueryParameter("v")
|
||||
|
||||
intent.putExtra(IntentData.videoId, videoId)
|
||||
uri.getQueryParameter("t")?.let { intent.putExtra(IntentData.timeStamp, it.toLong()) }
|
||||
uri.getQueryParameter("t")
|
||||
?.let { intent.putExtra(IntentData.timeStamp, it.toLong()) }
|
||||
}
|
||||
else -> {
|
||||
val videoId = uri.path!!.replace("/", "")
|
||||
|
||||
intent.putExtra(IntentData.videoId, videoId)
|
||||
uri.getQueryParameter("t")?.let { intent.putExtra(IntentData.timeStamp, it.toLong()) }
|
||||
uri.getQueryParameter("t")
|
||||
?.let { intent.putExtra(IntentData.timeStamp, it.toLong()) }
|
||||
}
|
||||
}
|
||||
return intent
|
||||
|
@ -70,7 +70,10 @@ class CommentsAdapter(
|
||||
if (comment.pinned == true) pinnedImageView.visibility = View.VISIBLE
|
||||
if (comment.hearted == true) heartedImageView.visibility = View.VISIBLE
|
||||
if (comment.repliesPage != null) repliesAvailable.visibility = View.VISIBLE
|
||||
if ((comment.replyCount ?: -1L) > 0L) repliesCount.text = comment.replyCount?.formatShort()
|
||||
if ((comment.replyCount ?: -1L) > 0L) {
|
||||
repliesCount.text =
|
||||
comment.replyCount?.formatShort()
|
||||
}
|
||||
|
||||
commentorImage.setOnClickListener {
|
||||
NavigationHelper.navigateChannel(root.context, comment.commentorUrl)
|
||||
|
@ -5,6 +5,7 @@ import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.github.libretube.R
|
||||
@ -29,7 +30,7 @@ class ChannelFragment : BaseFragment() {
|
||||
private var channelId: String? = null
|
||||
private var channelName: String? = null
|
||||
|
||||
var nextPage: String? = null
|
||||
private var nextPage: String? = null
|
||||
private var channelAdapter: ChannelAdapter? = null
|
||||
private var isLoading = true
|
||||
private var isSubscribed: Boolean? = false
|
||||
@ -41,7 +42,6 @@ class ChannelFragment : BaseFragment() {
|
||||
channelName = it.getString(IntentData.channelName)
|
||||
?.replace("/c/", "")
|
||||
?.replace("/user/", "")
|
||||
Log.e(TAG(), channelName.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,6 @@ class ChannelFragment : BaseFragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
binding.channelName.text = channelId
|
||||
binding.channelRecView.layoutManager = LinearLayoutManager(context)
|
||||
|
||||
val refreshChannel = {
|
||||
@ -94,7 +93,6 @@ class ChannelFragment : BaseFragment() {
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
binding.channelRefresh.isRefreshing = false
|
||||
println(e)
|
||||
Log.e(TAG(), "IOException, you might not have internet connection")
|
||||
return@launchWhenCreated
|
||||
} catch (e: HttpException) {
|
||||
@ -157,6 +155,12 @@ class ChannelFragment : BaseFragment() {
|
||||
binding.channelDescription.text = response.description?.trim()
|
||||
}
|
||||
|
||||
binding.channelDescription.setOnClickListener {
|
||||
(it as TextView).apply {
|
||||
it.maxLines = if (it.maxLines == Int.MAX_VALUE) 2 else Int.MAX_VALUE
|
||||
}
|
||||
}
|
||||
|
||||
ImageHelper.loadImage(response.bannerUrl, binding.channelBanner)
|
||||
ImageHelper.loadImage(response.avatarUrl, binding.channelImage)
|
||||
|
||||
|
@ -411,7 +411,8 @@ class PlayerFragment : BaseFragment() {
|
||||
|
||||
// FullScreen button trigger
|
||||
// hide fullscreen button if auto rotation enabled
|
||||
playerBinding.fullscreen.visibility = if (PlayerHelper.autoRotationEnabled) View.GONE else View.VISIBLE
|
||||
playerBinding.fullscreen.visibility =
|
||||
if (PlayerHelper.autoRotationEnabled) View.GONE else View.VISIBLE
|
||||
playerBinding.fullscreen.setOnClickListener {
|
||||
// hide player controller
|
||||
exoPlayerView.hideController()
|
||||
@ -426,7 +427,8 @@ class PlayerFragment : BaseFragment() {
|
||||
|
||||
// share button
|
||||
binding.relPlayerShare.setOnClickListener {
|
||||
val shareDialog = ShareDialog(videoId!!, ShareObjectType.VIDEO, exoPlayer.currentPosition / 1000)
|
||||
val shareDialog =
|
||||
ShareDialog(videoId!!, ShareObjectType.VIDEO, exoPlayer.currentPosition / 1000)
|
||||
shareDialog.show(childFragmentManager, ShareDialog::class.java.name)
|
||||
}
|
||||
|
||||
@ -670,7 +672,12 @@ class PlayerFragment : BaseFragment() {
|
||||
if (binding.player.autoplayEnabled) setNextStream()
|
||||
|
||||
// add the video to the watch history
|
||||
if (PlayerHelper.watchHistoryEnabled) DatabaseHelper.addToWatchHistory(videoId!!, streams)
|
||||
if (PlayerHelper.watchHistoryEnabled) {
|
||||
DatabaseHelper.addToWatchHistory(
|
||||
videoId!!,
|
||||
streams
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -818,7 +825,10 @@ class PlayerFragment : BaseFragment() {
|
||||
playerTitle.text = response.title
|
||||
playerDescription.text = response.description
|
||||
|
||||
playerChannelSubCount.text = context?.getString(R.string.subscribers, response.uploaderSubscriberCount?.formatShort())
|
||||
playerChannelSubCount.text = context?.getString(
|
||||
R.string.subscribers,
|
||||
response.uploaderSubscriberCount?.formatShort()
|
||||
)
|
||||
}
|
||||
|
||||
// duration that's not greater than 0 indicates that the video is live
|
||||
@ -1000,7 +1010,8 @@ class PlayerFragment : BaseFragment() {
|
||||
} else {
|
||||
View.INVISIBLE
|
||||
}
|
||||
playerBinding.skipNext.visibility = if (PlayerHelper.skipButtonsEnabled) View.VISIBLE else View.INVISIBLE
|
||||
playerBinding.skipNext.visibility =
|
||||
if (PlayerHelper.skipButtonsEnabled) View.VISIBLE else View.INVISIBLE
|
||||
|
||||
playerBinding.skipPrev.setOnClickListener {
|
||||
videoId = PlayingQueue.getPrev()
|
||||
|
@ -83,6 +83,7 @@ object ImageHelper {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun saveImage(context: Context, bitmapImage: Bitmap, imagePath: Uri) {
|
||||
context.contentResolver.openFileDescriptor(imagePath, "w")?.use {
|
||||
FileOutputStream(it.fileDescriptor).use { fos ->
|
||||
|
@ -72,7 +72,12 @@ class NowPlayingNotification(
|
||||
}
|
||||
}
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
PendingIntent.getActivity(
|
||||
context,
|
||||
0,
|
||||
intent,
|
||||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
)
|
||||
} else {
|
||||
PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
}
|
||||
|
@ -243,10 +243,11 @@ object PlayerHelper {
|
||||
false
|
||||
)
|
||||
|
||||
val pipEnabled: Boolean get() = PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.PICTURE_IN_PICTURE,
|
||||
true
|
||||
)
|
||||
val pipEnabled: Boolean
|
||||
get() = PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.PICTURE_IN_PICTURE,
|
||||
true
|
||||
)
|
||||
|
||||
val skipSegmentsManually: Boolean
|
||||
get() = PreferenceHelper.getBoolean(
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/subscription_channel_image"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true" />
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="8dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subscription_channel_name"
|
||||
@ -34,10 +34,10 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:stateListAnimator="@null"
|
||||
android:text="@string/unsubscribe"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textSize="12sp"
|
||||
app:cornerRadius="20dp"/>
|
||||
app:cornerRadius="20dp" />
|
||||
</RelativeLayout>
|
@ -28,14 +28,14 @@
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:visibility="gone"
|
||||
android:id="@+id/timeStampLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="25dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="25dp"
|
||||
android:hint="@string/time_code">
|
||||
android:hint="@string/time_code"
|
||||
android:visibility="gone">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/timeStamp"
|
||||
|
@ -27,6 +27,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
@ -53,7 +54,7 @@
|
||||
android:id="@+id/channel_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:layout_gravity="start"
|
||||
android:drawablePadding="3dip"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
@ -105,12 +106,14 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/channel_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:autoLink="web" />
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:autoLink="web"
|
||||
android:background="@drawable/rounded_ripple"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:padding="10dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -244,7 +244,7 @@
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:background="@drawable/rounded_ripple"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp">
|
||||
@ -258,9 +258,9 @@
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
|
@ -30,7 +30,9 @@
|
||||
android:id="@+id/watchHistoryRecView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:paddingBottom="64dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</FrameLayout>
|
@ -31,7 +31,7 @@
|
||||
android:id="@+id/delete_history"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/ic_close"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
Loading…
Reference in New Issue
Block a user