Removed unused comparison feature in FileArrayAdapter (this is done server-side).
This commit is contained in:
parent
bf427811c6
commit
d8947fff67
1 changed files with 1 additions and 23 deletions
|
@ -27,11 +27,9 @@ 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.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.teleal.cling.support.model.DIDLObject;
|
import org.teleal.cling.support.model.DIDLObject;
|
||||||
import org.teleal.cling.support.model.container.Container;
|
|
||||||
import org.teleal.cling.support.model.item.Item;
|
import org.teleal.cling.support.model.item.Item;
|
||||||
import org.teleal.cling.support.model.item.MusicTrack;
|
import org.teleal.cling.support.model.item.MusicTrack;
|
||||||
|
|
||||||
|
@ -45,35 +43,15 @@ import android.widget.TextView;
|
||||||
import com.github.nutomic.controldlna.R;
|
import com.github.nutomic.controldlna.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows displaying UPNP media server directory contents in a ListView.
|
* ArrayAdapter specialization for UPNP server directory contents.
|
||||||
*
|
*
|
||||||
* @author Felix Ableitner
|
* @author Felix Ableitner
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FileArrayAdapter extends ArrayAdapter<DIDLObject> {
|
public class FileArrayAdapter extends ArrayAdapter<DIDLObject> {
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides sorting of elements by track number.
|
|
||||||
*/
|
|
||||||
public FileArrayAdapter(Context context) {
|
public FileArrayAdapter(Context context) {
|
||||||
super(context, R.layout.list_item);
|
super(context, R.layout.list_item);
|
||||||
sort(new Comparator<DIDLObject>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compare(DIDLObject lhs, DIDLObject rhs) {
|
|
||||||
if (lhs instanceof MusicTrack && rhs instanceof MusicTrack)
|
|
||||||
return ((MusicTrack) rhs).getOriginalTrackNumber() -
|
|
||||||
((MusicTrack) lhs).getOriginalTrackNumber();
|
|
||||||
else if (lhs instanceof Item && rhs instanceof Container)
|
|
||||||
return 1;
|
|
||||||
else if (rhs instanceof Item && lhs instanceof Container)
|
|
||||||
return -1;
|
|
||||||
else if (lhs instanceof Container && rhs instanceof Container)
|
|
||||||
return lhs.getTitle().compareTo(rhs.getTitle());
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Reference in a new issue