From 3e674cd55f329d2217824b0d801878ea5ea86629 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 27 Jun 2013 22:37:18 +0200 Subject: [PATCH] Fixed crash due to removed function. --- AndroidManifest.xml | 4 ++-- src/com/github/nutomic/controldlna/FileArrayAdapter.java | 9 +++++++++ src/com/github/nutomic/controldlna/RendererFragment.java | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 8bb7ea5..ee6c8f7 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="2" + android:versionName="0.1.1" > diff --git a/src/com/github/nutomic/controldlna/FileArrayAdapter.java b/src/com/github/nutomic/controldlna/FileArrayAdapter.java index b7c3542..93ec4f5 100644 --- a/src/com/github/nutomic/controldlna/FileArrayAdapter.java +++ b/src/com/github/nutomic/controldlna/FileArrayAdapter.java @@ -28,6 +28,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.github.nutomic.controldlna; import java.util.Comparator; +import java.util.List; import org.teleal.cling.support.model.DIDLObject; import org.teleal.cling.support.model.container.Container; @@ -87,5 +88,13 @@ public class FileArrayAdapter extends ArrayAdapter { } return convertView; } + + /** + * Replacement for addAll, which is not implemented on lower API levels. + */ + public void add(List playlist) { + for (DIDLObject d : playlist) + add(d); + } } diff --git a/src/com/github/nutomic/controldlna/RendererFragment.java b/src/com/github/nutomic/controldlna/RendererFragment.java index 46bf9b8..63f9e3b 100644 --- a/src/com/github/nutomic/controldlna/RendererFragment.java +++ b/src/com/github/nutomic/controldlna/RendererFragment.java @@ -246,7 +246,7 @@ public class RendererFragment extends Fragment implements */ public void setPlaylist(List playlist, int start) { mPlaylistAdapter.clear(); - mPlaylistAdapter.addAll(playlist); + mPlaylistAdapter.add(playlist); mPlayService.getService().setPlaylist(playlist, start); } @@ -366,7 +366,7 @@ public class RendererFragment extends Fragment implements mUpnpService.getControlPoint().execute(mSubscriptionCallback); } mPlaylistAdapter.clear(); - mPlaylistAdapter.addAll(mPlayService.getService().getPlaylist()); + mPlaylistAdapter.add(mPlayService.getService().getPlaylist()); mListView.setAdapter(mPlaylistAdapter); }