aboutsummaryrefslogtreecommitdiff
path: root/subsonic-android
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2012-11-14 21:05:09 -0800
committerScott Jackson <daneren2005@gmail.com>2012-11-14 21:05:09 -0800
commit1fd0c140dfa434cb55a7816056d7bfea0f3b2c22 (patch)
treefabe21bccb1dc0b5b1fafa371d1b9ca30ce326b0 /subsonic-android
parent2a025808f4dee7e6734afce25a1b4cf2e0cb29cb (diff)
downloaddsub-1fd0c140dfa434cb55a7816056d7bfea0f3b2c22.tar.gz
dsub-1fd0c140dfa434cb55a7816056d7bfea0f3b2c22.tar.bz2
dsub-1fd0c140dfa434cb55a7816056d7bfea0f3b2c22.zip
On delete cache don't pop back to the top of the list
Diffstat (limited to 'subsonic-android')
-rw-r--r--subsonic-android/res/layout/select_album_header.xml122
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java39
2 files changed, 95 insertions, 66 deletions
diff --git a/subsonic-android/res/layout/select_album_header.xml b/subsonic-android/res/layout/select_album_header.xml
index 7f5fb767..6905d421 100644
--- a/subsonic-android/res/layout/select_album_header.xml
+++ b/subsonic-android/res/layout/select_album_header.xml
@@ -1,69 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content">
+
+ <ImageView
+ android:id="@+id/select_album_art"
+ android:src="@drawable/unknown_album_large"
+ android:layout_width="120dip"
+ android:layout_height="120dip"
+ android:layout_alignParentTop="true"
+ android:layout_alignParentLeft="true"
+ android:layout_marginRight="10dip"
+ android:scaleType="fitCenter"
+ android:contentDescription="@null"/>
+
+ <TextView
+ android:text="This is the album title"
+ android:id="@+id/select_album_title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toRightOf="@+id/select_album_art"
+ android:paddingTop="20dip"
+ android:paddingBottom="8dip"
+ android:paddingRight="4dip"
+ android:textColor="@color/mediaControlForeground"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textStyle="bold"
+ android:singleLine="true"
+ android:ellipsize="end"/>
+
+ <TextView
+ android:text="This is the artist name"
+ android:id="@+id/select_album_artist"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/select_album_title"
+ android:layout_toRightOf="@+id/select_album_art"
+ android:paddingBottom="2dip"
+ android:paddingRight="4dip"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:singleLine="true"
+ android:ellipsize="end"/>
+
+ <TextView
+ android:text="XX SONGS"
+ android:id="@+id/select_album_song_count"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@+id/select_album_artist"
+ 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>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <LinearLayout
- android:orientation="horizontal"
- android:background="@drawable/menubar_button_normal"
- android:paddingTop="6dip"
- android:paddingBottom="4dip"
- android:paddingLeft="6dp"
- android:paddingRight="6dp"
- android:layout_weight="1"
- android:layout_width="fill_parent"
- android:layout_height="0dip">
-
- <ImageView
- android:id="@+id/select_album_cover_art"
- android:layout_gravity="center_vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
-
- <LinearLayout
- android:orientation="vertical"
- android:layout_weight="1"
- android:layout_width="0dip"
- android:layout_height="wrap_content">
-
- <TextView
- android:id="@+id/select_album_text1"
- android:singleLine="true"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:textColor="@android:color/primary_text_light"
- android:textAppearance="?android:attr/textAppearanceMedium"/>
-
- <TextView
- android:id="@+id/select_album_text2"
- android:singleLine="true"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:textColor="@android:color/secondary_text_light"
- android:textAppearance="?android:attr/textAppearanceSmall"/>
-
- </LinearLayout>
-
- <ImageButton
- android:id="@+id/select_album_play_all"
- android:src="@drawable/select_album_play_all"
- android:background="@android:color/transparent"
- android:layout_gravity="center_vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
-
- </LinearLayout>
-
- <View
- android:layout_width="fill_parent"
- android:layout_height="1px"
- android:background="@color/dividerColor"/>
-
-</LinearLayout>
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
index 9561500f..877a9452 100644
--- a/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
+++ b/subsonic-android/src/github/daneren2005/dsub/activity/SelectAlbumActivity.java
@@ -39,7 +39,9 @@ import github.daneren2005.dsub.service.MusicServiceFactory;
import github.daneren2005.dsub.util.*;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
public class SelectAlbumActivity extends SubsonicTabActivity {
@@ -553,6 +555,7 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
if (songCount > 0) {
getImageLoader().loadImage(getSupportActionBar(), entries.get(0));
+ entryList.addHeaderView(createHeader(entries), null, false);
entryList.addFooterView(footer);
} else {
hideButtons = true;
@@ -569,4 +572,40 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
}
}
}
+
+ private View createHeader(List<MusicDirectory.Entry> entries) {
+ View header = LayoutInflater.from(this).inflate(R.layout.select_album_header, entryList, false);
+
+ View coverArtView = header.findViewById(R.id.select_album_art);
+ getImageLoader().loadImage(coverArtView, entries.get(0), true, true);
+
+ TextView titleView = (TextView) header.findViewById(R.id.select_album_title);
+ titleView.setText(getTitle());
+
+ int songCount = 0;
+
+ Set<String> artists = new HashSet<String>();
+ for (MusicDirectory.Entry entry : entries) {
+ if (!entry.isDirectory()) {
+ songCount++;
+ if (entry.getArtist() != null) {
+ artists.add(entry.getArtist());
+ }
+ }
+ }
+
+ TextView artistView = (TextView) header.findViewById(R.id.select_album_artist);
+ if (artists.size() == 1) {
+ artistView.setText(artists.iterator().next());
+ artistView.setVisibility(View.VISIBLE);
+ } else {
+ artistView.setVisibility(View.GONE);
+ }
+
+ TextView songCountView = (TextView) header.findViewById(R.id.select_album_song_count);
+ String s = getResources().getQuantityString(R.plurals.select_album_n_songs, songCount, songCount);
+ songCountView.setText(s.toUpperCase());
+
+ return header;
+ }
}