示例#1
0
  @Override
  public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
    // When the given tab is selected, switch to the corresponding page in
    // the ViewPager.
    mViewPager.setCurrentItem(tab.getPosition());

    Log.d(LOG_TAG, "OnPageChangeListener Called with position - " + tab.getPosition());

    if (tab.getPosition() == 0) {
      Log.d(LOG_TAG, "Trying to find MySpotsFragment.");
      MySpotsFragment fragment = (MySpotsFragment) mSectionsPagerAdapter.getItem(tab.getPosition());
      if (fragment != null) {
        Log.d(LOG_TAG, "Found MySpotsFragment. Calling refresh spot list.");
        fragment.RefreshListOfSpotsTwoLines(this);
      }

    } else if (tab.getPosition() == 1) {
      //			AddSpotFragment fragment = (AddSpotFragment)
      // mSectionsPagerAdapter.getItem(tab.getPosition());
      //			if (fragment  != null) {
      //				Log.d(LOG_TAG, "Found MySpotsFragment. Calling refresh spot list.");
      //				fragment.refreshSpotNamesInAutocomplete(this);
      //			}
    }
  }
示例#2
0
  private void intiActionTab() {
    actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    tab_top = actionBar.newTab().setText("头条");
    tab_cyclopedia = actionBar.newTab().setText("百科");
    tab_message = actionBar.newTab().setText("资讯");
    tab_manage = actionBar.newTab().setText("经营");
    tab_data = actionBar.newTab().setText("数据");

    tab_top.setTabListener(this);
    tab_cyclopedia.setTabListener(this);
    tab_message.setTabListener(this);
    tab_manage.setTabListener(this);
    tab_data.setTabListener(this);

    actionBar.addTab(tab_top);
    actionBar.addTab(tab_cyclopedia);
    actionBar.addTab(tab_message);
    actionBar.addTab(tab_manage);
    actionBar.addTab(tab_data);
  }
 public void Add(String _title, View _panel, View _customTabView) {
   ActionBar.Tab tab = CreateTab(_title, _panel);
   _customTabView.setVisibility(View.VISIBLE);
   tab.setCustomView(_customTabView); // This overrides values set by setText(CharSequence) and
   // setIcon(Drawable).
   ActionBar actionBar = this.controls.activity.getActionBar();
   actionBar.addTab(tab, false);
 }
 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();
 }
 // This method adds a tab for use in tabbed navigation mode
 public void Add(String _title, View _panel, String _iconIdentifier) {
   ActionBar.Tab tab = CreateTab(_title, _panel);
   if (!_iconIdentifier.equals("")) {
     tab.setIcon(
         GetDrawableResourceById(GetDrawableResourceId(_iconIdentifier))); // _iconIdentifier
   }
   ActionBar actionBar = this.controls.activity.getActionBar();
   actionBar.addTab(tab, false);
 }
 private ActionBar.Tab CreateTab(String title, View v) {
   ActionBar actionBar = this.controls.activity.getActionBar();
   ActionBar.Tab tab = actionBar.newTab();
   tab.setText(title); //
   if (mCountTab != 0) {
     v.setVisibility(View.INVISIBLE);
   }
   TabContentFragment content = new TabContentFragment(v, title);
   tab.setTabListener(
       new TabListener(
           content)); // All tabs must have a TabListener set before being added to the ActionBar.
   mCountTab = mCountTab + 1;
   return tab;
 }
示例#7
0
 @Override
 public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
   // When the given tab is selected, switch to the corresponding page in
   // the ViewPager.
   Log.d(Constants.TAG, "MainActivity.onTabSelected");
   mViewPager.setCurrentItem(tab.getPosition());
 }
示例#8
0
 @Override
 public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
   // When the given tab is selected, switch to the corresponding page in
   // the ViewPager.
   mViewPager.setCurrentItem(tab.getPosition());
   favTab.refreshListview();
 }
