update sort method options and add sort order stubs
This commit is contained in:
parent
a1ae9a2360
commit
50fd0997dc
11 changed files with 144 additions and 280 deletions
|
|
@ -19,8 +19,8 @@ import com.kabouzeid.gramophone.adapter.base.AbsMultiSelectAdapter;
|
|||
import com.kabouzeid.gramophone.adapter.base.MediaEntryViewHolder;
|
||||
import com.kabouzeid.gramophone.glide.CustomGlideRequest;
|
||||
import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
||||
import com.kabouzeid.gramophone.helper.SortOrder;
|
||||
import com.kabouzeid.gramophone.helper.menu.SongsMenuHelper;
|
||||
import com.kabouzeid.gramophone.helper.sort.SortMethod;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.model.Album;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
|
|
@ -189,15 +189,16 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
public String getSectionName(int position) {
|
||||
@Nullable String sectionName = null;
|
||||
switch (PreferenceUtil.getInstance(activity).getAlbumSortOrder()) {
|
||||
case SortOrder.AlbumSortOrder.ALBUM_A_Z:
|
||||
case SortOrder.AlbumSortOrder.ALBUM_Z_A:
|
||||
case SortMethod.NAME:
|
||||
sectionName = dataSet.get(position).getTitle();
|
||||
break;
|
||||
case SortOrder.AlbumSortOrder.ALBUM_ARTIST:
|
||||
case SortMethod.ARTIST:
|
||||
sectionName = dataSet.get(position).getArtistName();
|
||||
break;
|
||||
case SortOrder.AlbumSortOrder.ALBUM_YEAR:
|
||||
case SortMethod.YEAR:
|
||||
return MusicUtil.getYearString(dataSet.get(position).getYear());
|
||||
case SortMethod.RANDOM:
|
||||
sectionName = dataSet.get(position).getTitle();
|
||||
}
|
||||
|
||||
return MusicUtil.getSectionName(sectionName);
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ import com.kabouzeid.gramophone.adapter.base.AbsMultiSelectAdapter;
|
|||
import com.kabouzeid.gramophone.adapter.base.MediaEntryViewHolder;
|
||||
import com.kabouzeid.gramophone.glide.CustomGlideRequest;
|
||||
import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
||||
import com.kabouzeid.gramophone.helper.SortOrder;
|
||||
import com.kabouzeid.gramophone.helper.menu.SongsMenuHelper;
|
||||
import com.kabouzeid.gramophone.helper.sort.SortMethod;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.model.Artist;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
|
|
@ -180,8 +180,10 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
public String getSectionName(int position) {
|
||||
@Nullable String sectionName = null;
|
||||
switch (PreferenceUtil.getInstance(activity).getArtistSortOrder()) {
|
||||
case SortOrder.ArtistSortOrder.ARTIST_A_Z:
|
||||
case SortOrder.ArtistSortOrder.ARTIST_Z_A:
|
||||
case SortMethod.NAME:
|
||||
sectionName = dataSet.get(position).getName();
|
||||
break;
|
||||
case SortMethod.RANDOM:
|
||||
sectionName = dataSet.get(position).getName();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ import com.kabouzeid.gramophone.adapter.base.MediaEntryViewHolder;
|
|||
import com.kabouzeid.gramophone.glide.CustomGlideRequest;
|
||||
import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||
import com.kabouzeid.gramophone.helper.SortOrder;
|
||||
import com.kabouzeid.gramophone.helper.menu.SongMenuHelper;
|
||||
import com.kabouzeid.gramophone.helper.menu.SongsMenuHelper;
|
||||
import com.kabouzeid.gramophone.helper.sort.SortMethod;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.model.Album;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
|
|
@ -191,18 +191,19 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
|||
|
||||
@Nullable String sectionName = null;
|
||||
switch (PreferenceUtil.getInstance(activity).getSongSortOrder()) {
|
||||
case SortOrder.SongSortOrder.SONG_A_Z:
|
||||
case SortOrder.SongSortOrder.SONG_Z_A:
|
||||
case SortMethod.NAME:
|
||||
sectionName = dataSet.get(position).title;
|
||||
break;
|
||||
case SortOrder.SongSortOrder.SONG_ALBUM:
|
||||
case SortMethod.ALBUM:
|
||||
sectionName = dataSet.get(position).albumName;
|
||||
break;
|
||||
case SortOrder.SongSortOrder.SONG_ARTIST:
|
||||
case SortMethod.ARTIST:
|
||||
sectionName = dataSet.get(position).artistName;
|
||||
break;
|
||||
case SortOrder.SongSortOrder.SONG_YEAR:
|
||||
case SortMethod.YEAR:
|
||||
return MusicUtil.getYearString(dataSet.get(position).year);
|
||||
case SortMethod.RANDOM:
|
||||
sectionName = dataSet.get(position).title;
|
||||
}
|
||||
|
||||
return MusicUtil.getSectionName(sectionName);
|
||||
|
|
|
|||
|
|
@ -1,167 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2012 Andrew Neal Licensed under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
|
||||
* or agreed to in writing, software distributed under the License is
|
||||
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.kabouzeid.gramophone.helper;
|
||||
|
||||
import android.provider.MediaStore;
|
||||
|
||||
/**
|
||||
* Holds all of the sort orders for each list type.
|
||||
*
|
||||
* @author Andrew Neal (andrewdneal@gmail.com)
|
||||
*/
|
||||
public final class SortOrder {
|
||||
|
||||
/**
|
||||
* This class is never instantiated
|
||||
*/
|
||||
public SortOrder() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Artist sort order entries.
|
||||
*/
|
||||
public interface ArtistSortOrder {
|
||||
/* Artist sort order A-Z */
|
||||
String ARTIST_A_Z = MediaStore.Audio.Artists.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Artist sort order Z-A */
|
||||
String ARTIST_Z_A = ARTIST_A_Z + " DESC";
|
||||
|
||||
/* Artist sort order number of songs */
|
||||
String ARTIST_NUMBER_OF_SONGS = MediaStore.Audio.Artists.NUMBER_OF_TRACKS
|
||||
+ " DESC";
|
||||
|
||||
/* Artist sort order number of albums */
|
||||
String ARTIST_NUMBER_OF_ALBUMS = MediaStore.Audio.Artists.NUMBER_OF_ALBUMS
|
||||
+ " DESC";
|
||||
}
|
||||
|
||||
/**
|
||||
* Album sort order entries.
|
||||
*/
|
||||
public interface AlbumSortOrder {
|
||||
/* Album sort order A-Z */
|
||||
String ALBUM_A_Z = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Album sort order Z-A */
|
||||
String ALBUM_Z_A = ALBUM_A_Z + " DESC";
|
||||
|
||||
/* Album sort order songs */
|
||||
String ALBUM_NUMBER_OF_SONGS = MediaStore.Audio.Albums.NUMBER_OF_SONGS
|
||||
+ " DESC";
|
||||
|
||||
/* Album sort order artist */
|
||||
String ALBUM_ARTIST = MediaStore.Audio.Artists.DEFAULT_SORT_ORDER
|
||||
+ ", " + MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Album sort order year */
|
||||
String ALBUM_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
|
||||
}
|
||||
|
||||
/**
|
||||
* Song sort order entries.
|
||||
*/
|
||||
public interface SongSortOrder {
|
||||
/* Song sort order A-Z */
|
||||
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Song sort order Z-A */
|
||||
String SONG_Z_A = SONG_A_Z + " DESC";
|
||||
|
||||
/* Song sort order artist */
|
||||
String SONG_ARTIST = MediaStore.Audio.Artists.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Song sort order album */
|
||||
String SONG_ALBUM = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Song sort order year */
|
||||
String SONG_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
|
||||
|
||||
/* Song sort order duration */
|
||||
String SONG_DURATION = MediaStore.Audio.Media.DURATION + " DESC";
|
||||
|
||||
/* Song sort order date */
|
||||
String SONG_DATE = MediaStore.Audio.Media.DATE_ADDED + " DESC";
|
||||
}
|
||||
|
||||
/**
|
||||
* Album song sort order entries.
|
||||
*/
|
||||
public interface AlbumSongSortOrder {
|
||||
/* Album song sort order A-Z */
|
||||
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Album song sort order Z-A */
|
||||
String SONG_Z_A = SONG_A_Z + " DESC";
|
||||
|
||||
/* Album song sort order track list */
|
||||
String SONG_TRACK_LIST = MediaStore.Audio.Media.TRACK + ", "
|
||||
+ MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Album song sort order duration */
|
||||
String SONG_DURATION = SongSortOrder.SONG_DURATION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Artist song sort order entries.
|
||||
*/
|
||||
public interface ArtistSongSortOrder {
|
||||
/* Artist song sort order A-Z */
|
||||
String SONG_A_Z = MediaStore.Audio.Media.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Artist song sort order Z-A */
|
||||
String SONG_Z_A = SONG_A_Z + " DESC";
|
||||
|
||||
/* Artist song sort order album */
|
||||
String SONG_ALBUM = MediaStore.Audio.Media.ALBUM;
|
||||
|
||||
/* Artist song sort order year */
|
||||
String SONG_YEAR = MediaStore.Audio.Media.YEAR + " DESC";
|
||||
|
||||
/* Artist song sort order duration */
|
||||
String SONG_DURATION = MediaStore.Audio.Media.DURATION + " DESC";
|
||||
|
||||
/* Artist song sort order date */
|
||||
String SONG_DATE = MediaStore.Audio.Media.DATE_ADDED + " DESC";
|
||||
}
|
||||
|
||||
/**
|
||||
* Artist album sort order entries.
|
||||
*/
|
||||
public interface ArtistAlbumSortOrder {
|
||||
/* Artist album sort order A-Z */
|
||||
String ALBUM_A_Z = MediaStore.Audio.Albums.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Artist album sort order Z-A */
|
||||
String ALBUM_Z_A = ALBUM_A_Z + " DESC";
|
||||
|
||||
/* Artist album sort order year */
|
||||
String ALBUM_YEAR = MediaStore.Audio.Media.YEAR
|
||||
+ " DESC";
|
||||
|
||||
/* Artist album sort order year */
|
||||
String ALBUM_YEAR_ASC = MediaStore.Audio.Media.YEAR
|
||||
+ " ASC";
|
||||
}
|
||||
|
||||
/**
|
||||
* Genre sort order entries.
|
||||
*/
|
||||
public interface GenreSortOrder {
|
||||
/* Genre sort order A-Z */
|
||||
String GENRE_A_Z = MediaStore.Audio.Genres.DEFAULT_SORT_ORDER;
|
||||
|
||||
/* Genre sort order Z-A */
|
||||
String ALBUM_Z_A = GENRE_A_Z + " DESC";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.kabouzeid.gramophone.helper.sort;
|
||||
|
||||
public class SortMethod {
|
||||
public static final String NAME = "NAME";
|
||||
public static final String ALBUM = "ALBUM";
|
||||
public static final String ARTIST = "ARTIST";
|
||||
public static final String YEAR = "YEAR";
|
||||
public static final String RANDOM = "RANDOM";
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
package com.kabouzeid.gramophone.helper.sort;
|
||||
|
||||
public class SortOrder {
|
||||
public static final String ASCENDING = "ASCENDING";
|
||||
public static final String DESCENDING = "DESCENDING";
|
||||
}
|
||||
|
|
@ -28,7 +28,8 @@ import com.kabouzeid.gramophone.R;
|
|||
import com.kabouzeid.gramophone.adapter.MusicLibraryPagerAdapter;
|
||||
import com.kabouzeid.gramophone.dialogs.CreatePlaylistDialog;
|
||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||
import com.kabouzeid.gramophone.helper.SortOrder;
|
||||
import com.kabouzeid.gramophone.helper.sort.SortMethod;
|
||||
import com.kabouzeid.gramophone.helper.sort.SortOrder;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.loader.SongLoader;
|
||||
import com.kabouzeid.gramophone.ui.activities.MainActivity;
|
||||
|
|
@ -196,15 +197,18 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
if (Util.isLandscape(getResources())) {
|
||||
gridSizeItem.setTitle(R.string.action_grid_size_land);
|
||||
}
|
||||
|
||||
setUpGridSizeMenu(absLibraryRecyclerViewCustomGridSizeFragment, gridSizeItem.getSubMenu());
|
||||
|
||||
menu.findItem(R.id.action_colored_footers).setChecked(absLibraryRecyclerViewCustomGridSizeFragment.usePalette());
|
||||
menu.findItem(R.id.action_colored_footers).setEnabled(absLibraryRecyclerViewCustomGridSizeFragment.canUsePalette());
|
||||
|
||||
setUpSortMethodMenu(absLibraryRecyclerViewCustomGridSizeFragment, menu.findItem(R.id.action_sort_method).getSubMenu());
|
||||
setUpSortOrderMenu(absLibraryRecyclerViewCustomGridSizeFragment, menu.findItem(R.id.action_sort_order).getSubMenu());
|
||||
} else {
|
||||
menu.removeItem(R.id.action_grid_size);
|
||||
menu.removeItem(R.id.action_colored_footers);
|
||||
menu.removeItem(R.id.action_sort_method);
|
||||
menu.removeItem(R.id.action_sort_order);
|
||||
}
|
||||
|
||||
|
|
@ -344,84 +348,70 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
return false;
|
||||
}
|
||||
|
||||
private void setUpSortOrderMenu(@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment, @NonNull SubMenu sortOrderMenu) {
|
||||
private void setUpSortMethodMenu(@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment, @NonNull SubMenu sortOrderMenu) {
|
||||
String currentSortOrder = fragment.getSortOrder();
|
||||
sortOrderMenu.clear();
|
||||
|
||||
if (fragment instanceof AlbumsFragment) {
|
||||
sortOrderMenu.add(0, R.id.action_album_sort_order_asc, 0, R.string.sort_order_a_z)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_A_Z));
|
||||
sortOrderMenu.add(0, R.id.action_album_sort_order_desc, 1, R.string.sort_order_z_a)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_Z_A));
|
||||
sortOrderMenu.add(0, R.id.action_album_sort_order_artist, 2, R.string.sort_order_artist)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_ARTIST));
|
||||
sortOrderMenu.add(0, R.id.action_album_sort_order_year, 3, R.string.sort_order_year)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.AlbumSortOrder.ALBUM_YEAR));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_name, 0, R.string.sort_order_name)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.NAME));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_artist, 1, R.string.sort_order_artist)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.ARTIST));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_year, 2, R.string.sort_order_year)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.YEAR));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_random, 3, R.string.sort_order_random)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.RANDOM));
|
||||
} else if (fragment instanceof ArtistsFragment) {
|
||||
sortOrderMenu.add(0, R.id.action_artist_sort_order_asc, 0, R.string.sort_order_a_z)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.ArtistSortOrder.ARTIST_A_Z));
|
||||
sortOrderMenu.add(0, R.id.action_artist_sort_order_desc, 1, R.string.sort_order_z_a)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.ArtistSortOrder.ARTIST_Z_A));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_name, 0, R.string.sort_order_name)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.NAME));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_random, 1, R.string.sort_order_random)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.RANDOM));
|
||||
} else if (fragment instanceof SongsFragment) {
|
||||
sortOrderMenu.add(0, R.id.action_song_sort_order_asc, 0, R.string.sort_order_a_z)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_A_Z));
|
||||
sortOrderMenu.add(0, R.id.action_song_sort_order_desc, 1, R.string.sort_order_z_a)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_Z_A));
|
||||
sortOrderMenu.add(0, R.id.action_song_sort_order_artist, 2, R.string.sort_order_artist)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_ARTIST));
|
||||
sortOrderMenu.add(0, R.id.action_song_sort_order_album, 3, R.string.sort_order_album)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_ALBUM));
|
||||
sortOrderMenu.add(0, R.id.action_song_sort_order_year, 4, R.string.sort_order_year)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.SongSortOrder.SONG_YEAR));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_name, 0, R.string.sort_order_name)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.NAME));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_album, 1, R.string.sort_order_album)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.ALBUM));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_artist, 2, R.string.sort_order_artist)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.ARTIST));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_year, 3, R.string.sort_order_year)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.YEAR));
|
||||
sortOrderMenu.add(0, R.id.action_sort_method_random, 4, R.string.sort_order_random)
|
||||
.setChecked(currentSortOrder.equals(SortMethod.RANDOM));
|
||||
}
|
||||
|
||||
sortOrderMenu.setGroupCheckable(0, true, true);
|
||||
}
|
||||
|
||||
private void setUpSortOrderMenu(@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment, @NonNull SubMenu sortOrderMenu) {
|
||||
String currentSortOrder = fragment.getSortOrder();
|
||||
sortOrderMenu.clear();
|
||||
|
||||
sortOrderMenu.add(0, R.id.action_sort_order_ascending, 0, R.string.sort_order_a_z)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.ASCENDING));
|
||||
sortOrderMenu.add(0, R.id.action_sort_order_descending, 1, R.string.sort_order_z_a)
|
||||
.setChecked(currentSortOrder.equals(SortOrder.DESCENDING));
|
||||
|
||||
sortOrderMenu.setGroupCheckable(0, true, true);
|
||||
}
|
||||
|
||||
private boolean handleSortOrderMenuItem(@NonNull AbsLibraryPagerRecyclerViewCustomGridSizeFragment fragment, @NonNull MenuItem item) {
|
||||
String sortOrder = null;
|
||||
if (fragment instanceof AlbumsFragment) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_album_sort_order_asc:
|
||||
sortOrder = SortOrder.AlbumSortOrder.ALBUM_A_Z;
|
||||
break;
|
||||
case R.id.action_album_sort_order_desc:
|
||||
sortOrder = SortOrder.AlbumSortOrder.ALBUM_Z_A;
|
||||
break;
|
||||
case R.id.action_album_sort_order_artist:
|
||||
sortOrder = SortOrder.AlbumSortOrder.ALBUM_ARTIST;
|
||||
break;
|
||||
case R.id.action_album_sort_order_year:
|
||||
sortOrder = SortOrder.AlbumSortOrder.ALBUM_YEAR;
|
||||
break;
|
||||
}
|
||||
} else if (fragment instanceof ArtistsFragment) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_artist_sort_order_asc:
|
||||
sortOrder = SortOrder.ArtistSortOrder.ARTIST_A_Z;
|
||||
break;
|
||||
case R.id.action_artist_sort_order_desc:
|
||||
sortOrder = SortOrder.ArtistSortOrder.ARTIST_Z_A;
|
||||
break;
|
||||
}
|
||||
} else if (fragment instanceof SongsFragment) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_song_sort_order_asc:
|
||||
sortOrder = SortOrder.SongSortOrder.SONG_A_Z;
|
||||
break;
|
||||
case R.id.action_song_sort_order_desc:
|
||||
sortOrder = SortOrder.SongSortOrder.SONG_Z_A;
|
||||
break;
|
||||
case R.id.action_song_sort_order_artist:
|
||||
sortOrder = SortOrder.SongSortOrder.SONG_ARTIST;
|
||||
break;
|
||||
case R.id.action_song_sort_order_album:
|
||||
sortOrder = SortOrder.SongSortOrder.SONG_ALBUM;
|
||||
break;
|
||||
case R.id.action_song_sort_order_year:
|
||||
sortOrder = SortOrder.SongSortOrder.SONG_YEAR;
|
||||
break;
|
||||
}
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_sort_method_name:
|
||||
sortOrder = SortMethod.NAME;
|
||||
break;
|
||||
case R.id.action_sort_method_album:
|
||||
sortOrder = SortMethod.ALBUM;
|
||||
break;
|
||||
case R.id.action_sort_method_artist:
|
||||
sortOrder = SortMethod.ARTIST;
|
||||
break;
|
||||
case R.id.action_sort_method_year:
|
||||
sortOrder = SortMethod.YEAR;
|
||||
break;
|
||||
case R.id.action_sort_method_random:
|
||||
sortOrder = SortMethod.RANDOM;
|
||||
break;
|
||||
}
|
||||
|
||||
if (sortOrder != null) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ import com.google.gson.JsonSyntaxException;
|
|||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.helper.SortOrder;
|
||||
import com.kabouzeid.gramophone.helper.sort.SortMethod;
|
||||
import com.kabouzeid.gramophone.helper.sort.SortOrder;
|
||||
import com.kabouzeid.gramophone.model.CategoryInfo;
|
||||
import com.kabouzeid.gramophone.ui.fragments.player.NowPlayingScreen;
|
||||
|
||||
|
|
@ -25,13 +26,13 @@ public final class PreferenceUtil {
|
|||
|
||||
public static final String NOW_PLAYING_SCREEN = "now_playing_screen";
|
||||
|
||||
public static final String ARTIST_SORT_METHOD = "artist_sort_method";
|
||||
public static final String ALBUM_SORT_METHOD = "album_sort_method";
|
||||
public static final String SONG_SORT_METHOD = "song_sort_method";
|
||||
|
||||
public static final String ARTIST_SORT_ORDER = "artist_sort_order";
|
||||
public static final String ARTIST_SONG_SORT_ORDER = "artist_song_sort_order";
|
||||
public static final String ARTIST_ALBUM_SORT_ORDER = "artist_album_sort_order";
|
||||
public static final String ALBUM_SORT_ORDER = "album_sort_order";
|
||||
public static final String ALBUM_SONG_SORT_ORDER = "album_song_sort_order";
|
||||
public static final String SONG_SORT_ORDER = "song_sort_order";
|
||||
public static final String GENRE_SORT_ORDER = "genre_sort_order";
|
||||
|
||||
public static final String ALBUM_GRID_SIZE = "album_grid_size";
|
||||
public static final String ALBUM_GRID_SIZE_LAND = "album_grid_size_land";
|
||||
|
|
@ -186,7 +187,7 @@ public final class PreferenceUtil {
|
|||
}
|
||||
|
||||
public final String getArtistSortOrder() {
|
||||
return mPreferences.getString(ARTIST_SORT_ORDER, SortOrder.ArtistSortOrder.ARTIST_A_Z);
|
||||
return mPreferences.getString(ARTIST_SORT_ORDER, SortOrder.DESCENDING);
|
||||
}
|
||||
|
||||
public void setArtistSortOrder(final String sortOrder) {
|
||||
|
|
@ -195,16 +196,8 @@ public final class PreferenceUtil {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
public final String getArtistSongSortOrder() {
|
||||
return mPreferences.getString(ARTIST_SONG_SORT_ORDER, SortOrder.ArtistSongSortOrder.SONG_A_Z);
|
||||
}
|
||||
|
||||
public final String getArtistAlbumSortOrder() {
|
||||
return mPreferences.getString(ARTIST_ALBUM_SORT_ORDER, SortOrder.ArtistAlbumSortOrder.ALBUM_YEAR);
|
||||
}
|
||||
|
||||
public final String getAlbumSortOrder() {
|
||||
return mPreferences.getString(ALBUM_SORT_ORDER, SortOrder.AlbumSortOrder.ALBUM_A_Z);
|
||||
return mPreferences.getString(ALBUM_SORT_ORDER, SortOrder.DESCENDING);
|
||||
}
|
||||
|
||||
public void setAlbumSortOrder(final String sortOrder) {
|
||||
|
|
@ -213,12 +206,8 @@ public final class PreferenceUtil {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
public final String getAlbumSongSortOrder() {
|
||||
return mPreferences.getString(ALBUM_SONG_SORT_ORDER, SortOrder.AlbumSongSortOrder.SONG_TRACK_LIST);
|
||||
}
|
||||
|
||||
public final String getSongSortOrder() {
|
||||
return mPreferences.getString(SONG_SORT_ORDER, SortOrder.SongSortOrder.SONG_A_Z);
|
||||
return mPreferences.getString(SONG_SORT_ORDER, SortOrder.DESCENDING);
|
||||
}
|
||||
|
||||
public void setSongSortOrder(final String sortOrder) {
|
||||
|
|
@ -227,8 +216,34 @@ public final class PreferenceUtil {
|
|||
editor.commit();
|
||||
}
|
||||
|
||||
public final String getGenreSortOrder() {
|
||||
return mPreferences.getString(GENRE_SORT_ORDER, SortOrder.GenreSortOrder.GENRE_A_Z);
|
||||
public final String getArtistSortMethod() {
|
||||
return mPreferences.getString(ARTIST_SORT_METHOD, SortMethod.NAME);
|
||||
}
|
||||
|
||||
public void setArtistSortMethod(final String sortMethod) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putString(ARTIST_SORT_METHOD, sortMethod);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public final String getAlbumSortMethod() {
|
||||
return mPreferences.getString(ALBUM_SORT_METHOD, SortMethod.NAME);
|
||||
}
|
||||
|
||||
public void setAlbumSortMethod(final String sortMethod) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putString(ALBUM_SORT_METHOD, sortMethod);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public final String getSongSortMethod() {
|
||||
return mPreferences.getString(SONG_SORT_METHOD, SortMethod.NAME);
|
||||
}
|
||||
|
||||
public void setSongSortMethod(final String sortMethod) {
|
||||
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putString(SONG_SORT_METHOD, sortMethod);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
public int getLastSleepTimerValue() {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,13 @@
|
|||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_sort_method"
|
||||
android:title="@string/action_sort_method">
|
||||
<menu>
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_sort_order"
|
||||
android:title="@string/action_sort_order">
|
||||
|
|
|
|||
|
|
@ -3,17 +3,14 @@
|
|||
|
||||
<item name="action_new_playlist" type="id" />
|
||||
|
||||
<item name="action_album_sort_order_asc" type="id" />
|
||||
<item name="action_album_sort_order_desc" type="id" />
|
||||
<item name="action_album_sort_order_artist" type="id" />
|
||||
<item name="action_album_sort_order_year" type="id" />
|
||||
<item name="action_artist_sort_order_asc" type="id" />
|
||||
<item name="action_artist_sort_order_desc" type="id" />
|
||||
<item name="action_song_sort_order_asc" type="id" />
|
||||
<item name="action_song_sort_order_desc" type="id" />
|
||||
<item name="action_song_sort_order_artist" type="id" />
|
||||
<item name="action_song_sort_order_album" type="id" />
|
||||
<item name="action_song_sort_order_year" type="id" />
|
||||
<item name="action_sort_order_ascending" type="id" />
|
||||
<item name="action_sort_order_descending" type="id" />
|
||||
|
||||
<item name="action_sort_method_name" type="id" />
|
||||
<item name="action_sort_method_album" type="id" />
|
||||
<item name="action_sort_method_artist" type="id" />
|
||||
<item name="action_sort_method_year" type="id" />
|
||||
<item name="action_sort_method_random" type="id" />
|
||||
|
||||
<item name="action_multi_select_adapter_check_all" type="id" />
|
||||
|
||||
|
|
|
|||
|
|
@ -212,10 +212,13 @@
|
|||
<string name="pref_summary_library_categories">Configure visibility and order of library categories.</string>
|
||||
<string name="you_have_to_select_at_least_one_category">You have to select at least one category.</string>
|
||||
<string name="action_sort_order">Sort order</string>
|
||||
<string name="action_sort_method">Sort method</string>
|
||||
<string name="sort_order_a_z">Ascending</string>
|
||||
<string name="sort_order_z_a">Descending</string>
|
||||
<string name="sort_order_name">Name</string>
|
||||
<string name="sort_order_artist">Artist</string>
|
||||
<string name="sort_order_album">Album</string>
|
||||
<string name="sort_order_year">Year</string>
|
||||
<string name="sort_order_random">Random</string>
|
||||
<string name="finish_current_music_sleep_timer">Finish last song</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue