<commit_before>/*
 * Copyright (C) 2016 <NAME>
 *
 * 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.doctoror.fuckoffmusicplayer.library.artistalbums;

import com.doctoror.fuckoffmusicplayer.db.albums.AlbumsProvider;
import com.doctoror.fuckoffmusicplayer.db.queue.QueueProviderAlbums;
import com.doctoror.fuckoffmusicplayer.di.DaggerHolder;
import com.doctoror.fuckoffmusicplayer.library.albums.conditional.ConditionalAlbumListFragment;
import com.doctoror.fuckoffmusicplayer.queue.Media;

import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

/**
 * Shows album for artists
 */
public final class ArtistAlbumsFragment extends ConditionalAlbumListFragment {

    private static final String EXTRA_ARTIST_ID = "EXTRA_ARTIST_ID";

    @NonNull
    public static ArtistAlbumsFragment instantiate(final long artistId) {
        final ArtistAlbumsFragment fragment = new ArtistAlbumsFragment();
        final Bundle extras = new Bundle();
        extras.putLong(EXTRA_ARTIST_ID, artistId);
        fragment.setArguments(extras);
        return fragment;
    }

    private long artistId;

    @Inject
    QueueProviderAlbums queueProvider;

    @Inject
    AlbumsProvider mAlbumsProvider;

    @Override
    public void onCreate(@Nullable final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        artistId = getArguments().getLong(EXTRA_ARTIST_ID);
        DaggerHolder.getInstance(getActivity()).mainComponent().inject(this);
    }

    @NonNull
    @Override
    protected Observable<List<Media>> queueFromAlbums(@NonNull final long[] albumIds) {
        return queueProvider.fromAlbums(albumIds, artistId);
    }

    @Override
    protected Observable<Cursor> load() {
        return mAlbumsProvider.loadForArtist(artistId);
    }
}<commit_msg>Fix artist filter not applied when loading a single album<commit_after>/*
 * Copyright (C) 2016 <NAME>
 *
 * 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.doctoror.fuckoffmusicplayer.library.artistalbums;

import com.doctoror.fuckoffmusicplayer.db.albums.AlbumsProvider;
import com.doctoror.fuckoffmusicplayer.db.queue.QueueProviderAlbums;
import com.doctoror.fuckoffmusicplayer.di.DaggerHolder;
import com.doctoror.fuckoffmusicplayer.library.albums.conditional.ConditionalAlbumListFragment;
import com.doctoror.fuckoffmusicplayer.queue.Media;

import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

/**
 * Shows album for artists
 */
public final class ArtistAlbumsFragment extends ConditionalAlbumListFragment {

    private static final String EXTRA_ARTIST_ID = "EXTRA_ARTIST_ID";

    @NonNull
    public static ArtistAlbumsFragment instantiate(final long artistId) {
        final ArtistAlbumsFragment fragment = new ArtistAlbumsFragment();
        final Bundle extras = new Bundle();
        extras.putLong(EXTRA_ARTIST_ID, artistId);
        fragment.setArguments(extras);
        return fragment;
    }

    private long artistId;

    @Inject
    QueueProviderAlbums queueProvider;

    @Inject
    AlbumsProvider mAlbumsProvider;

    @Override
    public void onCreate(@Nullable final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        artistId = getArguments().getLong(EXTRA_ARTIST_ID);
        DaggerHolder.getInstance(getActivity()).mainComponent().inject(this);
    }

    @NonNull
    @Override
    protected Observable<List<Media>> queueFromAlbum(final long albumId) {
        return queueProvider.fromAlbums(new long[]{albumId}, artistId);
    }

    @NonNull
    @Override
    protected Observable<List<Media>> queueFromAlbums(@NonNull final long[] albumIds) {
        return queueProvider.fromAlbums(albumIds, artistId);
    }

    @Override
    protected Observable<Cursor> load() {
        return mAlbumsProvider.loadForArtist(artistId);
    }
}
{'fraction_non_alphanumeric': 0.08222093248210485, 'fraction_numerical': 0.0030953762816792415, 'mean_word_length': 4.18555667001003, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3146131', 'n_tokens_mistral': 1492, 'n_tokens_neox': 1400, 'n_words': 388}