Back to project page journal.
The source code is released under:
MIT License
If you think the Android project journal listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package cochrane343.journal; /* w w w.j av a2s . co m*/ import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; /** * The {@link FragmentStatePagerAdapter} used to page through the {@link MonthlyExpensesFragment MonthlyExpensesFragments} * displaying the expenses of the different months. * * @author cochrane343 * @version 1.0 */ public class MonthlyExpensesPagerAdapter extends FragmentStatePagerAdapter { /** * The offset to account for the ongoing month */ private final static int CURRENT_MONTH_OFFSET = 1; public MonthlyExpensesPagerAdapter(final FragmentManager fragmentManager) { super(fragmentManager); } /** * @param monthsSinceEpoch the number of months elapsed since the Java epoch, determining the month * displayed by the fragment at the specified position * @return the fragment associated with the specified position */ @Override public MonthlyExpensesFragment getItem(final int monthsSinceEpoch) { return MonthlyExpensesFragment.newInstance(monthsSinceEpoch); } /** * @return the number of views available, i.e. the number of months elapsed since the Java epoch * plus one */ @Override public final int getCount() { return DateTimeHelper.getMonthsSinceEpoch() + CURRENT_MONTH_OFFSET; } }