diff --git a/app/src/main/java/com/github/libretube/ChannelFragment.kt b/app/src/main/java/com/github/libretube/ChannelFragment.kt index 0894d58ff..b745a9b70 100644 --- a/app/src/main/java/com/github/libretube/ChannelFragment.kt +++ b/app/src/main/java/com/github/libretube/ChannelFragment.kt @@ -5,6 +5,7 @@ import android.annotation.SuppressLint import android.app.Activity import android.content.Context import android.os.Bundle +import android.text.TextUtils.substring import android.util.Log import android.util.TypedValue import android.view.LayoutInflater @@ -207,11 +208,11 @@ class ChannelFragment : Fragment() { refreshLayout?.isRefreshing = false; runOnUiThread { view.findViewById(R.id.channel_scrollView).visibility = View.VISIBLE - view.findViewById(R.id.channel_name).text=response.name + view.findViewById(R.id.channel_name).text = if (response.name?.length!! > 19) response.name.toString().substring(0,16) + "..." else response.name val channelVerified = view.findViewById(R.id.channel_verified) if (response.verified) channelVerified.visibility = View.VISIBLE view.findViewById(R.id.channel_subs).text=resources.getString(R.string.subscribers, response.subscriberCount.formatShort()) - view.findViewById(R.id.channel_description).text=response.description + view.findViewById(R.id.channel_description).text=response.description?.trim() val bannerImage = view.findViewById(R.id.channel_banner) val channelImage = view.findViewById(R.id.channel_image) Picasso.get().load(response.bannerUrl).into(bannerImage) diff --git a/app/src/main/java/com/github/libretube/PlayerFragment.kt b/app/src/main/java/com/github/libretube/PlayerFragment.kt index 459a9809c..ce00bfca7 100644 --- a/app/src/main/java/com/github/libretube/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/PlayerFragment.kt @@ -536,9 +536,9 @@ class PlayerFragment : Fragment() { view.findViewById(R.id.player_description).text = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - Html.fromHtml(response.description, Html.FROM_HTML_MODE_COMPACT) + Html.fromHtml(response.description, Html.FROM_HTML_MODE_COMPACT).trim() } else { - Html.fromHtml(response.description) + Html.fromHtml(response.description).trim() } view.findViewById(R.id.player_views_info).text = response.views.formatShort() + " views • " + response.uploadDate 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 bdd0f0811..36bdcaf58 100644 --- a/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt +++ b/app/src/main/java/com/github/libretube/adapters/CommentsAdapter.kt @@ -1,11 +1,15 @@ package com.github.libretube.adapters +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView +import androidx.constraintlayout.motion.widget.MotionLayout +import androidx.core.os.bundleOf import androidx.recyclerview.widget.RecyclerView +import com.github.libretube.MainActivity import com.github.libretube.R import com.github.libretube.formatShort import com.github.libretube.obj.Comment @@ -27,8 +31,8 @@ class CommentsAdapter(private val comments: MutableList): RecyclerView override fun onBindViewHolder(holder: ViewHolder, position: Int) { holder.v.findViewById(R.id.comment_infos).text = comments[position].author.toString() + " • " + comments[position].commentedTime.toString() holder.v.findViewById(R.id.comment_text).text = comments[position].commentText.toString() - val thumbnailImage = holder.v.findViewById(R.id.commentor_image) - Picasso.get().load(comments[position].thumbnail).fit().centerCrop().into(thumbnailImage) + val channelImage = holder.v.findViewById(R.id.commentor_image) + Picasso.get().load(comments[position].thumbnail).fit().centerCrop().into(channelImage) holder.v.findViewById(R.id.likes_textView).text = comments[position].likeCount?.toLong().formatShort() if (comments[position].verified == true) { holder.v.findViewById(R.id.verified_imageView).visibility = View.VISIBLE @@ -39,6 +43,20 @@ class CommentsAdapter(private val comments: MutableList): RecyclerView if (comments[position].hearted == true) { holder.v.findViewById(R.id.hearted_imageView).visibility = View.VISIBLE } + channelImage.setOnClickListener{ + val activity = holder.v.context as MainActivity + val bundle = bundleOf("channel_id" to comments[position].commentorUrl) + activity.navController.navigate(R.id.channel, bundle) + try { + val mainMotionLayout = activity.findViewById(R.id.mainMotionLayout) + if (mainMotionLayout.progress == 0.toFloat()) { + mainMotionLayout.transitionToEnd() + activity.findViewById(R.id.playerMotionLayout).transitionToEnd() + } + }catch (e: Exception){ + + } + } } override fun getItemCount(): Int { diff --git a/app/src/main/res/layout/fragment_channel.xml b/app/src/main/res/layout/fragment_channel.xml index 28c666278..cf565285a 100644 --- a/app/src/main/res/layout/fragment_channel.xml +++ b/app/src/main/res/layout/fragment_channel.xml @@ -95,20 +95,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="10dp" - android:layout_marginBottom="5dp" + android:layout_marginBottom="15dp" android:text="" /> - -