diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/view/SongView.java | 11 | ||||
-rw-r--r-- | app/src/main/res/layout/song_list_item.xml | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/view/SongView.java b/app/src/main/java/github/daneren2005/dsub/view/SongView.java index 625303b7..13620715 100644 --- a/app/src/main/java/github/daneren2005/dsub/view/SongView.java +++ b/app/src/main/java/github/daneren2005/dsub/view/SongView.java @@ -41,6 +41,7 @@ import java.io.File; public class SongView extends UpdateView2<MusicDirectory.Entry, Boolean> { private static final String TAG = SongView.class.getSimpleName(); + private TextView trackTextView; private TextView titleTextView; private TextView artistTextView; private TextView durationTextView; @@ -70,6 +71,7 @@ public class SongView extends UpdateView2<MusicDirectory.Entry, Boolean> { super(context); LayoutInflater.from(context).inflate(R.layout.song_list_item, this, true); + trackTextView = (TextView) findViewById(R.id.song_track); titleTextView = (TextView) findViewById(R.id.song_title); artistTextView = (TextView) findViewById(R.id.song_artist); durationTextView = (TextView) findViewById(R.id.song_duration); @@ -139,7 +141,10 @@ public class SongView extends UpdateView2<MusicDirectory.Entry, Boolean> { String title = song.getTitle(); Integer track = song.getTrack(); if(track != null && Util.getDisplayTrack(context)) { - title = String.format("%02d", track) + " " + title; + trackTextView.setText(String.format("%02d", track)); + trackTextView.setVisibility(View.VISIBLE); + } else { + trackTextView.setVisibility(View.GONE); } titleTextView.setText(title); @@ -246,12 +251,12 @@ public class SongView extends UpdateView2<MusicDirectory.Entry, Boolean> { if (playing) { if(!this.playing) { this.playing = playing; - titleTextView.setCompoundDrawablesWithIntrinsicBounds(DrawableTint.getDrawableRes(context, R.attr.playing), 0, 0, 0); + trackTextView.setCompoundDrawablesWithIntrinsicBounds(DrawableTint.getDrawableRes(context, R.attr.playing), 0, 0, 0); } } else { if(this.playing) { this.playing = playing; - titleTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); + trackTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); } } diff --git a/app/src/main/res/layout/song_list_item.xml b/app/src/main/res/layout/song_list_item.xml index 6bf025b8..30b86d3b 100644 --- a/app/src/main/res/layout/song_list_item.xml +++ b/app/src/main/res/layout/song_list_item.xml @@ -17,6 +17,16 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical"> + <TextView + android:id="@+id/song_track" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="left|center_vertical" + android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="?android:textColorSecondary" + android:paddingLeft="6dip" + android:drawablePadding="6dip"/> + <TextView android:id="@+id/song_title" android:layout_width="0dip" @@ -26,7 +36,6 @@ android:textAppearance="?android:attr/textAppearanceMedium" android:singleLine="true" android:ellipsize="marquee" - android:drawablePadding="6dip" android:paddingLeft="6dip" android:paddingRight="6dip" android:textColor="?android:textColorPrimary"/> |