コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.year_browser);
    // set the home button in actionbar
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setTitle("Courses by Year");

    ActionBar.Tab year1Tab = actionBar.newTab().setText("Year 1");
    ActionBar.Tab year2Tab = actionBar.newTab().setText("Year 2");
    ActionBar.Tab year3Tab = actionBar.newTab().setText("Year 3");
    ActionBar.Tab year4Tab = actionBar.newTab().setText("Year 4");
    ActionBar.Tab year5Tab = actionBar.newTab().setText("Year 5");

    Fragment year1Frag = new Year1Fragment();
    Fragment year2Frag = new Year2Fragment();
    Fragment year3Frag = new Year3Fragment();
    Fragment year4Frag = new Year4Fragment();
    Fragment year5Frag = new Year5Fragment();

    year1Tab.setTabListener(new YearTabsListener(year1Frag));
    year2Tab.setTabListener(new YearTabsListener(year2Frag));
    year3Tab.setTabListener(new YearTabsListener(year3Frag));
    year4Tab.setTabListener(new YearTabsListener(year4Frag));
    year5Tab.setTabListener(new YearTabsListener(year5Frag));

    actionBar.addTab(year1Tab);
    actionBar.addTab(year2Tab);
    actionBar.addTab(year3Tab);
    actionBar.addTab(year4Tab);
    actionBar.addTab(year5Tab);
  }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // If we get created for the first time we get our data from the intent
    Bundle data = savedInstanceState != null ? savedInstanceState : getIntent().getExtras();
    session = (Session) data.getSerializable(Session.IDENTIFIER);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    ActionBar.Tab tab =
        getSupportActionBar()
            .newTab()
            .setText(R.string.info)
            .setTabListener(
                new TabListener<NodeListFragment>(this, "NodeList", NodeListFragment.class));
    actionBar.addTab(tab);

    if (session.getResult() != null) {
      tab =
          getSupportActionBar()
              .newTab()
              .setText(R.string.Result)
              .setTabListener(new TabListener<InfoFragment>(this, "Info", InfoFragment.class));
      actionBar.addTab(tab);
    }

    if (savedInstanceState != null)
      getSupportActionBar()
          .selectTab(getSupportActionBar().getTabAt(savedInstanceState.getInt("Tab", 0)));
  }
コード例 #3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
      setTheme(R.style.Theme_Sherlock_Light);
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.footer);

    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setOnPageChangeListener(onPageChangeListener);
    viewPager.setAdapter(new PagerAdapters(getSupportFragmentManager()));

    actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    actionBar.setDisplayShowTitleEnabled(true);

    Tab tab = actionBar.newTab().setText("Categories").setTabListener(new TabListnr());

    actionBar.addTab(tab);

    tab = actionBar.newTab().setText("My Posts").setTabListener(new TabListnr());

    actionBar.addTab(tab);
  }
コード例 #4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getIntent().hasExtra("template_story")) {
      templateStory = true;
    }

    if (getIntent().hasExtra("template_path")) {
      templateJsonPath = getIntent().getStringExtra("template_path");
    }

    if (getIntent().hasExtra("story_mode")) {
      storyMode = getIntent().getIntExtra("story_mode", Project.STORY_TYPE_VIDEO);
    }

    mContext = getBaseContext();

    setContentView(R.layout.activity_scene_editor_no_swipe);

    // Set up the action bar.
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayHomeAsUpEnabled(true);

    // For each of the sections in the app, add a tab to the action bar.
    actionBar.addTab(actionBar.newTab().setText(R.string.tab_add_clips).setTabListener(this));
    actionBar.addTab(actionBar.newTab().setText(R.string.tab_order).setTabListener(this));
    actionBar.addTab(actionBar.newTab().setText(R.string.tab_publish).setTabListener(this));

    showHelp();
  }
