Display song artist for albums and artists
This commit is contained in:
parent
018acb456f
commit
978fcea9d0
3 changed files with 28 additions and 95 deletions
|
@ -15,6 +15,7 @@
|
|||
package io.github.muntashirakon.music.adapter.song
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import io.github.muntashirakon.music.interfaces.ICabHolder
|
||||
|
@ -41,9 +42,12 @@ class SimpleSongAdapter(
|
|||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
super.onBindViewHolder(holder, position)
|
||||
val fixedTrackNumber = MusicUtil.getFixedTrackNumber(dataSet[position].trackNumber)
|
||||
val trackAndTime = (if (fixedTrackNumber > 0) "$fixedTrackNumber | " else "") +
|
||||
MusicUtil.getReadableDurationString(dataSet[position].duration)
|
||||
|
||||
holder.imageText?.text = if (fixedTrackNumber > 0) fixedTrackNumber.toString() else "-"
|
||||
holder.time?.text = MusicUtil.getReadableDurationString(dataSet[position].duration)
|
||||
holder.imageText?.visibility = View.GONE
|
||||
holder.time?.text = trackAndTime
|
||||
holder.text2?.text = dataSet[position].artistName
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/colorSurface">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:liftOnScroll="true">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/Toolbar"
|
||||
app:layout_collapseMode="pin"
|
||||
app:navigationIcon="@drawable/ic_keyboard_backspace_black"
|
||||
app:title="@string/support_development"
|
||||
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/donation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="@string/donation_header"
|
||||
android:textAppearance="@style/TextViewSubtitle2"
|
||||
android:textColor="?attr/colorAccent" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/progressContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start"
|
||||
android:paddingLeft="16dp"
|
||||
android:text="@string/loading_products"
|
||||
android:textAppearance="@style/TextViewCaption"
|
||||
tools:ignore="RtlHardcoded,RtlSymmetry" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="6dp"
|
||||
android:paddingEnd="6dp"
|
||||
android:scrollbarStyle="outsideOverlay" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -31,37 +31,45 @@
|
|||
android:minHeight="40dp"
|
||||
android:textAppearance="@style/TextViewNormal"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
tools:text="@tools:sample/date/hhmm" />
|
||||
tools:text="@tools:sample/us_zipcodes" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextViewBody1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/time"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:paddingTop="8dp"
|
||||
android:textAppearance="@style/TextViewBody2"
|
||||
app:layout_constraintEnd_toStartOf="@+id/menu"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/text2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextViewCaption"
|
||||
app:layout_constraintStart_toEndOf="@id/imageContainer"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:padding="8dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/menu"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextViewCaption"
|
||||
app:layout_constraintEnd_toStartOf="@id/menu"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
tools:text="@tools:sample/date/hhmm" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/menu"
|
||||
style="@style/OverFlowButton"
|
||||
|
@ -74,4 +82,5 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:tint="?attr/colorControlNormal"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Add table
Add a link
Reference in a new issue