示例#9
0
 @Override
 public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
   // When the given tab is selected, switch to the corresponding page in
   // the ViewPager.
   mViewPager.setCurrentItem(tab.getPosition());
   mViewPager.setOffscreenPageLimit(5); // setta il limite per non ricaricare i fragments
 }
        public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {

          if (mViewPager.getCurrentItem() != tab.getPosition())
            mViewPager.setCurrentItem(tab.getPosition());
          if (getCommentFragment() != null) getCommentFragment().clearActionMode();
          if (getRepostFragment() != null) getRepostFragment().clearActionMode();

          switch (tab.getPosition()) {
            case 1:
              comment = true;
              break;
            case 2:
              repost = true;
              break;
            case 3:
              break;
          }
        }
 public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
   switch (tab.getPosition()) {
     case 1:
       comment = false;
       break;
     case 2:
       repost = false;
       break;
   }
 }
示例#12
0
 @Override
 public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
   // When the given tab is selected, show the tab contents in the
   // container view.
   Fragment fragment = new DummySectionFragment();
   Bundle args = new Bundle();
   args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, tab.getPosition() + 1);
   fragment.setArguments(args);
   getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();
 }
  // From TabListener
  @Override
  public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
    // Create Fragment
    SampleFragment fragment = new SampleFragment();

    // Set title for display purposes
    Bundle b = new Bundle();
    b.putString(EXTRA_TITLE, tab.getText().toString());
    fragment.setArguments(b);

    ft.replace(R.id.ptr_fragment, fragment);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_profile);

    fragmentManager = getFragmentManager();

    ActionBar actionBar = getActionBar();

    // Hide ActionBar Icon
    actionBar.setDisplayShowHomeEnabled(false);

    // Hide ActionBar Title
    actionBar.setDisplayShowTitleEnabled(false);

    // Create ActionBar Tabs
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // Set Tab Icon and Titles
    Profile = actionBar.newTab().setText("Profile");
    Events = actionBar.newTab().setText("Events");

    // Set Tab Listeners
    Profile.setTabListener(new TabListener(fragmentProfileTab));
    Events.setTabListener(new TabListener(fragmentEventsTab));

    // Add Tabs to ActionBar
    actionBar.addTab(Profile);
    actionBar.addTab(Events);

    // Get which tab is selected from the intent
    Intent fromHomeView = getIntent();
    String tabSelected = fromHomeView.getStringExtra("tabSelected");
    int tabPosition = 0;
    if (tabSelected != null && tabSelected.equals("events")) {
      tabPosition = 1;
    }

    actionBar.setSelectedNavigationItem(tabPosition);
  }
示例#15
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   ctoDAO = ContatoDAO.getInstance(MainActivity.this);
   ctoDAO.open();
   screen_tablet_ou_phone = isTablet(MainActivity.this);
   if (screen_tablet_ou_phone) {
     setContentView(R.layout.tela_inicial_tablet); // associa o layout para tablets
   } else {
     setContentView(R.layout.tela_inicial_smartphone); // associa o layout para smartphones
     ActionBar actionBar = getActionBar();
     actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
     // tab1
     ActionBar.Tab tab1 = actionBar.newTab().setText("Lista de Contatos");
     Fragment fragment_listview = new ListviewFragment();
     tab1.setTabListener(new MyTabListener(MainActivity.this, fragment_listview));
     actionBar.addTab(tab1);
     // tab2
     ActionBar.Tab tab2 = actionBar.newTab().setText("Novo Contato");
     Fragment fragment_inputs = new InputsFragment();
     tab2.setTabListener(new MyTabListener(MainActivity.this, fragment_inputs));
     actionBar.addTab(tab2);
   }
 }
  @Override
  public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {

    // Launch signUp Activity
    if (tab.getText().equals(getResources().getString(R.string.signup))) {
      Log.d("MainActivity", "SingUp: Setting Intent...");
      Intent intent = new Intent();
      intent.setClass(MainActivitySeTIChat.this, SeTIChatSignUpActivity.class);
      startActivity(intent);
    }

    // When the given tab is selected, show the tab contents in the
    // container view.
    ContactsFragment fragment = new ContactsFragment();
    getFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();
  }
 public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
   switch (tab.getPosition()) {
     case 1:
       if (comment) {
         Utility.stopListViewScrollingAndScrollToTop(getCommentFragment().getListView());
       }
       break;
     case 2:
       if (repost) {
         Utility.stopListViewScrollingAndScrollToTop(getRepostFragment().getListView());
       }
       break;
     case 3:
       break;
   }
 }
