diff --git a/res/drawable-hdpi/ic_doc_album.png b/res/drawable-hdpi/ic_doc_album.png new file mode 100644 index 0000000..179db33 Binary files /dev/null and b/res/drawable-hdpi/ic_doc_album.png differ diff --git a/res/drawable-hdpi/ic_doc_audio_am.png b/res/drawable-hdpi/ic_doc_audio_am.png new file mode 100644 index 0000000..465838d Binary files /dev/null and b/res/drawable-hdpi/ic_doc_audio_am.png differ diff --git a/res/drawable-hdpi/ic_doc_image.png b/res/drawable-hdpi/ic_doc_image.png new file mode 100644 index 0000000..72b611d Binary files /dev/null and b/res/drawable-hdpi/ic_doc_image.png differ diff --git a/res/drawable-hdpi/ic_doc_video_am.png b/res/drawable-hdpi/ic_doc_video_am.png new file mode 100644 index 0000000..9a942d2 Binary files /dev/null and b/res/drawable-hdpi/ic_doc_video_am.png differ diff --git a/res/drawable-hdpi/ic_root_folder_am.png b/res/drawable-hdpi/ic_root_folder_am.png new file mode 100644 index 0000000..915e118 Binary files /dev/null and b/res/drawable-hdpi/ic_root_folder_am.png differ diff --git a/res/drawable-mdpi/ic_doc_album.png b/res/drawable-mdpi/ic_doc_album.png new file mode 100644 index 0000000..318dd5b Binary files /dev/null and b/res/drawable-mdpi/ic_doc_album.png differ diff --git a/res/drawable-mdpi/ic_doc_audio_am.png b/res/drawable-mdpi/ic_doc_audio_am.png new file mode 100644 index 0000000..cb94d99 Binary files /dev/null and b/res/drawable-mdpi/ic_doc_audio_am.png differ diff --git a/res/drawable-mdpi/ic_doc_image.png b/res/drawable-mdpi/ic_doc_image.png new file mode 100644 index 0000000..b81b1e5 Binary files /dev/null and b/res/drawable-mdpi/ic_doc_image.png differ diff --git a/res/drawable-mdpi/ic_doc_video_am.png b/res/drawable-mdpi/ic_doc_video_am.png new file mode 100644 index 0000000..3a5b798 Binary files /dev/null and b/res/drawable-mdpi/ic_doc_video_am.png differ diff --git a/res/drawable-mdpi/ic_root_folder_am.png b/res/drawable-mdpi/ic_root_folder_am.png new file mode 100644 index 0000000..4352d08 Binary files /dev/null and b/res/drawable-mdpi/ic_root_folder_am.png differ diff --git a/res/drawable-xhdpi/ic_doc_album.png b/res/drawable-xhdpi/ic_doc_album.png new file mode 100644 index 0000000..e67aa8d Binary files /dev/null and b/res/drawable-xhdpi/ic_doc_album.png differ diff --git a/res/drawable-xhdpi/ic_doc_audio_am.png b/res/drawable-xhdpi/ic_doc_audio_am.png new file mode 100644 index 0000000..2e66f03 Binary files /dev/null and b/res/drawable-xhdpi/ic_doc_audio_am.png differ diff --git a/res/drawable-xhdpi/ic_doc_image.png b/res/drawable-xhdpi/ic_doc_image.png new file mode 100644 index 0000000..98d3f79 Binary files /dev/null and b/res/drawable-xhdpi/ic_doc_image.png differ diff --git a/res/drawable-xhdpi/ic_doc_video_am.png b/res/drawable-xhdpi/ic_doc_video_am.png new file mode 100644 index 0000000..1a8e632 Binary files /dev/null and b/res/drawable-xhdpi/ic_doc_video_am.png differ diff --git a/res/drawable-xhdpi/ic_root_folder_am.png b/res/drawable-xhdpi/ic_root_folder_am.png new file mode 100644 index 0000000..c916e0b Binary files /dev/null and b/res/drawable-xhdpi/ic_root_folder_am.png differ diff --git a/res/drawable-xxhdpi/ic_doc_album.png b/res/drawable-xxhdpi/ic_doc_album.png new file mode 100644 index 0000000..4c56bd0 Binary files /dev/null and b/res/drawable-xxhdpi/ic_doc_album.png differ diff --git a/res/drawable-xxhdpi/ic_doc_audio_am.png b/res/drawable-xxhdpi/ic_doc_audio_am.png new file mode 100644 index 0000000..48ab9c7 Binary files /dev/null and b/res/drawable-xxhdpi/ic_doc_audio_am.png differ diff --git a/res/drawable-xxhdpi/ic_doc_image.png b/res/drawable-xxhdpi/ic_doc_image.png new file mode 100644 index 0000000..06d8d9c Binary files /dev/null and b/res/drawable-xxhdpi/ic_doc_image.png differ diff --git a/res/drawable-xxhdpi/ic_doc_video_am.png b/res/drawable-xxhdpi/ic_doc_video_am.png new file mode 100644 index 0000000..42d8ec1 Binary files /dev/null and b/res/drawable-xxhdpi/ic_doc_video_am.png differ diff --git a/res/drawable-xxhdpi/ic_root_folder_am.png b/res/drawable-xxhdpi/ic_root_folder_am.png new file mode 100644 index 0000000..077c851 Binary files /dev/null and b/res/drawable-xxhdpi/ic_root_folder_am.png differ diff --git a/src/com/github/nutomic/controldlna/utility/FileArrayAdapter.java b/src/com/github/nutomic/controldlna/utility/FileArrayAdapter.java index 223b684..53991a6 100644 --- a/src/com/github/nutomic/controldlna/utility/FileArrayAdapter.java +++ b/src/com/github/nutomic/controldlna/utility/FileArrayAdapter.java @@ -27,10 +27,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.github.nutomic.controldlna.utility; -import java.util.List; +import java.net.URI; +import java.util.List; import org.teleal.cling.support.model.DIDLObject; +import org.teleal.cling.support.model.item.AudioItem; +import org.teleal.cling.support.model.item.ImageItem; import org.teleal.cling.support.model.item.Item; +import org.teleal.cling.support.model.item.PlaylistItem; +import org.teleal.cling.support.model.item.VideoItem; import org.teleal.cling.support.model.item.MusicTrack; import android.content.Context; @@ -39,12 +44,13 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; +import android.util.Log; import com.github.nutomic.controldlna.R; /** * ArrayAdapter specialization for UPNP server directory contents. - * + * * @author Felix Ableitner * */ @@ -68,7 +74,6 @@ public class FileArrayAdapter extends ArrayAdapter { TextView title = (TextView) convertView.findViewById(R.id.title); TextView artist = (TextView) convertView.findViewById(R.id.subtitle); artist.setText(""); - RemoteImageView image = (RemoteImageView) convertView.findViewById(R.id.image); if (item instanceof MusicTrack) { MusicTrack track = (MusicTrack) item; String trackNumber = (track.getOriginalTrackNumber() != null) @@ -81,8 +86,27 @@ public class FileArrayAdapter extends ArrayAdapter { else title.setText(item.getTitle()); - image.setImageUri(item.getFirstPropertyValue( - DIDLObject.Property.UPNP.ALBUM_ART_URI.class)); + RemoteImageView image = (RemoteImageView) convertView.findViewById(R.id.image); + URI icon = item.getFirstPropertyValue( + DIDLObject.Property.UPNP.ALBUM_ART_URI.class); + if (icon != null) { + image.setImageUri(icon); + } + else { + int resId; + if (item instanceof AudioItem) + resId = R.drawable.ic_doc_audio_am; + else if (item instanceof VideoItem) + resId = R.drawable.ic_doc_video_am; + else if (item instanceof ImageItem) + resId = R.drawable.ic_doc_image; + else if (item instanceof PlaylistItem) + resId = R.drawable.ic_doc_album; + else + resId = R.drawable.ic_root_folder_am; + image.setImageResource(resId); + } + return convertView; } diff --git a/src/com/github/nutomic/controldlna/utility/RemoteImageView.java b/src/com/github/nutomic/controldlna/utility/RemoteImageView.java index 7313bad..027b82a 100644 --- a/src/com/github/nutomic/controldlna/utility/RemoteImageView.java +++ b/src/com/github/nutomic/controldlna/utility/RemoteImageView.java @@ -54,8 +54,6 @@ public class RemoteImageView extends ImageView { protected void onPostExecute(Bitmap bm) { if (bm != null) setImageBitmap(bm); - else - setImageDrawable(null); } };