com.hartcode.hackr.ui.main.ViewPagerAdapter.java Source code

Java tutorial

Introduction

Here is the source code for com.hartcode.hackr.ui.main.ViewPagerAdapter.java

Source

/**
*
*    Hackr - An exponential clicker style game
*    Copyright (C) 2016  Alex Hart
*
*    This program is free software: you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program.  If not, see 
*    <https://github.com/hartcode/hackr-android/blob/master/LICENSE>.
*
*/
package com.hartcode.hackr.ui.main;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by alex on 3/11/15.
 * The view pager adapter binds the structure and achievement fragments to the fragment pager adapter.
 */
class ViewPagerAdapter extends FragmentPagerAdapter {

    private ArrayList<Fragment> fragments = null;

    public ViewPagerAdapter(FragmentManager fm, ArrayList<Fragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int i) {
        return fragments.get(i);
    }

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