コード例 #5
0
ファイル: RepositoryActivity.java プロジェクト: JoonyLi/gh4a
  private void fillTabs() {
    mActionBar.removeAllTabs();
    mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    mActionBar.setSubtitle(
        StringUtils.isBlank(mSelectBranchTag) ? mRepository.getMasterBranch() : mSelectBranchTag);

    mAdapter = new RepositoryAdapter(getSupportFragmentManager());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);

    mPager.setOnPageChangeListener(
        new OnPageChangeListener() {

          @Override
          public void onPageScrollStateChanged(int arg0) {}

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageSelected(int arg0) {
            mActionBar.getTabAt(arg0).select();
          }
        });

    Tab tab =
        mActionBar
            .newTab()
            .setText(R.string.about)
            .setTabListener(new TabListener<SherlockFragmentActivity>(this, 0 + "", mPager));
    mActionBar.addTab(tab, mCurrentTab == 0);

    tab =
        mActionBar
            .newTab()
            .setText(R.string.repo_files)
            .setTabListener(new TabListener<SherlockFragmentActivity>(this, 1 + "", mPager));
    mActionBar.addTab(tab, mCurrentTab == 1);

    tab =
        mActionBar
            .newTab()
            .setText(getResources().getQuantityString(R.plurals.commit, 2))
            .setTabListener(new TabListener<SherlockFragmentActivity>(this, 2 + "", mPager));
    mActionBar.addTab(tab, mCurrentTab == 2);
  }
コード例 #6
0
 public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
   TabInfo info = new TabInfo(clss, args);
   tab.setTag(info);
   tab.setTabListener(this);
   mTabs.add(info);
   mActionBar.addTab(tab);
   notifyDataSetChanged();
 }
コード例 #7
0
ファイル: Friends.java プロジェクト: ramsay/PushPoll-Public
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getSupportFragmentManager().findFragmentById(android.R.id.content) != null) {
      FragmentManager fragMgr = getSupportFragmentManager();
      FragmentTransaction ft = fragMgr.beginTransaction();
      ft.detach(getSupportFragmentManager().findFragmentById(android.R.id.content));
      ft.commit();
    }

    tracker = GoogleAnalyticsTracker.getInstance();

    // Start the tracker in manual dispatch mode...
    tracker.startNewSession(Keys.ANALYTICS_KEY, this);
    // setup action bar for tabs
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);

    Tab friendsTab =
        actionBar
            .newTab()
            .setText(R.string.friends_tabtitle)
            .setTabListener(
                new TabListenerList<FriendListFragment>(this, "friends", FriendListFragment.class));
    actionBar.addTab(friendsTab, true);

    Tab groupsTab =
        actionBar
            .newTab()
            .setText(R.string.groups_tabtitle)
            .setTabListener(
                new TabListenerList<GroupListFragment>(this, "groups", GroupListFragment.class));
    actionBar.addTab(groupsTab, true);

    actionBar.setSelectedNavigationItem(0);
  }
コード例 #8
0
ファイル: MainActivity.java プロジェクト: ilexus/geo-track
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);
   // valmistellaan ja populoidaan tabit actionBariin
   getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
   getSupportActionBar().setDisplayShowHomeEnabled(false);
   getSupportActionBar().setDisplayShowTitleEnabled(false);
   final ActionBar bar = getSupportActionBar();
   bar.addTab(
       bar.newTab()
           .setText(R.string.tab_status)
           .setTabListener(
               new TabListener<StatusFragment>(this, STATUS_TAG, StatusFragment.class)));
   mapTab =
       bar.newTab().setText(R.string.tab_map).setTabListener(new MapTabListener(this, MAP_TAG));
   bar.addTab(mapTab);
   bar.addTab(
       bar.newTab()
           .setText(R.string.tab_history)
           .setTabListener(new HistoryTabListener(this, HISTORY_TAG)));
   if (savedInstanceState != null)
     bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
 }
  protected void addTab(
      String tabTag, String text, Integer textResourceId, Integer iconResourceId) {
    if (sherlock == null) throw new IllegalArgumentException("Must call setSherlock first");
    if (tabTag == null) throw new IllegalArgumentException("tabTag may not be NULL");
    if ((text == null && textResourceId == null) == (iconResourceId == null))
      throw new IllegalArgumentException("Either text or icon must be set for a tab (not both)");

    final ActionBar actionBar = sherlock.getActionBar();

    Tab tab = actionBar.newTab();

    if (text != null) tab.setText(text);
    else if (textResourceId != null) tab.setText(textResourceId);
    else if (iconResourceId != null) tab.setIcon(iconResourceId);

    tab.setTag(tabTag);
    tab.setTabListener(this);

    actionBar.addTab(tab);
  }