示例#18
0
  private void addTabs() {
    ActionBar.Tab addNewExpenseTab = actionBar.newTab();
    addNewExpenseTab.setTabListener(this);
    addNewExpenseTab.setText("Add New");
    actionBar.addTab(addNewExpenseTab);

    ActionBar.Tab todayTab = actionBar.newTab();
    todayTab.setTabListener(this);
    todayTab.setText("Today");
    actionBar.addTab(todayTab);
  }
示例#19
0
  public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {

    int tabIndex = tab.getPosition();

    NetworkListFragment fragment = fragments.get(tabIndex);

    if (fragment == null) {
      if (tabIndex == 0) {
        fragment = new BackupedFragment();
      } else if (tabIndex == 1) {
        fragment = new ConfiguredFragment();
      }
    }

    fragments.put(tabIndex, fragment);

    getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();
  }
  @Override
  public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {

    Fragment fragment = new MyFragment();
    Bundle args = new Bundle();

    switch (tab.getPosition()) {
      case 0:
        args.putString("color", "#2574a9");
        fragment.setArguments(args);
        break;
      case 1:
        args.putString("color", "#36d5b5");
        fragment.setArguments(args);
        break;
      case 2:
        args.putString("color", "#f9640f");
        fragment.setArguments(args);
        break;
    }

    ft.replace(android.R.id.content, fragment);
  }
示例#21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stations_all);
    ActionBar ab = getActionBar();
    ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    ActionBar.Tab listTab = ab.newTab().setText("List");
    ActionBar.Tab mapTab = ab.newTab().setText("Map");

    Fragment listFrag = new StationsListFragment();
    Fragment mapFrag = new InteractiveMapFragment();

    listTab.setTabListener(new StationsAllTabListener(listFrag));
    listTab.setTabListener(new StationsAllTabListener(listFrag));
    listTab.setTabListener(new StationsAllTabListener(listFrag));

    mapTab.setTabListener(new StationsAllTabListener(mapFrag));

    ab.addTab(listTab);
    ab.addTab(mapTab);

    listTab.select();
  }
 @Override
 public Tab getTabAt(int index) {
   android.app.ActionBar.Tab selected = mActionBar.getTabAt(index);
   return (selected != null) ? (Tab) selected.getTag() : null;
 }
 @Override
 public CharSequence getContentDescription() {
   return mNativeTab.getContentDescription();
 }
 @Override
 public Tab setContentDescription(CharSequence contentDesc) {
   mNativeTab.setContentDescription(contentDesc);
   return this;
 }
 @Override
 public Tab setContentDescription(int resId) {
   mNativeTab.setContentDescription(resId);
   return this;
 }
 @Override
 public void select() {
   mNativeTab.select();
 }
 @Override
 public Tab setTabListener(TabListener listener) {
   mNativeTab.setTabListener(listener != null ? this : null);
   mListener = listener;
   return this;
 }
 @Override
 public View getCustomView() {
   return mNativeTab.getCustomView();
 }
 @Override
 public Tab setCustomView(int layoutResId) {
   mNativeTab.setCustomView(layoutResId);
   return this;
 }
 @Override
 public Tab setCustomView(View view) {
   mNativeTab.setCustomView(view);
   return this;
 }