Android Open Source - fooplayer-android Artists Fragment






From Project

Back to project page fooplayer-android.

License

The source code is released under:

GNU General Public License

If you think the Android project fooplayer-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.mauriciogiordano.fooplayer.fragment;
/*from  w  w w .  j  ava2  s. c o m*/
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;

import com.mauriciogiordano.fooplayer.AlbumsActivity;
import com.mauriciogiordano.fooplayer.R;
import com.mauriciogiordano.fooplayer.adapter.ArtistsAdapter;
import com.mauriciogiordano.fooplayer.database.Artist;
import com.mauriciogiordano.fooplayer.network.Network;

import java.util.List;

/**
 * Created by mauricio on 10/31/14.
 */
public class ArtistsFragment extends Fragment {

    private View rootView;
    private ArtistsAdapter artistsAdapter;
    private GridView artistsGrid;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        rootView = inflater.inflate(R.layout.fragment_artists,
                container, false);

        Artist.search("foo", getActivity(), new Artist.ArtistSearchListener() {
            @Override
            public void results(List<Artist> artists, Network.Status status, boolean err) {

                if (!err) {
                    artistsAdapter = new ArtistsAdapter(getActivity(), artists);
                    artistsGrid = (GridView) rootView.findViewById(R.id.gridview);

                    artistsGrid.setAdapter(artistsAdapter);

                    artistsGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                        @Override
                        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                            ArtistsAdapter.ViewHolder holder = (ArtistsAdapter.ViewHolder) view.getTag();

                            Intent intent = new Intent(getActivity(), AlbumsActivity.class);
                            intent.putExtra("artist-mbid", holder.artist.getMbid());
                            startActivity(intent);
                        }
                    });
                }

            }
        });

        return rootView;
    }
}




Java Source Code List

com.mauriciogiordano.fooplayer.AlbumsActivity.java
com.mauriciogiordano.fooplayer.ApplicationTest.java
com.mauriciogiordano.fooplayer.FooActivity.java
com.mauriciogiordano.fooplayer.TracksActivity.java
com.mauriciogiordano.fooplayer.adapter.AlbumsAdapter.java
com.mauriciogiordano.fooplayer.adapter.ArtistsAdapter.java
com.mauriciogiordano.fooplayer.adapter.TracksAdapter.java
com.mauriciogiordano.fooplayer.config.Constants.java
com.mauriciogiordano.fooplayer.database.Album.java
com.mauriciogiordano.fooplayer.database.Artist.java
com.mauriciogiordano.fooplayer.database.Bean.java
com.mauriciogiordano.fooplayer.database.DatabaseHelper.java
com.mauriciogiordano.fooplayer.database.Track.java
com.mauriciogiordano.fooplayer.fragment.AlbumsFragment.java
com.mauriciogiordano.fooplayer.fragment.ArtistsFragment.java
com.mauriciogiordano.fooplayer.fragment.TracksFragment.java
com.mauriciogiordano.fooplayer.network.Delegate.java
com.mauriciogiordano.fooplayer.network.Endpoints.java
com.mauriciogiordano.fooplayer.network.HttpClientHelper.java
com.mauriciogiordano.fooplayer.network.ImageHelper.java
com.mauriciogiordano.fooplayer.network.Network.java
com.mauriciogiordano.fooplayer.network.YouTubeUtility.java
com.mauriciogiordano.fooplayer.view.TextView.java