mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
Follow-up to #2929. Simplified layouts.
This commit is contained in:
parent
7d80eb301c
commit
e584d7bed5
@ -1,8 +1,8 @@
|
||||
package com.github.libretube.ui.adapters
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.libretube.databinding.BottomSheetItemBinding
|
||||
import com.github.libretube.obj.BottomSheetItem
|
||||
@ -23,17 +23,16 @@ class BottomSheetAdapter(
|
||||
|
||||
override fun onBindViewHolder(holder: BottomSheetViewHolder, position: Int) {
|
||||
val item = items[position]
|
||||
holder.binding.apply {
|
||||
holder.binding.sheetItem.apply {
|
||||
val current = item.getCurrent()
|
||||
title.text =
|
||||
if (current != null) "${item.title} ($current)" else item.title
|
||||
if (item.drawable != null) {
|
||||
drawable.setImageResource(item.drawable)
|
||||
} else {
|
||||
drawable.visibility = View.GONE
|
||||
}
|
||||
text = if (current != null) "${item.title} ($current)" else item.title
|
||||
setCompoundDrawablesRelative(
|
||||
if (item.drawable != null) {
|
||||
AppCompatResources.getDrawable(context, item.drawable)
|
||||
} else null, null, null, null
|
||||
)
|
||||
|
||||
root.setOnClickListener {
|
||||
setOnClickListener {
|
||||
item.onClick.invoke()
|
||||
listener.invoke(position)
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ class CommentsAdapter(
|
||||
if (comment.verified) verifiedImageView.visibility = View.VISIBLE
|
||||
if (comment.pinned) pinnedImageView.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) {
|
||||
repliesCount.text = comment.replyCount.formatShort()
|
||||
}
|
||||
@ -77,7 +77,6 @@ class CommentsAdapter(
|
||||
|
||||
if (isRepliesAdapter) {
|
||||
repliesCount.visibility = View.GONE
|
||||
repliesAvailable.visibility = View.GONE
|
||||
|
||||
// highlight the comment that is being replied to
|
||||
if (comment == comments.firstOrNull()) {
|
||||
|
@ -58,7 +58,7 @@ class CommentsMainFragment : Fragment() {
|
||||
viewModel.commentsPage.observe(viewLifecycleOwner) {
|
||||
it ?: return@observe
|
||||
binding.progress.visibility = View.GONE
|
||||
if (it.disabled == true) {
|
||||
if (it.disabled) {
|
||||
binding.errorTV.visibility = View.VISIBLE
|
||||
return@observe
|
||||
}
|
||||
|
@ -0,0 +1,113 @@
|
||||
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.
|
||||
*/
|
||||
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?> {
|
||||
val startDimen = drawableStartDimen.toInt()
|
||||
val start = drawables[0]
|
||||
if (startDimen > 0 && start != null) {
|
||||
start.setBounds(0, 0, startDimen, startDimen)
|
||||
drawables[0] = start
|
||||
}
|
||||
val tDimen = drawableTopDimen.toInt()
|
||||
val top = drawables[1]
|
||||
if (tDimen > 0 && top != null) {
|
||||
top.setBounds(0, 0, tDimen, tDimen)
|
||||
drawables[1] = top
|
||||
}
|
||||
val endDimen = drawableEndDimen.toInt()
|
||||
val end = drawables[2]
|
||||
if (endDimen > 0 && end != null) {
|
||||
end.setBounds(0, 0, endDimen, endDimen)
|
||||
drawables[2] = end
|
||||
}
|
||||
val bDimen = drawableBottomDimen.toInt()
|
||||
val bottom = drawables[3]
|
||||
if (bDimen > 0 && bottom != null) {
|
||||
bottom.setBounds(0, 0, bDimen, bDimen)
|
||||
drawables[3] = bottom
|
||||
}
|
||||
return drawables
|
||||
}
|
||||
|
||||
fun setDrawables(
|
||||
start: Drawable? = null,
|
||||
top: Drawable? = null,
|
||||
end: Drawable? = null,
|
||||
bottom: Drawable? = null
|
||||
) {
|
||||
TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||
this,
|
||||
start,
|
||||
top,
|
||||
end,
|
||||
bottom
|
||||
)
|
||||
}
|
||||
|
||||
fun setDrawableStartDimension(
|
||||
start: Float = drawableStartDimen,
|
||||
top: Float = drawableTopDimen,
|
||||
end: Float = drawableEndDimen,
|
||||
bottom: Float = drawableBottomDimen
|
||||
) {
|
||||
drawableStartDimen = start
|
||||
drawableTopDimen = top
|
||||
drawableEndDimen = end
|
||||
drawableBottomDimen = bottom
|
||||
}
|
||||
}
|
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,14 @@
|
||||
<?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"
|
||||
android:id="@+id/sheet_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="30dp"
|
||||
android:paddingVertical="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="12dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/drawable"
|
||||
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>
|
||||
android:drawablePadding="25dp"
|
||||
android:textSize="16sp"
|
||||
tools:drawableStart="@drawable/ic_download"
|
||||
tools:text="Option" />
|
@ -11,128 +11,118 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="15dp"
|
||||
android:paddingEnd="15dp"
|
||||
app:layout_constraintBottom_toBottomOf="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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
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" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<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>
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/comment_text"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/comment_infos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textSize="15sp"
|
||||
android:autoLink="web"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:textAlignment="viewStart"
|
||||
tools:text="Comment Text" />
|
||||
android:textSize="14sp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
tools:text="Octacat • 10h" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/verified_imageView"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_verified"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/likes_imageView"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginTop="2dp"
|
||||
app:srcCompat="@drawable/ic_thumb_up" />
|
||||
<ImageView
|
||||
android:id="@+id/pinned_imageView"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginStart="4dp"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_pinned"
|
||||
tools:visibility="visible" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/likes_textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
tools:text="LikeCount" />
|
||||
<TextView
|
||||
android:id="@+id/comment_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:textSize="15sp"
|
||||
android:autoLink="web"
|
||||
android:textAlignment="viewStart"
|
||||
tools:text="Comment Text" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/hearted_imageView"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_hearted" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/replies_available"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_comment" />
|
||||
<com.github.libretube.ui.views.DrawableTextView
|
||||
android:id="@+id/likes_textView"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:includeFontPadding="false"
|
||||
android:drawablePadding="6dp"
|
||||
app:drawableStartCompat="@drawable/ic_thumb_up"
|
||||
app:drawableStartDimen="16dp"
|
||||
tools:text="1.2k" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/replies_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
tools:text="ReplyCount" />
|
||||
<ImageView
|
||||
android:id="@+id/hearted_imageView"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
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>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
@ -29,6 +29,8 @@
|
||||
android:id="@+id/player_title_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
@ -70,43 +72,28 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="5dp"
|
||||
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_height="wrap_content"
|
||||
android:layout_marginStart="3dp"
|
||||
android:layout_marginTop="2dp">
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:drawablePadding="5dp"
|
||||
app:drawableStartCompat="@drawable/ic_like"
|
||||
app:drawableStartDimen="12dp"
|
||||
tools:text="4.2K" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_like" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textLike"
|
||||
android:layout_width="wrap_content"
|
||||
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>
|
||||
<com.github.libretube.ui.views.DrawableTextView
|
||||
android:id="@+id/textDislike"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:drawablePadding="5dp"
|
||||
app:drawableStartCompat="@drawable/ic_dislike"
|
||||
app:drawableStartDimen="12dp"
|
||||
tools:text="1.3K" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -339,29 +326,19 @@
|
||||
app:strokeWidth="1dp"
|
||||
tools:ignore="RtlSymmetry">
|
||||
|
||||
<LinearLayout
|
||||
<com.github.libretube.ui.views.DrawableTextView
|
||||
android:id="@+id/sb_skip_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/skip_segment"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<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>
|
||||
android:visibility="gone"
|
||||
android:text="@string/skip_segment"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="18sp"
|
||||
android:drawablePadding="20dp"
|
||||
app:drawableEndCompat="@drawable/ic_next"
|
||||
app:drawableEndDimen="20dp"
|
||||
app:drawableTint="@android:color/white" />
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
|
@ -1,43 +1,34 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="8dp">
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="8dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
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
|
||||
<com.github.libretube.ui.views.DrawableTextView
|
||||
android:id="@+id/history_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:textAlignment="viewStart"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/delete_history"
|
||||
app:layout_constraintStart_toEndOf="@id/history_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="History item"/>
|
||||
android:drawablePadding="15dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:drawableStartCompat="@drawable/ic_history"
|
||||
tools:text="Suggestion item" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/delete_history"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/ic_close"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:shapeAppearanceOverlay="@style/roundedImageViewRounded" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
@ -1,38 +1,29 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="8dp">
|
||||
android:gravity="center_vertical"
|
||||
android:paddingVertical="8dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
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
|
||||
<com.github.libretube.ui.views.DrawableTextView
|
||||
android:id="@+id/suggestion_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:textAlignment="viewStart"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/arrow"
|
||||
app:layout_constraintStart_toEndOf="@id/search_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="Suggestion item"/>
|
||||
android:drawablePadding="15dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
app:drawableStartCompat="@drawable/ic_search"
|
||||
tools:text="Suggestion item" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/arrow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:padding="5dp"
|
||||
@ -40,4 +31,4 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:shapeAppearanceOverlay="@style/roundedImageViewRounded" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
@ -8,4 +8,13 @@
|
||||
<attr name="defValue" format="float" />
|
||||
</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>
|
||||
|
Loading…
Reference in New Issue
Block a user