aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-05-09 21:29:49 -0700
committerScott Jackson <daneren2005@gmail.com>2013-05-09 21:29:49 -0700
commit4bc80103be097c22f360447756658267eb2943c0 (patch)
tree6c159bd02363879e9e2523eda34bea921eed8d1a /subsonic-android
parent9b81170e0bc2ffe6fa635e52563f4509546b0d26 (diff)
downloaddsub-4bc80103be097c22f360447756658267eb2943c0.tar.gz
dsub-4bc80103be097c22f360447756658267eb2943c0.tar.bz2
dsub-4bc80103be097c22f360447756658267eb2943c0.zip
Add song length total to album header
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/res/layout/select_album_header.xml13
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java8
2 files changed, 21 insertions, 0 deletions
diff --git a/subsonic-android/res/layout/select_album_header.xml b/subsonic-android/res/layout/select_album_header.xml
index 63e91887..3af34a99 100644
--- a/subsonic-android/res/layout/select_album_header.xml
+++ b/subsonic-android/res/layout/select_album_header.xml
@@ -55,6 +55,19 @@
android:textSize="10sp"
android:singleLine="true"
android:ellipsize="none"/>
+
+ <TextView
+ android:text="0:00"
+ android:id="@+id/select_album_song_length"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/select_album_song_count"
+ android:layout_toRightOf="@+id/select_album_art"
+ android:paddingRight="4dip"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textSize="10sp"
+ android:singleLine="true"
+ android:ellipsize="none"/>
</RelativeLayout>
diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index 1e4bfc07..8cd66f5f 100644
--- a/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -643,12 +643,17 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
int songCount = 0;
Set<String> artists = new HashSet<String>();
+ Integer totalDuration = 0;
for (MusicDirectory.Entry entry : entries) {
if (!entry.isDirectory()) {
songCount++;
if (entry.getArtist() != null) {
artists.add(entry.getArtist());
}
+ Integer duration = entry.getDuration();
+ if(duration != null) {
+ totalDuration += duration;
+ }
}
}
@@ -663,6 +668,9 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Adapter
TextView songCountView = (TextView) header.findViewById(R.id.select_album_song_count);
String s = context.getResources().getQuantityString(R.plurals.select_album_n_songs, songCount, songCount);
songCountView.setText(s.toUpperCase());
+
+ TextView songLengthView = (TextView) header.findViewById(R.id.select_album_song_length);
+ songLengthView.setText(Util.formatDuration(totalDuration));
if(add) {
return header;