Android Open Source - mitlocate Tab Pager Adapter






From Project

Back to project page mitlocate.

License

The source code is released under:

MIT License

If you think the Android project mitlocate 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 edu.mit.locate.tabs;
/* w  w  w  . ja  v  a  2  s  .co m*/
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import edu.mit.locate.R;
import edu.mit.locate.alerts.AlertsTab;
import edu.mit.locate.friends.FriendsTab;

public class TabPagerAdapter extends FragmentPagerAdapter implements IconPagerAdapter {
  private static final String[] CONTENT = new String[] { //"Search",
    "Friends", //"Alerts",
    "Settings" };
  private static final int[] ICONS = new int[] {
    //R.drawable.ic_tab_search,
    R.drawable.ic_tab_friends,
    //R.drawable.ic_tab_alerts,
    R.drawable.ic_tab_settings, };

  public TabPagerAdapter(FragmentManager fm) {
    super(fm);
  }

  @Override
  public Fragment getItem(int position) {
    switch (position) {
    //case 0:
    //    return new SearchTab();
    case 0:
      return new FriendsTab();
    //case 1:
    //  return new AlertsTab();
    default:
      return new SettingsTab();
    }
  }

  @Override
  public int getCount() {
    return CONTENT.length;
  }

  @Override
  public CharSequence getPageTitle(int position) {
    return CONTENT[position % CONTENT.length].toUpperCase();
  }

  @Override
  public int getIconResId(int index) {
    return ICONS[index];
  }
}




Java Source Code List

edu.mit.locate.APEditorActivity.java
edu.mit.locate.BootLocationService.java
edu.mit.locate.LoginActivity.java
edu.mit.locate.MITHttpsClient.java
edu.mit.locate.MITLocationService.java
edu.mit.locate.MainActivity.java
edu.mit.locate.alerts.Alert.java
edu.mit.locate.alerts.AlertsListAdapter.java
edu.mit.locate.alerts.AlertsTab.java
edu.mit.locate.apeditor.APListAdapter.java
edu.mit.locate.apeditor.APScanResult.java
edu.mit.locate.friends.FriendActivity.java
edu.mit.locate.friends.Friend.java
edu.mit.locate.friends.FriendsListAdapter.java
edu.mit.locate.friends.FriendsTab.java
edu.mit.locate.tabs.IconPagerAdapter.java
edu.mit.locate.tabs.IcsLinearLayout.java
edu.mit.locate.tabs.NavigationTab.java
edu.mit.locate.tabs.PageIndicator.java
edu.mit.locate.tabs.SearchTab.java
edu.mit.locate.tabs.SettingsTab.java
edu.mit.locate.tabs.TabPageIndicator.java
edu.mit.locate.tabs.TabPagerAdapter.java