mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
Merge pull request #2936 from faisalcodes/master
Follow-up to #2929. Simplified layouts.
This commit is contained in:
commit
8d11d06d6d
@ -1,11 +1,11 @@
|
|||||||
package com.github.libretube.ui.adapters
|
package com.github.libretube.ui.adapters
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.databinding.BottomSheetItemBinding
|
import com.github.libretube.databinding.BottomSheetItemBinding
|
||||||
import com.github.libretube.obj.BottomSheetItem
|
import com.github.libretube.obj.BottomSheetItem
|
||||||
|
import com.github.libretube.ui.extensions.setDrawables
|
||||||
import com.github.libretube.ui.viewholders.BottomSheetViewHolder
|
import com.github.libretube.ui.viewholders.BottomSheetViewHolder
|
||||||
|
|
||||||
class BottomSheetAdapter(
|
class BottomSheetAdapter(
|
||||||
@ -23,17 +23,12 @@ class BottomSheetAdapter(
|
|||||||
|
|
||||||
override fun onBindViewHolder(holder: BottomSheetViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: BottomSheetViewHolder, position: Int) {
|
||||||
val item = items[position]
|
val item = items[position]
|
||||||
holder.binding.apply {
|
holder.binding.root.apply {
|
||||||
val current = item.getCurrent()
|
val current = item.getCurrent()
|
||||||
title.text =
|
text = if (current != null) "${item.title} ($current)" else item.title
|
||||||
if (current != null) "${item.title} ($current)" else item.title
|
setDrawables(start = item.drawable)
|
||||||
if (item.drawable != null) {
|
|
||||||
drawable.setImageResource(item.drawable)
|
|
||||||
} else {
|
|
||||||
drawable.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
root.setOnClickListener {
|
setOnClickListener {
|
||||||
item.onClick.invoke()
|
item.onClick.invoke()
|
||||||
listener.invoke(position)
|
listener.invoke(position)
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ class CommentsAdapter(
|
|||||||
if (comment.verified) verifiedImageView.visibility = View.VISIBLE
|
if (comment.verified) verifiedImageView.visibility = View.VISIBLE
|
||||||
if (comment.pinned) pinnedImageView.visibility = View.VISIBLE
|
if (comment.pinned) pinnedImageView.visibility = View.VISIBLE
|
||||||
if (comment.hearted) heartedImageView.visibility = View.VISIBLE
|
if (comment.hearted) heartedImageView.visibility = View.VISIBLE
|
||||||
if (comment.repliesPage != null) repliesAvailable.visibility = View.VISIBLE
|
if (comment.repliesPage != null) repliesCount.visibility = View.VISIBLE
|
||||||
if (comment.replyCount > 0L) {
|
if (comment.replyCount > 0L) {
|
||||||
repliesCount.text = comment.replyCount.formatShort()
|
repliesCount.text = comment.replyCount.formatShort()
|
||||||
}
|
}
|
||||||
@ -77,7 +77,6 @@ class CommentsAdapter(
|
|||||||
|
|
||||||
if (isRepliesAdapter) {
|
if (isRepliesAdapter) {
|
||||||
repliesCount.visibility = View.GONE
|
repliesCount.visibility = View.GONE
|
||||||
repliesAvailable.visibility = View.GONE
|
|
||||||
|
|
||||||
// highlight the comment that is being replied to
|
// highlight the comment that is being replied to
|
||||||
if (comment == comments.firstOrNull()) {
|
if (comment == comments.firstOrNull()) {
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.github.libretube.ui.extensions
|
||||||
|
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
|
import androidx.core.widget.TextViewCompat
|
||||||
|
|
||||||
|
fun TextView.setDrawables(
|
||||||
|
start: Int? = null,
|
||||||
|
top: Int? = null,
|
||||||
|
end: Int? = null,
|
||||||
|
bottom: Int? = null
|
||||||
|
) {
|
||||||
|
setDrawables(
|
||||||
|
start?.let { AppCompatResources.getDrawable(context, it) },
|
||||||
|
top?.let { AppCompatResources.getDrawable(context, it) },
|
||||||
|
end?.let { AppCompatResources.getDrawable(context, it) },
|
||||||
|
bottom?.let { AppCompatResources.getDrawable(context, it) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun TextView.setDrawables(
|
||||||
|
start: Drawable? = null,
|
||||||
|
top: Drawable? = null,
|
||||||
|
end: Drawable? = null,
|
||||||
|
bottom: Drawable? = null
|
||||||
|
) {
|
||||||
|
TextViewCompat.setCompoundDrawablesRelative(this, start, top, end, bottom)
|
||||||
|
}
|
@ -58,7 +58,7 @@ class CommentsMainFragment : Fragment() {
|
|||||||
viewModel.commentsPage.observe(viewLifecycleOwner) {
|
viewModel.commentsPage.observe(viewLifecycleOwner) {
|
||||||
it ?: return@observe
|
it ?: return@observe
|
||||||
binding.progress.visibility = View.GONE
|
binding.progress.visibility = View.GONE
|
||||||
if (it.disabled == true) {
|
if (it.disabled) {
|
||||||
binding.errorTV.visibility = View.VISIBLE
|
binding.errorTV.visibility = View.VISIBLE
|
||||||
return@observe
|
return@observe
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
package com.github.libretube.ui.views
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.res.TypedArray
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.Gravity
|
||||||
|
import androidx.appcompat.widget.AppCompatTextView
|
||||||
|
import androidx.core.widget.TextViewCompat
|
||||||
|
import com.github.libretube.R
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TextView with custom sizable drawable support.
|
||||||
|
* It may only be used for icons as it gives same width and height to the drawable.
|
||||||
|
*/
|
||||||
|
class DrawableTextView(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null
|
||||||
|
) : AppCompatTextView(context, attrs) {
|
||||||
|
|
||||||
|
private var drawableStartDimen = 0F
|
||||||
|
private var drawableTopDimen = 0F
|
||||||
|
private var drawableEndDimen = 0F
|
||||||
|
private var drawableBottomDimen = 0F
|
||||||
|
|
||||||
|
init {
|
||||||
|
val ta = getContext().obtainStyledAttributes(attrs, R.styleable.DrawableTextView, 0, 0)
|
||||||
|
try {
|
||||||
|
drawableStartDimen = getDimen(ta, R.styleable.DrawableTextView_drawableStartDimen)
|
||||||
|
drawableTopDimen = getDimen(ta, R.styleable.DrawableTextView_drawableTopDimen)
|
||||||
|
drawableEndDimen = getDimen(ta, R.styleable.DrawableTextView_drawableEndDimen)
|
||||||
|
drawableBottomDimen = getDimen(ta, R.styleable.DrawableTextView_drawableBottomDimen)
|
||||||
|
|
||||||
|
gravity = ta.getInt(
|
||||||
|
R.styleable.DrawableTextView_android_gravity,
|
||||||
|
Gravity.CENTER_VERTICAL
|
||||||
|
)
|
||||||
|
compoundDrawablePadding = ta.getDimensionPixelOffset(
|
||||||
|
R.styleable.DrawableTextView_android_drawablePadding,
|
||||||
|
20
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
ta.recycle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getDimen(ta: TypedArray, index: Int): Float {
|
||||||
|
return ta.getDimensionPixelOffset(index, 0).toFloat()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
|
||||||
|
super.onLayout(changed, left, top, right, bottom)
|
||||||
|
val relDrawables = adjust(compoundDrawablesRelative)
|
||||||
|
setCompoundDrawablesRelative(
|
||||||
|
relDrawables[0],
|
||||||
|
relDrawables[1],
|
||||||
|
relDrawables[2],
|
||||||
|
relDrawables[3]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun adjust(drawables: Array<Drawable?>): Array<Drawable?> {
|
||||||
|
listOf(drawableStartDimen, drawableTopDimen, drawableEndDimen, drawableBottomDimen).forEachIndexed { index, dimen ->
|
||||||
|
drawables[index] = drawables[index].getAdjustedDrawable(dimen)
|
||||||
|
}
|
||||||
|
return drawables
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun Drawable?.getAdjustedDrawable(dimen: Float): Drawable? {
|
||||||
|
this ?: return null
|
||||||
|
dimen.toInt().let {
|
||||||
|
if (it > 0) setBounds(0, 0, it, it)
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setDrawables(
|
||||||
|
start: Drawable? = null,
|
||||||
|
top: Drawable? = null,
|
||||||
|
end: Drawable? = null,
|
||||||
|
bottom: Drawable? = null
|
||||||
|
) {
|
||||||
|
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||||
|
this,
|
||||||
|
start,
|
||||||
|
top,
|
||||||
|
end,
|
||||||
|
bottom
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setDrawablesDimension(
|
||||||
|
start: Float = drawableStartDimen,
|
||||||
|
top: Float = drawableTopDimen,
|
||||||
|
end: Float = drawableEndDimen,
|
||||||
|
bottom: Float = drawableBottomDimen
|
||||||
|
) {
|
||||||
|
drawableStartDimen = start
|
||||||
|
drawableTopDimen = top
|
||||||
|
drawableEndDimen = end
|
||||||
|
drawableBottomDimen = bottom
|
||||||
|
|
||||||
|
invalidate()
|
||||||
|
}
|
||||||
|
}
|
9
app/src/main/res/drawable/ic_dislike.xml
Normal file
9
app/src/main/res/drawable/ic_dislike.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:height="24dp"
|
||||||
|
android:tint="?attr/colorControlNormal"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24" android:width="24dp">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M15,3L6,3c-0.83,0 -1.54,0.5 -1.84,1.22l-3.02,7.05c-0.09,0.23 -0.14,0.47 -0.14,0.73v2c0,1.1 0.9,2 2,2h6.31l-0.95,4.57 -0.03,0.32c0,0.41 0.17,0.79 0.44,1.06L9.83,23l6.59,-6.59c0.36,-0.36 0.58,-0.86 0.58,-1.41L17,5c0,-1.1 -0.9,-2 -2,-2zM19,3v12h4L23,3h-4z" />
|
||||||
|
</vector>
|
@ -1,28 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingHorizontal="30dp"
|
android:paddingHorizontal="30dp"
|
||||||
|
android:paddingVertical="12dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingVertical="12dp">
|
android:drawablePadding="25dp"
|
||||||
|
android:textSize="16sp"
|
||||||
<ImageView
|
tools:drawableStart="@drawable/ic_download"
|
||||||
android:id="@+id/drawable"
|
tools:text="Option" />
|
||||||
android:layout_width="24dp"
|
|
||||||
android:layout_height="24dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginEnd="25dp"
|
|
||||||
tools:src="@drawable/ic_download" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/title"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
tools:text="Option" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -11,128 +11,118 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:orientation="vertical"
|
android:layout_marginBottom="16dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
android:paddingStart="15dp"
|
android:paddingStart="15dp"
|
||||||
android:paddingEnd="15dp"
|
android:paddingEnd="15dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<com.google.android.material.imageview.ShapeableImageView
|
||||||
|
android:id="@+id/commentor_image"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:background="@android:color/darker_gray"
|
||||||
|
app:shapeAppearance="@style/CircleImageView"
|
||||||
|
tools:src="@mipmap/ic_launcher" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="16dp"
|
android:orientation="vertical">
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
<com.google.android.material.imageview.ShapeableImageView
|
|
||||||
android:id="@+id/commentor_image"
|
|
||||||
android:layout_width="32dp"
|
|
||||||
android:layout_height="32dp"
|
|
||||||
android:layout_marginEnd="16dp"
|
|
||||||
android:background="@android:color/darker_gray"
|
|
||||||
app:shapeAppearance="@style/CircleImageView"
|
|
||||||
app:srcCompat="@mipmap/ic_launcher" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/comment_infos"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
tools:text="Author and Time" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/verified_imageView"
|
|
||||||
android:layout_width="16dp"
|
|
||||||
android:layout_height="16dp"
|
|
||||||
android:layout_marginStart="4dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:srcCompat="@drawable/ic_verified" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/pinned_imageView"
|
|
||||||
android:layout_width="16dp"
|
|
||||||
android:layout_height="16dp"
|
|
||||||
android:layout_marginStart="4dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:srcCompat="@drawable/ic_pinned" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/comment_text"
|
android:id="@+id/comment_infos"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:ellipsize="end"
|
||||||
android:layout_marginBottom="8dp"
|
android:maxLines="2"
|
||||||
android:textSize="15sp"
|
|
||||||
android:autoLink="web"
|
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
tools:text="Comment Text" />
|
android:textSize="14sp"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
tools:text="Octacat • 10h" />
|
||||||
|
|
||||||
<LinearLayout
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/verified_imageView"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="16dp"
|
||||||
android:orientation="horizontal">
|
android:layout_height="16dp"
|
||||||
|
android:layout_marginStart="4dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:srcCompat="@drawable/ic_verified"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/likes_imageView"
|
android:id="@+id/pinned_imageView"
|
||||||
android:layout_width="16dp"
|
android:layout_width="16dp"
|
||||||
android:layout_height="16dp"
|
android:layout_height="16dp"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginStart="4dp"
|
||||||
app:srcCompat="@drawable/ic_thumb_up" />
|
android:visibility="gone"
|
||||||
|
app:srcCompat="@drawable/ic_pinned"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/likes_textView"
|
android:id="@+id/comment_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="6dp"
|
android:layout_marginTop="5dp"
|
||||||
tools:text="LikeCount" />
|
android:layout_marginBottom="8dp"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:autoLink="web"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
tools:text="Comment Text" />
|
||||||
|
|
||||||
<ImageView
|
<LinearLayout
|
||||||
android:id="@+id/hearted_imageView"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="14dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="14dp"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginStart="8dp"
|
android:orientation="horizontal">
|
||||||
android:layout_marginTop="3dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:srcCompat="@drawable/ic_hearted" />
|
|
||||||
|
|
||||||
<ImageView
|
<com.github.libretube.ui.views.DrawableTextView
|
||||||
android:id="@+id/replies_available"
|
android:id="@+id/likes_textView"
|
||||||
android:layout_width="14dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="14dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginEnd="5dp"
|
||||||
android:layout_marginTop="3dp"
|
android:gravity="center_vertical"
|
||||||
android:visibility="gone"
|
android:includeFontPadding="false"
|
||||||
app:srcCompat="@drawable/ic_comment" />
|
android:drawablePadding="6dp"
|
||||||
|
app:drawableStartCompat="@drawable/ic_thumb_up"
|
||||||
|
app:drawableStartDimen="16dp"
|
||||||
|
tools:text="1.2k" />
|
||||||
|
|
||||||
<TextView
|
<ImageView
|
||||||
android:id="@+id/replies_count"
|
android:id="@+id/hearted_imageView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="14dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="14dp"
|
||||||
android:layout_marginStart="6dp"
|
android:layout_marginEnd="8dp"
|
||||||
tools:text="ReplyCount" />
|
android:visibility="gone"
|
||||||
|
app:srcCompat="@drawable/ic_hearted"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
</LinearLayout>
|
<com.github.libretube.ui.views.DrawableTextView
|
||||||
|
android:id="@+id/replies_count"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:drawablePadding="6dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:drawableStartCompat="@drawable/ic_comment"
|
||||||
|
app:drawableStartDimen="16dp"
|
||||||
|
tools:text="53"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
android:id="@+id/player_title_layout"
|
android:id="@+id/player_title_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?selectableItemBackground"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -70,43 +72,28 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
tools:text="10M views 2 days ago " />
|
tools:text="10M views 2 days ago " />
|
||||||
|
|
||||||
<LinearLayout
|
<com.github.libretube.ui.views.DrawableTextView
|
||||||
|
android:id="@+id/textLike"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="3dp"
|
android:layout_marginHorizontal="5dp"
|
||||||
android:layout_marginTop="2dp">
|
android:drawablePadding="5dp"
|
||||||
|
app:drawableStartCompat="@drawable/ic_like"
|
||||||
|
app:drawableStartDimen="12dp"
|
||||||
|
tools:text="4.2K" />
|
||||||
|
|
||||||
<ImageView
|
<com.github.libretube.ui.views.DrawableTextView
|
||||||
android:layout_width="12dp"
|
android:id="@+id/textDislike"
|
||||||
android:layout_height="12dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_height="wrap_content"
|
||||||
android:src="@drawable/ic_like" />
|
android:layout_marginHorizontal="5dp"
|
||||||
|
android:drawablePadding="5dp"
|
||||||
<TextView
|
app:drawableStartCompat="@drawable/ic_dislike"
|
||||||
android:id="@+id/textLike"
|
app:drawableStartDimen="12dp"
|
||||||
android:layout_width="wrap_content"
|
tools:text="1.3K" />
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
tools:text="4.2K" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="12dp"
|
|
||||||
android:layout_height="12dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:rotation="180"
|
|
||||||
android:src="@drawable/ic_like" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textDislike"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
tools:text="1.3K" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -339,29 +326,19 @@
|
|||||||
app:strokeWidth="1dp"
|
app:strokeWidth="1dp"
|
||||||
tools:ignore="RtlSymmetry">
|
tools:ignore="RtlSymmetry">
|
||||||
|
|
||||||
<LinearLayout
|
<com.github.libretube.ui.views.DrawableTextView
|
||||||
android:id="@+id/sb_skip_btn"
|
android:id="@+id/sb_skip_btn"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:visibility="gone">
|
android:visibility="gone"
|
||||||
|
android:text="@string/skip_segment"
|
||||||
<TextView
|
android:textColor="@android:color/white"
|
||||||
android:layout_width="wrap_content"
|
android:textSize="18sp"
|
||||||
android:layout_height="wrap_content"
|
android:drawablePadding="20dp"
|
||||||
android:text="@string/skip_segment"
|
app:drawableEndCompat="@drawable/ic_next"
|
||||||
android:textColor="@android:color/white"
|
app:drawableEndDimen="20dp"
|
||||||
android:textSize="18sp" />
|
app:drawableTint="@android:color/white" />
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="20dp"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginHorizontal="10dp"
|
|
||||||
android:src="@drawable/ic_next"
|
|
||||||
app:tint="@android:color/white" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
@ -1,43 +1,34 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
android:paddingVertical="8dp">
|
android:gravity="center_vertical"
|
||||||
|
android:paddingVertical="8dp"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
<com.github.libretube.ui.views.DrawableTextView
|
||||||
android:id="@+id/history_icon"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:src="@drawable/ic_history"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/history_text"
|
android:id="@+id/history_text"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="8dp"
|
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:drawablePadding="15dp"
|
||||||
app:layout_constraintEnd_toStartOf="@id/delete_history"
|
android:layout_marginEnd="10dp"
|
||||||
app:layout_constraintStart_toEndOf="@id/history_icon"
|
app:drawableStartCompat="@drawable/ic_history"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
tools:text="Suggestion item" />
|
||||||
tools:text="History item"/>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/delete_history"
|
android:id="@+id/delete_history"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:src="@drawable/ic_close"
|
android:src="@drawable/ic_close"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:shapeAppearanceOverlay="@style/roundedImageViewRounded" />
|
app:shapeAppearanceOverlay="@style/roundedImageViewRounded" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</LinearLayout>
|
||||||
|
@ -1,38 +1,29 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
android:paddingVertical="8dp">
|
android:gravity="center_vertical"
|
||||||
|
android:paddingVertical="8dp"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
<com.github.libretube.ui.views.DrawableTextView
|
||||||
android:id="@+id/search_icon"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:src="@drawable/ic_search"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/suggestion_text"
|
android:id="@+id/suggestion_text"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="8dp"
|
|
||||||
android:textAlignment="viewStart"
|
android:textAlignment="viewStart"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:drawablePadding="15dp"
|
||||||
app:layout_constraintEnd_toStartOf="@id/arrow"
|
android:layout_marginEnd="10dp"
|
||||||
app:layout_constraintStart_toEndOf="@id/search_icon"
|
app:drawableStartCompat="@drawable/ic_search"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
tools:text="Suggestion item" />
|
||||||
tools:text="Suggestion item"/>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/arrow"
|
android:id="@+id/arrow"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackgroundBorderless"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
@ -40,4 +31,4 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:shapeAppearanceOverlay="@style/roundedImageViewRounded" />
|
app:shapeAppearanceOverlay="@style/roundedImageViewRounded" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</LinearLayout>
|
||||||
|
@ -8,4 +8,13 @@
|
|||||||
<attr name="defValue" format="float" />
|
<attr name="defValue" format="float" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
|
<declare-styleable name="DrawableTextView">
|
||||||
|
<attr name="drawableStartDimen" format="dimension" />
|
||||||
|
<attr name="drawableTopDimen" format="dimension" />
|
||||||
|
<attr name="drawableEndDimen" format="dimension" />
|
||||||
|
<attr name="drawableBottomDimen" format="dimension" />
|
||||||
|
<attr name="android:drawablePadding" />
|
||||||
|
<attr name="android:gravity" />
|
||||||
|
</declare-styleable>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user