コード例 #10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ActionBar actionbar = getSupportActionBar();
    actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionbar.setTitle("PROFILE");
    Tab frag1tab = actionbar.newTab().setText("LOGIN");
    Tab frag2tab = actionbar.newTab().setText("REGISTER");

    Fragment fragment1 = new LoginFragment();
    Fragment fragment2 = new RegistrationFragment();

    frag1tab.setTabListener(new MyTabListener(fragment1));
    frag2tab.setTabListener(new MyTabListener(fragment2));

    actionbar.addTab(frag1tab);
    actionbar.addTab(frag2tab);
  }
コード例 #11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    if (Conf.codePoint == null) finish();

    this.point = Conf.codePoint;

    myTimer2 = new Timer();
    uiHandler2 = new Handler();

    myTimer3 = new Timer();
    uiHandler3 = new Handler();

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);

    // add bar
    actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // add 1st tab
    tab1 = actionBar.newTab();
    tab1.setText(" 1 ");
    tab1.setTabListener(this);
    actionBar.addTab(tab1);

    // add 2nd tab
    tab2 = actionBar.newTab();
    tab2.setText(" 2 ");
    tab2.setTabListener(this);
    actionBar.addTab(tab2);

    // add 3nd tab
    tab3 = actionBar.newTab();
    tab3.setText(" 3 ");
    tab3.setTabListener(this);
    actionBar.addTab(tab3);

    // add 4nd tab
    tab4 = actionBar.newTab();
    tab4.setText(" 4 ");
    tab4.setTabListener(this);
    actionBar.addTab(tab4);

    actionBar.hide();

    // UPDATE STATUS
    myTimer2.schedule(
        new TimerTask() {
          @Override
          public void run() {
            uiHandler2.post(
                new Runnable() {
                  @Override
                  public void run() {
                    updateUpdateInfo();
                  }
                });
          };
        },
        0L,
        1L * 1000);

    isOnline();
  }
コード例 #12
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    bookId = getIntent().getIntExtra(EXTRA_bookId, -1);
    chapter_1 = getIntent().getIntExtra(EXTRA_chapter, 0);
    verse_1 = getIntent().getIntExtra(EXTRA_verse, 0);

    ActionBar actionBar = getSupportActionBar();

    if (getResources().getBoolean(R.bool.screen_sw_check_min_600dp) == false) {
      // The following two options trigger the collapsing of the main action bar view.
      actionBar.setDisplayShowHomeEnabled(false);
      actionBar.setDisplayShowTitleEnabled(false);
    }

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.addTab(
        actionBar
            .newTab()
            .setTag(tab_dialer)
            .setText(R.string.goto_tab_dialer_label)
            .setTabListener(
                new TabListener<GotoDialerFragment>(
                    this,
                    "dialer",
                    GotoDialerFragment.class,
                    GotoDialerFragment.createArgs(bookId, chapter_1, verse_1)))); // $NON-NLS-1$
    actionBar.addTab(
        actionBar
            .newTab()
            .setTag(tab_direct)
            .setText(R.string.goto_tab_direct_label)
            .setTabListener(
                new TabListener<GotoDirectFragment>(
                    this,
                    "direct",
                    GotoDirectFragment.class,
                    GotoDirectFragment.createArgs(bookId, chapter_1, verse_1)))); // $NON-NLS-1$
    actionBar.addTab(
        actionBar
            .newTab()
            .setTag(tab_grid)
            .setText(R.string.goto_tab_grid_label)
            .setTabListener(
                new TabListener<GotoGridFragment>(
                    this,
                    "grid",
                    GotoGridFragment.class,
                    GotoGridFragment.createArgs(bookId, chapter_1, verse_1)))); // $NON-NLS-1$

    if (savedInstanceState == null) {
      // get from preferences
      int tabUsed = Preferences.getInt(Prefkey.goto_last_tab, 0);
      if (tabUsed >= 1 && tabUsed <= 3) {
        actionBar.setSelectedNavigationItem(tabUsed - 1 /* to make it 0-based */);
      }
    } else {
      actionBar.setSelectedNavigationItem(savedInstanceState.getInt(INSTANCE_STATE_tab, 0));
    }
  }