Android Open Source - android-data-persistence Sections Pager Adapter






From Project

Back to project page android-data-persistence.

License

The source code is released under:

MIT License

If you think the Android project android-data-persistence 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.teamtreehouse.mememaker.adapters;
/*from   w w w .j  a  va 2  s  .c  om*/
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.support.v13.app.FragmentPagerAdapter;

import com.teamtreehouse.mememaker.R;
import com.teamtreehouse.mememaker.ui.fragments.ImageGridFragment;
import com.teamtreehouse.mememaker.ui.fragments.MemeItemFragment;

/**
 * Created by Evan Anger on 8/10/14.
 */
public class SectionsPagerAdapter extends FragmentPagerAdapter {
    Context mContext;

    public SectionsPagerAdapter(Context context, FragmentManager fm) {
        super(fm);
        mContext = context;
    }

    @Override
    public Fragment getItem(int position) {
        Fragment fragment;
        if(position == 0) {
            fragment = new ImageGridFragment();
        } else {
            fragment = new MemeItemFragment();
        }
        return fragment;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        if(position == 0) {
            return mContext.getString(R.string.images_fragment_title);
        } else {
            return mContext.getString(R.string.memes_fragment_title);
        }
    }

    @Override
    public int getCount() {
        return 2;
    }
}




Java Source Code List

com.teamtreehouse.mememaker.MemeMakerApplicationSettings.java
com.teamtreehouse.mememaker.MemeMakerApplication.java
com.teamtreehouse.mememaker.adapters.GridViewAdapter.java
com.teamtreehouse.mememaker.adapters.MemeItemListAdapter.java
com.teamtreehouse.mememaker.adapters.SectionsPagerAdapter.java
com.teamtreehouse.mememaker.database.MemeDatasource.java
com.teamtreehouse.mememaker.database.MemeSQLiteHelper.java
com.teamtreehouse.mememaker.models.ImageGridItem.java
com.teamtreehouse.mememaker.models.ImageItem.java
com.teamtreehouse.mememaker.models.MemeAnnotation.java
com.teamtreehouse.mememaker.models.Meme.java
com.teamtreehouse.mememaker.ui.activities.CreateMemeActivity.java
com.teamtreehouse.mememaker.ui.activities.MainActivity.java
com.teamtreehouse.mememaker.ui.activities.MemeSettingsActivity.java
com.teamtreehouse.mememaker.ui.fragments.ImageGridFragment.java
com.teamtreehouse.mememaker.ui.fragments.MemeItemFragment.java
com.teamtreehouse.mememaker.ui.fragments.MemeSettingsFragment.java
com.teamtreehouse.mememaker.ui.views.MemeImageView.java
com.teamtreehouse.mememaker.utils.FileUtilities.java
com.teamtreehouse.mememaker.utils.ImageResizer.java
com.teamtreehouse.mememaker.utils.StorageType.java