Added default drawables for folders and for files without icons.
BIN
res/drawable-hdpi/ic_doc_album.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
res/drawable-hdpi/ic_doc_audio_am.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
res/drawable-hdpi/ic_doc_image.png
Normal file
After Width: | Height: | Size: 773 B |
BIN
res/drawable-hdpi/ic_doc_video_am.png
Normal file
After Width: | Height: | Size: 736 B |
BIN
res/drawable-hdpi/ic_root_folder_am.png
Normal file
After Width: | Height: | Size: 508 B |
BIN
res/drawable-mdpi/ic_doc_album.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
res/drawable-mdpi/ic_doc_audio_am.png
Normal file
After Width: | Height: | Size: 858 B |
BIN
res/drawable-mdpi/ic_doc_image.png
Normal file
After Width: | Height: | Size: 636 B |
BIN
res/drawable-mdpi/ic_doc_video_am.png
Normal file
After Width: | Height: | Size: 609 B |
BIN
res/drawable-mdpi/ic_root_folder_am.png
Normal file
After Width: | Height: | Size: 442 B |
BIN
res/drawable-xhdpi/ic_doc_album.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
res/drawable-xhdpi/ic_doc_audio_am.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/drawable-xhdpi/ic_doc_image.png
Normal file
After Width: | Height: | Size: 936 B |
BIN
res/drawable-xhdpi/ic_doc_video_am.png
Normal file
After Width: | Height: | Size: 838 B |
BIN
res/drawable-xhdpi/ic_root_folder_am.png
Normal file
After Width: | Height: | Size: 582 B |
BIN
res/drawable-xxhdpi/ic_doc_album.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
res/drawable-xxhdpi/ic_doc_audio_am.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/drawable-xxhdpi/ic_doc_image.png
Normal file
After Width: | Height: | Size: 713 B |
BIN
res/drawable-xxhdpi/ic_doc_video_am.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/drawable-xxhdpi/ic_root_folder_am.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
|
@ -27,10 +27,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
package com.github.nutomic.controldlna.utility;
|
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.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.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 org.teleal.cling.support.model.item.MusicTrack;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -39,12 +44,13 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.github.nutomic.controldlna.R;
|
import com.github.nutomic.controldlna.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArrayAdapter specialization for UPNP server directory contents.
|
* ArrayAdapter specialization for UPNP server directory contents.
|
||||||
*
|
*
|
||||||
* @author Felix Ableitner
|
* @author Felix Ableitner
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -68,7 +74,6 @@ public class FileArrayAdapter extends ArrayAdapter<DIDLObject> {
|
||||||
TextView title = (TextView) convertView.findViewById(R.id.title);
|
TextView title = (TextView) convertView.findViewById(R.id.title);
|
||||||
TextView artist = (TextView) convertView.findViewById(R.id.subtitle);
|
TextView artist = (TextView) convertView.findViewById(R.id.subtitle);
|
||||||
artist.setText("");
|
artist.setText("");
|
||||||
RemoteImageView image = (RemoteImageView) convertView.findViewById(R.id.image);
|
|
||||||
if (item instanceof MusicTrack) {
|
if (item instanceof MusicTrack) {
|
||||||
MusicTrack track = (MusicTrack) item;
|
MusicTrack track = (MusicTrack) item;
|
||||||
String trackNumber = (track.getOriginalTrackNumber() != null)
|
String trackNumber = (track.getOriginalTrackNumber() != null)
|
||||||
|
@ -81,8 +86,27 @@ public class FileArrayAdapter extends ArrayAdapter<DIDLObject> {
|
||||||
else
|
else
|
||||||
title.setText(item.getTitle());
|
title.setText(item.getTitle());
|
||||||
|
|
||||||
image.setImageUri(item.getFirstPropertyValue(
|
RemoteImageView image = (RemoteImageView) convertView.findViewById(R.id.image);
|
||||||
DIDLObject.Property.UPNP.ALBUM_ART_URI.class));
|
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;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,6 @@ public class RemoteImageView extends ImageView {
|
||||||
protected void onPostExecute(Bitmap bm) {
|
protected void onPostExecute(Bitmap bm) {
|
||||||
if (bm != null)
|
if (bm != null)
|
||||||
setImageBitmap(bm);
|
setImageBitmap(bm);
|
||||||
else
|
|
||||||
setImageDrawable(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|