[Android] Audio browser: remove useless sorting code
Adrien Maglo
git at videolan.org
Fri Dec 6 16:16:25 CET 2013
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Dec 6 16:15:05 2013 +0100| [14818c88ffefe5235b7726f0e1deccb2e45e20c8] | committer: Adrien Maglo
Audio browser: remove useless sorting code
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=14818c88ffefe5235b7726f0e1deccb2e45e20c8
---
.../vlc/gui/audio/AudioBrowserFragment.java | 34 ++------------------
1 file changed, 2 insertions(+), 32 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index fbf9397..e603984 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -31,7 +31,6 @@ import org.videolan.vlc.R;
import org.videolan.vlc.Util;
import org.videolan.vlc.WeakHandler;
import org.videolan.vlc.gui.MainActivity;
-import org.videolan.vlc.interfaces.ISortable;
import org.videolan.vlc.widget.FlingViewGroup;
import org.videolan.vlc.widget.FlingViewGroup.ViewSwitchListener;
import org.videolan.vlc.widget.HeaderScrollView;
@@ -57,7 +56,7 @@ import android.widget.ListView;
import com.actionbarsherlock.app.SherlockFragment;
-public class AudioBrowserFragment extends SherlockFragment implements ISortable {
+public class AudioBrowserFragment extends SherlockFragment {
public final static String TAG = "VLC/AudioBrowserFragment";
private FlingViewGroup mFlingViewGroup;
@@ -72,11 +71,6 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
private AudioBrowserListAdapter mAlbumsAdapter;
private AudioBrowserListAdapter mGenresAdapter;
- public final static int SORT_BY_TITLE = 0;
- public final static int SORT_BY_LENGTH = 1;
- private boolean mSortReverse = false;
- private int mSortBy = SORT_BY_TITLE;
-
public final static int MODE_TOTAL = 4; // Number of audio browser modes
public final static int MODE_ARTIST = 0;
public final static int MODE_ALBUM = 1;
@@ -350,24 +344,11 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
mAlbumsAdapter.clear();
mGenresAdapter.clear();
- switch(mSortBy) {
- case SORT_BY_LENGTH:
- Collections.sort(audioList, MediaComparators.byLength);
- break;
- case SORT_BY_TITLE:
- default:
- Collections.sort(audioList, MediaComparators.byName);
- break;
- }
- if(mSortReverse) {
- Collections.reverse(audioList);
- }
+ Collections.sort(audioList, MediaComparators.byName);
for (int i = 0; i < audioList.size(); i++) {
Media media = audioList.get(i);
mSongsAdapter.add(media.getTitle(), media.getArtist(), media);
}
- if (mSortBy != SORT_BY_LENGTH)
- mSongsAdapter.addLeterSeparators();
Collections.sort(audioList, MediaComparators.byArtist);
for (int i = 0; i < audioList.size(); i++) {
@@ -395,15 +376,4 @@ public class AudioBrowserFragment extends SherlockFragment implements ISortable
mAlbumsAdapter.notifyDataSetChanged();
mGenresAdapter.notifyDataSetChanged();
}
-
- @Override
- public void sortBy(int sortby) {
- if(mSortBy == sortby) {
- mSortReverse = !mSortReverse;
- } else {
- mSortBy = sortby;
- mSortReverse = false;
- }
- updateLists();
- }
}
More information about the Android
mailing list