Better info texts for album page
This commit is contained in:
parent
21d7b3d5df
commit
f93407ca35
3 changed files with 14 additions and 11 deletions
|
|
@ -437,8 +437,8 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
|||
|
||||
getSupportActionBar().setTitle(album.getTitle());
|
||||
artistTextView.setText(album.getArtistName());
|
||||
songCountTextView.setText(MusicUtil.getSongCountString(this, album.getSongCount()));
|
||||
durationTextView.setText(MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(this, album.songs)));
|
||||
songCountTextView.setText(String.valueOf(album.getSongCount()));
|
||||
albumYearTextView.setText(String.valueOf(album.getYear()));
|
||||
|
||||
adapter.swapDataSet(album.songs);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ import org.jaudiotagger.audio.AudioFileIO;
|
|||
import org.jaudiotagger.tag.FieldKey;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -124,10 +123,14 @@ public class MusicUtil {
|
|||
|
||||
@NonNull
|
||||
public static String getPlaylistInfoString(@NonNull final Context context, @NonNull List<Song> songs) {
|
||||
final int songCount = songs.size();
|
||||
final String songString = songCount == 1 ? context.getResources().getString(R.string.song) : context.getResources().getString(R.string.songs);
|
||||
final long duration = getTotalDuration(context, songs);
|
||||
return songCount + " " + songString + " • " + MusicUtil.getReadableDurationString(duration);
|
||||
return MusicUtil.getSongCountString(context, songs.size()) + " • " + MusicUtil.getReadableDurationString(duration);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static String getSongCountString(@NonNull final Context context, int songCount) {
|
||||
final String songString = songCount == 1 ? context.getResources().getString(R.string.song) : context.getResources().getString(R.string.songs);
|
||||
return songCount + " " + songString;
|
||||
}
|
||||
|
||||
public static long getTotalDuration(@NonNull final Context context, @NonNull List<Song> songs) {
|
||||
|
|
|
|||
|
|
@ -108,18 +108,18 @@
|
|||
android:paddingStart="0dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/duration_icon"
|
||||
android:id="@+id/song_count_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="0dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="0dp"
|
||||
app:srcCompat="@drawable/ic_access_time_white_24dp"
|
||||
app:srcCompat="@drawable/ic_music_note_white_24dp"
|
||||
tools:ignore="ContentDescription,UnusedAttribute" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/duration_text"
|
||||
android:id="@+id/song_count_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
|
|
@ -138,18 +138,18 @@
|
|||
android:paddingStart="0dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/song_count_icon"
|
||||
android:id="@+id/duration_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginLeft="0dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginStart="0dp"
|
||||
app:srcCompat="@drawable/ic_music_note_white_24dp"
|
||||
app:srcCompat="@drawable/ic_timer_white_24dp"
|
||||
tools:ignore="ContentDescription,UnusedAttribute" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_count_text"
|
||||
android:id="@+id/duration_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue