Search in sources :

Example 1 with TabView

use of com.simplecity.amp_library.ui.modelviews.TabView in project Shuttle by timusus.

the class TabsAdapter method updatePreferences.

public void updatePreferences() {
    String genresTitle = mContext.getString(R.string.genres_title);
    String suggestedTitle = mContext.getString(R.string.suggested_title);
    String artistsTitle = mContext.getString(R.string.artists_title);
    String albumsTitle = mContext.getString(R.string.albums_title);
    String songsTitle = mContext.getString(R.string.tracks_title);
    String foldersTitle = mContext.getString(R.string.folders_title);
    String playlistsTitle = mContext.getString(R.string.playlists_title);
    SharedPreferences.Editor editor = mPrefs.edit();
    for (int i = 0, length = getItemCount(); i < length; i++) {
        CategoryItem item = ((TabView) items.get(i)).categoryItem;
        if (item.title.equals(genresTitle)) {
            editor.putInt(GENRES_ORDER, i);
            editor.putBoolean(SHOW_GENRES, item.checked);
        } else if (item.title.equals(suggestedTitle)) {
            editor.putInt(SUGGESTED_ORDER, i);
            editor.putBoolean(SHOW_SUGGESTED, item.checked);
        } else if (item.title.equals(artistsTitle)) {
            editor.putInt(ARTISTS_ORDER, i);
            editor.putBoolean(SHOW_ARTISTS, item.checked);
        } else if (item.title.equals(albumsTitle)) {
            editor.putInt(ALBUMS_ORDER, i);
            editor.putBoolean(SHOW_ALBUMS, item.checked);
        } else if (item.title.equals(songsTitle)) {
            editor.putInt(SONGS_ORDER, i);
            editor.putBoolean(SHOW_SONGS, item.checked);
        } else if (item.title.equals(foldersTitle)) {
            editor.putInt(FOLDERS_ORDER, i);
            editor.putBoolean(SHOW_FOLDERS, item.checked);
        } else if (item.title.equals(playlistsTitle)) {
            editor.putInt(PLAYLISTS_ORDER, i);
            editor.putBoolean(SHOW_PLAYLISTS, item.checked);
        }
        editor.apply();
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) TabView(com.simplecity.amp_library.ui.modelviews.TabView) CategoryItem(com.simplecity.amp_library.model.CategoryItem)

Aggregations

SharedPreferences (android.content.SharedPreferences)1 CategoryItem (com.simplecity.amp_library.model.CategoryItem)1 TabView (com.simplecity.amp_library.ui.modelviews.TabView)1