Android Open Source - BlurNavigationDrawer Movie Adapter






From Project

Back to project page BlurNavigationDrawer.

License

The source code is released under:

Apache License

If you think the Android project BlurNavigationDrawer 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.charbgr.BlurNavigationDrawer.sample.app;
//  ww  w  .  j a  v  a2s. c o m
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;

/**
 * Created by charbgr on 8/30/14.
 */
public class MovieAdapter extends BaseAdapter {

    private ArrayList<Movie> movies;
    private Context context;

    public MovieAdapter(Context context, ArrayList<Movie> movies) {
        this.context = context;
        this.movies = movies;
    }

    @Override
    public int getCount() {
        return movies.size();
    }

    @Override
    public Movie getItem(int position) {
        return movies.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        Movie movie = getItem(position);
        ImageView imageView;
        TextView textView;


        if(convertView == null){
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(R.layout.movie_item, parent,
                    false);
        }

        imageView = (ImageView)convertView.findViewById(R.id.picture);
        textView = (TextView)convertView.findViewById(R.id.text);

        imageView.setImageDrawable(movie.getDrawable());
        textView.setText(movie.getTitle());

        return convertView;
    }
}




Java Source Code List

com.charbgr.BlurNavigationDrawer.Blur.java
com.charbgr.BlurNavigationDrawer.sample.app.MainActivity.java
com.charbgr.BlurNavigationDrawer.sample.app.MovieAdapter.java
com.charbgr.BlurNavigationDrawer.sample.app.Movie.java
com.charbgr.BlurNavigationDrawer.sample.app.NavigationDrawerFragment.java
com.charbgr.BlurNavigationDrawer.v4.BlurActionBarDrawerToggle.java
com.charbgr.BlurNavigationDrawer.v4.BlurDrawerLayout.java
com.charbgr.BlurNavigationDrawer.v7.BlurActionBarDrawerToggle.java
com.charbgr.BlurNavigationDrawer.v7.BlurDrawerLayout.java