Android Open Source - json_resume Resume Pager Adapter






From Project

Back to project page json_resume.

License

The source code is released under:

/* * Copyright (c) 2015 Hunter Davis <hunter@hunterdavis.com> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided th...

If you think the Android project json_resume 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.hunterdavis.jsonresumeviewer;
/* w  ww . j a  va2  s  .  c o  m*/
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.hunterdavis.jsonresumeviewer.fragment.AwardsFragment;
import com.hunterdavis.jsonresumeviewer.fragment.BasicsResumeFragment;
import com.hunterdavis.jsonresumeviewer.fragment.EducationFragment;
import com.hunterdavis.jsonresumeviewer.fragment.InterestsFragment;
import com.hunterdavis.jsonresumeviewer.fragment.LanguagesFragment;
import com.hunterdavis.jsonresumeviewer.fragment.ProfileFragment;
import com.hunterdavis.jsonresumeviewer.fragment.PublicationsFragment;
import com.hunterdavis.jsonresumeviewer.fragment.ReferencesFragment;
import com.hunterdavis.jsonresumeviewer.fragment.SkillsFragment;
import com.hunterdavis.jsonresumeviewer.fragment.TextResumeFragment;
import com.hunterdavis.jsonresumeviewer.fragment.VolunteerFragment;
import com.hunterdavis.jsonresumeviewer.fragment.WorkFragment;
import com.hunterdavis.jsonresumeviewer.types.Interests;
import com.hunterdavis.jsonresumeviewer.types.Publications;

import java.util.Locale;

/**
 * Created by hunter on 2/18/15.
 */
public class ResumePagerAdapter extends FragmentPagerAdapter {

    Context adapterContext;

    public ResumePagerAdapter(FragmentManager fm, Context context) {
        super(fm);
        adapterContext = context;
    }

    @Override
    public Fragment getItem(int position) {

        ResumeSections section = ResumeSections.fromOrdinal(position);

        switch (section) {

            case BASICS:
                return BasicsResumeFragment.newInstance();
            case AWARDS:
                return AwardsFragment.newInstance();
            case EDUCATION:
                return EducationFragment.newInstance();
            case INTERESTS:
                return InterestsFragment.newInstance();
            case LANGUAGES:
                return LanguagesFragment.newInstance();
            case PUBLICATIONS:
                return PublicationsFragment.newInstance();
            case REFERENCES:
                return ReferencesFragment.newInstance();
            case SKILLS:
                return SkillsFragment.newInstance();
            case VOLUNTEER:
                return VolunteerFragment.newInstance();
            case WORK:
                return WorkFragment.newInstance();
            case PROFILES:
                return ProfileFragment.newInstance();
        }

            // return our basic resume fragment
            return TextResumeFragment.newInstance(section);
        }

    @Override
    public int getCount() {
        if(JsonResumeActivity.resume == null) {
            return 1;
        }
        return 11;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        Locale l = Locale.getDefault();
        ResumeSections section = ResumeSections.fromOrdinal(position);

        switch (section) {
            case BASICS:
                if(JsonResumeActivity.resume == null) {
                    return adapterContext.getString(R.string.title_load).toUpperCase(l);
                }else {
                    return adapterContext.getString(R.string.title_basics).toUpperCase(l);
                }
            case AWARDS:
                return adapterContext.getString(R.string.title_awards).toUpperCase(l);
            case EDUCATION:
                return adapterContext.getString(R.string.title_education).toUpperCase(l);
            case INTERESTS:
                return adapterContext.getString(R.string.title_interests).toUpperCase(l);
            case LANGUAGES:
                return adapterContext.getString(R.string.title_languages).toUpperCase(l);
            case PUBLICATIONS:
                return adapterContext.getString(R.string.title_publications).toUpperCase(l);
            case REFERENCES:
                return adapterContext.getString(R.string.title_references).toUpperCase(l);
            case SKILLS:
                return adapterContext.getString(R.string.title_skills).toUpperCase(l);
            case VOLUNTEER:
                return adapterContext.getString(R.string.title_volunteer).toUpperCase(l);
            case WORK:
                return adapterContext.getString(R.string.title_work).toUpperCase(l);
            case PROFILES:
                return adapterContext.getString(R.string.title_profiles).toUpperCase(l);
        }
        return null;
    }
}




Java Source Code List

com.hunterdavis.jsonresumeviewer.IconDownloadTask.java
com.hunterdavis.jsonresumeviewer.JsonResumeActivity.java
com.hunterdavis.jsonresumeviewer.JsonResumeParser.java
com.hunterdavis.jsonresumeviewer.ResumePagerAdapter.java
com.hunterdavis.jsonresumeviewer.ResumeSections.java
com.hunterdavis.jsonresumeviewer.fragment.AwardsFragment.java
com.hunterdavis.jsonresumeviewer.fragment.BasicsResumeFragment.java
com.hunterdavis.jsonresumeviewer.fragment.EducationFragment.java
com.hunterdavis.jsonresumeviewer.fragment.InterestsFragment.java
com.hunterdavis.jsonresumeviewer.fragment.LanguagesFragment.java
com.hunterdavis.jsonresumeviewer.fragment.ProfileFragment.java
com.hunterdavis.jsonresumeviewer.fragment.PublicationsFragment.java
com.hunterdavis.jsonresumeviewer.fragment.ReferencesFragment.java
com.hunterdavis.jsonresumeviewer.fragment.SkillsFragment.java
com.hunterdavis.jsonresumeviewer.fragment.TextResumeFragment.java
com.hunterdavis.jsonresumeviewer.fragment.VolunteerFragment.java
com.hunterdavis.jsonresumeviewer.fragment.WorkFragment.java
com.hunterdavis.jsonresumeviewer.types.Awards.java
com.hunterdavis.jsonresumeviewer.types.Basics.java
com.hunterdavis.jsonresumeviewer.types.Education.java
com.hunterdavis.jsonresumeviewer.types.Interests.java
com.hunterdavis.jsonresumeviewer.types.Languages.java
com.hunterdavis.jsonresumeviewer.types.Location.java
com.hunterdavis.jsonresumeviewer.types.Profiles.java
com.hunterdavis.jsonresumeviewer.types.Publications.java
com.hunterdavis.jsonresumeviewer.types.References.java
com.hunterdavis.jsonresumeviewer.types.Resume.java
com.hunterdavis.jsonresumeviewer.types.Skills.java
com.hunterdavis.jsonresumeviewer.types.Volunteer.java
com.hunterdavis.jsonresumeviewer.types.Work.java