Clean up
This commit is contained in:
parent
30dd66e788
commit
739e565bc4
7 changed files with 107 additions and 159 deletions
|
|
@ -11,37 +11,39 @@ import android.widget.CheckBox;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.model.Category;
|
import com.kabouzeid.gramophone.model.CategoryInfo;
|
||||||
import com.kabouzeid.gramophone.util.SwipeAndDragHelper;
|
import com.kabouzeid.gramophone.util.SwipeAndDragHelper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.ViewHolder> implements SwipeAndDragHelper.ActionCompletionContract {
|
public class CategoryInfoAdapter extends RecyclerView.Adapter<CategoryInfoAdapter.ViewHolder> implements SwipeAndDragHelper.ActionCompletionContract {
|
||||||
private ArrayList<Category> categories;
|
private ArrayList<CategoryInfo> categoryInfos;
|
||||||
private ItemTouchHelper touchHelper;
|
private ItemTouchHelper touchHelper;
|
||||||
|
|
||||||
public CategoryAdapter(ArrayList<Category> categories) {
|
public CategoryInfoAdapter(ArrayList<CategoryInfo> categoryInfos) {
|
||||||
this.categories = categories;
|
this.categoryInfos = categoryInfos;
|
||||||
|
SwipeAndDragHelper swipeAndDragHelper = new SwipeAndDragHelper(this);
|
||||||
|
touchHelper = new ItemTouchHelper(swipeAndDragHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CategoryAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public CategoryInfoAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.preference_dialog_library_categories_listitem, parent, false);
|
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.preference_dialog_library_categories_listitem, parent, false);
|
||||||
return new ViewHolder(view);
|
return new ViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(CategoryAdapter.ViewHolder holder, int position) {
|
public void onBindViewHolder(CategoryInfoAdapter.ViewHolder holder, int position) {
|
||||||
Category category = categories.get(position);
|
CategoryInfo categoryInfo = categoryInfos.get(position);
|
||||||
|
|
||||||
holder.checkBox.setChecked(category.visible);
|
holder.checkBox.setChecked(categoryInfo.visible);
|
||||||
holder.title.setText(holder.title.getResources().getString(category.id.key));
|
holder.title.setText(holder.title.getResources().getString(categoryInfo.category.stringRes));
|
||||||
|
|
||||||
holder.itemView.setOnClickListener(v -> {
|
holder.itemView.setOnClickListener(v -> {
|
||||||
if (!(category.visible && isLastCheckedCategory(category))) {
|
if (!(categoryInfo.visible && isLastCheckedCategory(categoryInfo))) {
|
||||||
category.visible = !category.visible;
|
categoryInfo.visible = !categoryInfo.visible;
|
||||||
holder.checkBox.setChecked(category.visible);
|
holder.checkBox.setChecked(categoryInfo.visible);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -56,35 +58,35 @@ public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.ViewHo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return categories.size();
|
return categoryInfos.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setCategories(ArrayList<Category> categories) {
|
public void setCategoryInfos(ArrayList<CategoryInfo> categoryInfos) {
|
||||||
this.categories = categories;
|
this.categoryInfos = categoryInfos;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewMoved(int oldPosition, int newPosition) {
|
public void onViewMoved(int oldPosition, int newPosition) {
|
||||||
Category category = categories.get(oldPosition);
|
CategoryInfo categoryInfo = categoryInfos.get(oldPosition);
|
||||||
categories.remove(oldPosition);
|
categoryInfos.remove(oldPosition);
|
||||||
categories.add(newPosition, category);
|
categoryInfos.add(newPosition, categoryInfo);
|
||||||
notifyItemMoved(oldPosition, newPosition);
|
notifyItemMoved(oldPosition, newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTouchHelper(ItemTouchHelper touchHelper) {
|
public void attachToRecyclerView(RecyclerView recyclerView) {
|
||||||
this.touchHelper = touchHelper;
|
touchHelper.attachToRecyclerView(recyclerView);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Category> getCategories() {
|
public ArrayList<CategoryInfo> getCategoryInfos() {
|
||||||
return categories;
|
return categoryInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isLastCheckedCategory(Category category) {
|
private boolean isLastCheckedCategory(CategoryInfo categoryInfo) {
|
||||||
if (category.visible) {
|
if (categoryInfo.visible) {
|
||||||
for (Category c : categories) {
|
for (CategoryInfo c : categoryInfos) {
|
||||||
if (c != category && c.visible) return false;
|
if (c != categoryInfo && c.visible) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -9,8 +9,7 @@ import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.model.CategoryInfo;
|
||||||
import com.kabouzeid.gramophone.model.Category;
|
|
||||||
import com.kabouzeid.gramophone.ui.fragments.mainactivity.library.pager.AlbumsFragment;
|
import com.kabouzeid.gramophone.ui.fragments.mainactivity.library.pager.AlbumsFragment;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.mainactivity.library.pager.ArtistsFragment;
|
import com.kabouzeid.gramophone.ui.fragments.mainactivity.library.pager.ArtistsFragment;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.mainactivity.library.pager.GenresFragment;
|
import com.kabouzeid.gramophone.ui.fragments.mainactivity.library.pager.GenresFragment;
|
||||||
|
|
@ -36,20 +35,19 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
||||||
public MusicLibraryPagerAdapter(@NonNull final Context context, final FragmentManager fragmentManager) {
|
public MusicLibraryPagerAdapter(@NonNull final Context context, final FragmentManager fragmentManager) {
|
||||||
super(fragmentManager);
|
super(fragmentManager);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
setCategories(PreferenceUtil.getInstance(context).getLibraryCategories());
|
setCategoryInfos(PreferenceUtil.getInstance(context).getLibraryCategoryInfos());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCategories(@NonNull ArrayList<Category> categories) {
|
public void setCategoryInfos(@NonNull ArrayList<CategoryInfo> categoryInfos) {
|
||||||
mHolderList.clear();
|
mHolderList.clear();
|
||||||
|
|
||||||
for (int i = 0, size = categories.size(); i < size; i++) {
|
for (CategoryInfo categoryInfo : categoryInfos) {
|
||||||
Category category = categories.get(i);
|
if (categoryInfo.visible) {
|
||||||
if (category.visible) {
|
MusicFragments fragment = MusicFragments.valueOf(categoryInfo.category.toString());
|
||||||
MusicFragments fragment = MusicFragments.valueOf(category.id.toString());
|
|
||||||
Holder holder = new Holder();
|
Holder holder = new Holder();
|
||||||
holder.mClassName = fragment.getFragmentClass().getName();
|
holder.mClassName = fragment.getFragmentClass().getName();
|
||||||
holder.title = mContext.getResources()
|
holder.title = mContext.getResources()
|
||||||
.getString(category.id.key)
|
.getString(categoryInfo.category.stringRes)
|
||||||
.toUpperCase(Locale.getDefault());
|
.toUpperCase(Locale.getDefault());
|
||||||
mHolderList.add(holder);
|
mHolderList.add(holder);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
package com.kabouzeid.gramophone.model;
|
|
||||||
|
|
||||||
import com.kabouzeid.gramophone.R;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
public class Category {
|
|
||||||
@SerializedName("id")
|
|
||||||
public Id id;
|
|
||||||
|
|
||||||
@SerializedName("index")
|
|
||||||
public int index;
|
|
||||||
|
|
||||||
@SerializedName("checkBox")
|
|
||||||
public boolean visible;
|
|
||||||
|
|
||||||
public Category(Category category) {
|
|
||||||
this.id = category.id;
|
|
||||||
this.visible = category.visible;
|
|
||||||
this.index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Category(Id id, boolean visible, int index) {
|
|
||||||
this.id = id;
|
|
||||||
this.visible = visible;
|
|
||||||
this.index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
|
|
||||||
Category category = (Category) o;
|
|
||||||
|
|
||||||
return id == category.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int result = 0;
|
|
||||||
result = 31 * result + id.hashCode();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "{id:"+id + ", pos:"+ index + ", vis=" + visible + "}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static enum Id
|
|
||||||
{
|
|
||||||
SONGS(R.string.songs),
|
|
||||||
ALBUMS(R.string.albums),
|
|
||||||
ARTISTS(R.string.artists),
|
|
||||||
GENRES(R.string.genres),
|
|
||||||
PLAYLISTS(R.string.playlists);
|
|
||||||
|
|
||||||
public final int key;
|
|
||||||
|
|
||||||
private Id(int key) {
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.kabouzeid.gramophone.model;
|
||||||
|
|
||||||
|
import com.kabouzeid.gramophone.R;
|
||||||
|
|
||||||
|
public class CategoryInfo {
|
||||||
|
public Category category;
|
||||||
|
public boolean visible;
|
||||||
|
|
||||||
|
public CategoryInfo(Category category, boolean visible) {
|
||||||
|
this.category = category;
|
||||||
|
this.visible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Category {
|
||||||
|
SONGS(R.string.songs),
|
||||||
|
ALBUMS(R.string.albums),
|
||||||
|
ARTISTS(R.string.artists),
|
||||||
|
GENRES(R.string.genres),
|
||||||
|
PLAYLISTS(R.string.playlists);
|
||||||
|
|
||||||
|
public final int stringRes;
|
||||||
|
|
||||||
|
Category(int stringRes) {
|
||||||
|
this.stringRes = stringRes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,16 +6,13 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.afollestad.materialdialogs.MaterialDialog;
|
import com.afollestad.materialdialogs.MaterialDialog;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.adapter.CategoryAdapter;
|
import com.kabouzeid.gramophone.adapter.CategoryInfoAdapter;
|
||||||
import com.kabouzeid.gramophone.model.Category;
|
import com.kabouzeid.gramophone.model.CategoryInfo;
|
||||||
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
||||||
import com.kabouzeid.gramophone.util.SwipeAndDragHelper;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
@ -28,18 +25,15 @@ public class LibraryPreferenceDialog extends DialogFragment {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
View view = getActivity().getLayoutInflater().inflate(R.layout.preference_dialog_library_categories, null);
|
||||||
View view = inflater.inflate(R.layout.preference_dialog_library_categories, null);
|
|
||||||
|
|
||||||
ArrayList<Category> categories = PreferenceUtil.getInstance(getContext()).getLibraryCategories();
|
CategoryInfoAdapter adapter = new CategoryInfoAdapter(PreferenceUtil.getInstance(getContext()).getLibraryCategoryInfos());
|
||||||
RecyclerView categoriesView = view.findViewById(R.id.recycler_view);
|
|
||||||
categoriesView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
|
||||||
CategoryAdapter adapter = new CategoryAdapter(categories);
|
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||||
SwipeAndDragHelper swipeAndDragHelper = new SwipeAndDragHelper(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
ItemTouchHelper touchHelper = new ItemTouchHelper(swipeAndDragHelper);
|
|
||||||
adapter.setTouchHelper(touchHelper);
|
adapter.attachToRecyclerView(recyclerView);
|
||||||
categoriesView.setAdapter(adapter);
|
|
||||||
touchHelper.attachToRecyclerView(categoriesView);
|
|
||||||
|
|
||||||
return new MaterialDialog.Builder(getContext())
|
return new MaterialDialog.Builder(getContext())
|
||||||
.title(R.string.library_categories)
|
.title(R.string.library_categories)
|
||||||
|
|
@ -48,27 +42,25 @@ public class LibraryPreferenceDialog extends DialogFragment {
|
||||||
.negativeText(android.R.string.cancel)
|
.negativeText(android.R.string.cancel)
|
||||||
.neutralText(R.string.reset_action)
|
.neutralText(R.string.reset_action)
|
||||||
.autoDismiss(false)
|
.autoDismiss(false)
|
||||||
.onNeutral((dialog, action) -> {
|
.onNeutral((dialog, action) -> adapter.setCategoryInfos(PreferenceUtil.getInstance(getContext()).getDefaultLibraryCategoryInfos()))
|
||||||
adapter.setCategories(PreferenceUtil.getInstance(getContext()).getDefaultLibraryCategories());
|
|
||||||
})
|
|
||||||
.onNegative((dialog, action) -> dismiss())
|
.onNegative((dialog, action) -> dismiss())
|
||||||
.onPositive((dialog, action) -> {
|
.onPositive((dialog, action) -> {
|
||||||
updateCategories(adapter.getCategories());
|
updateCategories(adapter.getCategoryInfos());
|
||||||
dismiss();
|
dismiss();
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCategories(ArrayList<Category> categories) {
|
private void updateCategories(ArrayList<CategoryInfo> categories) {
|
||||||
if (getSelected(categories) == 0) return;
|
if (getSelected(categories) == 0) return;
|
||||||
|
|
||||||
PreferenceUtil.getInstance(getContext()).setLibraryCategories(categories);
|
PreferenceUtil.getInstance(getContext()).setLibraryCategoryInfos(categories);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getSelected(ArrayList<Category> categories) {
|
private int getSelected(ArrayList<CategoryInfo> categories) {
|
||||||
int selected = 0;
|
int selected = 0;
|
||||||
for (Category category : categories) {
|
for (CategoryInfo categoryInfo : categories) {
|
||||||
if (category.visible)
|
if (categoryInfo.visible)
|
||||||
selected++;
|
selected++;
|
||||||
}
|
}
|
||||||
return selected;
|
return selected;
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
||||||
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
|
||||||
if (PreferenceUtil.LIBRARY_CATEGORIES.equals(key)) {
|
if (PreferenceUtil.LIBRARY_CATEGORIES.equals(key)) {
|
||||||
Fragment current = getCurrentFragment();
|
Fragment current = getCurrentFragment();
|
||||||
pagerAdapter.setCategories(PreferenceUtil.getInstance(getActivity()).getLibraryCategories());
|
pagerAdapter.setCategoryInfos(PreferenceUtil.getInstance(getActivity()).getLibraryCategoryInfos());
|
||||||
pager.setOffscreenPageLimit(pagerAdapter.getCount() - 1);
|
pager.setOffscreenPageLimit(pagerAdapter.getCount() - 1);
|
||||||
int position = pagerAdapter.getItemPosition(current);
|
int position = pagerAdapter.getItemPosition(current);
|
||||||
pager.setCurrentItem(position > -1 ? position : 0);
|
pager.setCurrentItem(position > -1 ? position : 0);
|
||||||
|
|
|
||||||
|
|
@ -8,17 +8,17 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.StyleRes;
|
import android.support.annotation.StyleRes;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.helper.SortOrder;
|
import com.kabouzeid.gramophone.helper.SortOrder;
|
||||||
import com.kabouzeid.gramophone.model.Category;
|
import com.kabouzeid.gramophone.model.CategoryInfo;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.mainactivity.folders.FoldersFragment;
|
import com.kabouzeid.gramophone.ui.fragments.mainactivity.folders.FoldersFragment;
|
||||||
import com.kabouzeid.gramophone.ui.fragments.player.NowPlayingScreen;
|
import com.kabouzeid.gramophone.ui.fragments.player.NowPlayingScreen;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public final class PreferenceUtil {
|
public final class PreferenceUtil {
|
||||||
public static final String GENERAL_THEME = "general_theme";
|
public static final String GENERAL_THEME = "general_theme";
|
||||||
|
|
@ -435,46 +435,40 @@ public final class PreferenceUtil {
|
||||||
return mPreferences.getBoolean(INITIALIZED_BLACKLIST, false);
|
return mPreferences.getBoolean(INITIALIZED_BLACKLIST, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLibraryCategories(ArrayList<Category> categories) {
|
public void setLibraryCategoryInfos(ArrayList<CategoryInfo> categories) {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
Type collectionType = new TypeToken<ArrayList<CategoryInfo>>() {
|
||||||
|
}.getType();
|
||||||
|
|
||||||
Set<String> data = new HashSet<>(categories.size());
|
final SharedPreferences.Editor editor = mPreferences.edit();
|
||||||
|
editor.putString(LIBRARY_CATEGORIES, gson.toJson(categories, collectionType));
|
||||||
for (int i = 0, size = categories.size(); i < size; i++) {
|
|
||||||
Category category = categories.get(i);
|
|
||||||
category.index = i;
|
|
||||||
data.add(gson.toJson(category));
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedPreferences.Editor editor = mPreferences.edit();
|
|
||||||
editor.putStringSet(LIBRARY_CATEGORIES, data);
|
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Category> getLibraryCategories() {
|
public ArrayList<CategoryInfo> getLibraryCategoryInfos() {
|
||||||
Set<String> data = mPreferences.getStringSet(LIBRARY_CATEGORIES, null);
|
String data = mPreferences.getString(LIBRARY_CATEGORIES, null);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
ArrayList<Category> result = new ArrayList<>(Collections.nCopies(data.size(), (Category) null));
|
Type collectionType = new TypeToken<ArrayList<CategoryInfo>>() {
|
||||||
|
}.getType();
|
||||||
|
|
||||||
for (String json : data) {
|
try {
|
||||||
Category category = gson.fromJson(json, Category.class);
|
return gson.fromJson(data, collectionType);
|
||||||
result.set(category.index, category);
|
} catch (JsonSyntaxException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return getDefaultLibraryCategoryInfos();
|
||||||
}
|
}
|
||||||
|
|
||||||
return getDefaultLibraryCategories();
|
public ArrayList<CategoryInfo> getDefaultLibraryCategoryInfos() {
|
||||||
}
|
ArrayList<CategoryInfo> defaultCategoryInfos = new ArrayList<>(5);
|
||||||
|
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.SONGS, true));
|
||||||
public ArrayList<Category> getDefaultLibraryCategories() {
|
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.ALBUMS, true));
|
||||||
ArrayList<Category> result = new ArrayList<>();
|
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.ARTISTS, true));
|
||||||
result.add(new Category(Category.Id.SONGS, true, 0));
|
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.GENRES, true));
|
||||||
result.add(new Category(Category.Id.ALBUMS, true, 1));
|
defaultCategoryInfos.add(new CategoryInfo(CategoryInfo.Category.PLAYLISTS, true));
|
||||||
result.add(new Category(Category.Id.ARTISTS, true, 2));
|
return defaultCategoryInfos;
|
||||||
result.add(new Category(Category.Id.GENRES, true, 3));
|
|
||||||
result.add(new Category(Category.Id.PLAYLISTS, true, 4));
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue