Android Open Source - ribbit Sections Pager Adapter






From Project

Back to project page ribbit.

License

The source code is released under:

MIT License

If you think the Android project ribbit 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.lleshiart.ribbit;
/*from   w ww. j  ava 2  s. co  m*/
import java.util.Locale;

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

/**
 * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
 * one of the sections/tabs/pages.
 */
public class SectionsPagerAdapter extends FragmentPagerAdapter {
  
  protected Context mContext;

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

  @Override
  public Fragment getItem(int position) {
    // getItem is called to instantiate the fragment for the given page.
    // Return a PlaceholderFragment (defined as a static inner class
    // below).

    switch(position) {
      case 0:
        return new InboxFragment();
      case 1:
        return new FriendsFragment();
    }
    
    return null;
  }

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

  @Override
  public CharSequence getPageTitle(int position) {
    Locale l = Locale.getDefault();
    switch (position) {
    case 0:
      return mContext.getString(R.string.title_section1).toUpperCase(l);
    case 1:
      return mContext.getString(R.string.title_section2).toUpperCase(l);
    }
    return null;
  }
}




Java Source Code List

com.lleshiart.ribbit.EditFriendsActivity.java
com.lleshiart.ribbit.FileHelper.java
com.lleshiart.ribbit.ForgotPasswordActivity.java
com.lleshiart.ribbit.FriendsFragment.java
com.lleshiart.ribbit.ImageResizer.java
com.lleshiart.ribbit.InboxFragment.java
com.lleshiart.ribbit.LoginActivity.java
com.lleshiart.ribbit.MainActivity.java
com.lleshiart.ribbit.MessageAdapter.java
com.lleshiart.ribbit.NewMessageActivity.java
com.lleshiart.ribbit.ParseConstants.java
com.lleshiart.ribbit.RecipientsActivity.java
com.lleshiart.ribbit.SectionsPagerAdapter.java
com.lleshiart.ribbit.SignUpActivity.java
com.lleshiart.ribbit.ViewImageActivity.java