@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_contact_mail); // needed? // implement action bar ActionBar aBar = getActionBar(); aBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); aBar.setDisplayHomeAsUpEnabled(true); // friend tab String lab1 = getResources().getString(R.string.friends); // what do i id? Tab tab = aBar.newTab(); tab.setText(lab1); TabListener<friendFrag> friFrag = new TabListener<friendFrag>(this, lab1, friendFrag.class); tab.setTabListener(friFrag); aBar.addTab(tab); // mail tab String lab2 = getResources().getString(R.string.mail); tab = aBar.newTab(); tab.setText(lab2); TabListener<mailFrag> mFrag = new TabListener<mailFrag>(this, lab2, mailFrag.class); tab.setTabListener(mFrag); aBar.addTab(tab); }
public void onTabSelected(Tab tab, FragmentTransaction ft) { ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out); switch (tab.getPosition()) { case 0: ft.show(adaptiveFragment); break; case 1: ft.show(gaugesFragment); break; case 2: if (connected != null && connected.isAlive()) { progress = ProgressDialog.show(ctx, "Fuel Map", "Reading map values 0/512..."); mapOffset = 0; mapMode = true; sendRequest(mapOffset); } ft.show(fuelFragment); break; } // we don't want to overwrite our pref if we're in onCreate if (lvDevices != null) { Editor edit = prefs.edit(); edit.putInt("prefs_last_tab", tab.getPosition()); edit.commit(); } }
private void setupCallLog() { final Tab tab = getActionBar().newTab(); tab.setContentDescription(R.string.recentCallsIconLabel); tab.setIcon(R.drawable.ic_tab_recent); tab.setTabListener(mTabListener); getActionBar().addTab(tab); }
private void setupFavorites() { final Tab tab = getActionBar().newTab(); tab.setContentDescription(R.string.contactsFavoritesLabel); tab.setIcon(R.drawable.ic_tab_all); tab.setTabListener(mTabListener); getActionBar().addTab(tab); }
private void setupDialer() { final Tab tab = getActionBar().newTab(); tab.setContentDescription(R.string.dialerIconLabel); tab.setTabListener(mTabListener); tab.setIcon(R.drawable.ic_tab_dialer); getActionBar().addTab(tab); }
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { if (DEBUG) { Log.d(TAG, "onTabSelected(). tab: " + tab + ", mDuringSwipe: " + mDuringSwipe); } // When the user swipes the screen horizontally, this method will be called after // ViewPager.SCROLL_STATE_DRAGGING and ViewPager.SCROLL_STATE_SETTLING events, while // when the user clicks a tab at the ActionBar at the top, this will be called before // them. This logic interprets the order difference as a difference of the user action. if (!mDuringSwipe) { if (mDialpadFragment != null) { if (DEBUG) Log.d(TAG, "Immediately hide fake buttons for tab selection case"); mDialpadFragment.updateFakeMenuButtonsVisibility(false); } mUserTabClick = true; } if (mViewPager.getCurrentItem() != tab.getPosition()) { mViewPager.setCurrentItem(tab.getPosition(), true); } // During the call, we don't remember the tab position. if (!DialpadFragment.phoneIsInUse()) { // Remember this tab index. This function is also called, if the tab is set // automatically in which case the setter (setCurrentTab) has to set this to its old // value afterwards mLastManuallySelectedFragment = tab.getPosition(); } }
private void initializeBrowseTabs() { ActionBar actionBar = getActivity().getActionBar(); TabListener listener = getTabListener(); // Initialize Featured Tab position=1 Tab actionBarTab = actionBar.newTab().setTabListener(listener); actionBarTab.setIcon( new IconDrawable(getActivity(), IconValue.fa_film) .colorRes(R.color.actionbar_tab_text) .actionBarSize()); actionBar.addTab(actionBarTab); // Initialize Varieties Tab position=2 actionBarTab = actionBar.newTab().setTabListener(listener); actionBarTab.setIcon( new IconDrawable(getActivity(), IconValue.fa_th_large) .colorRes(R.color.actionbar_tab_text) .actionBarSize()); actionBar.addTab(actionBarTab); // Initialize All Tab position=3 actionBarTab = actionBar.newTab().setTabListener(listener); actionBarTab.setIcon( new IconDrawable(getActivity(), IconValue.fa_archive) .colorRes(R.color.actionbar_tab_text) .actionBarSize()); actionBar.addTab(actionBarTab); }
public void addTab(Tab tab, Class<?> _clss, Bundle _args) { TabInfo info = new TabInfo(_clss, _args); tab.setTag(info); tab.setTabListener(this); mTabInfos.add(info); mActionBar.addTab(tab); notifyDataSetChanged(); }
public void onReceivedTitle(WebView view, String title) { if (view == mWebView) { if (!TextUtils.isEmpty(title)) { mTab.setText(stripTitle(title)); } else { mTab.setText(R.string.NewTab); } } }
public void onTabSelected(Tab tab, FragmentTransaction ft) { Object tag = tab.getTag(); for (int i = 0; i < mTabs.size(); i++) { if (mTabs.get(i) == tag) { mViewPager.setCurrentItem(i); } } if (!tab.getText().equals(mContext.getString(R.string.tab_sd))) { ActionMode actionMode = ((FileExplorerTabActivity) mContext).getActionMode(); if (actionMode != null) { actionMode.finish(); } } }
@Override public void onCreate(Bundle savedInstanceState) { try { Ctxt = this; super.onCreate(savedInstanceState); setContentView(R.layout.activity_measurements_entry); // Create the adapter that will return a fragment for each of the three primary sections // of the app. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setHomeButtonEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding tab. // We can also use ActionBar.Tab#select() to do this if we have a reference to the // Tab. mViewPager.setOnPageChangeListener( new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by the adapter. // Also specify this Activity object, which implements the TabListener interface, as the // listener for when this tab is selected. Tab tab = actionBar.newTab(); tab.setText(mSectionsPagerAdapter.getPageTitle(i)); // tab.setIcon(icon) tab.setTabListener(this); actionBar.addTab(tab); } } catch (Exception e) { e.printStackTrace(); } }
public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) { Object tag = tab.getTag(); for (int i = 0; i < this.tabs.size(); i++) { if (this.tabs.get(i) == tag) { this.viewPager.setCurrentItem(i); } } }
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { for (int i = 0; i < mTabPagerList.size(); i++) { if (i == tab.getPosition()) { mViewPager.setCurrentItem(i); } } }
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { Object tag = tab.getTag(); for (int i = 0; i < mTabs.size(); i++) { if (mTabs.get(i) == tag) { mViewPager.setCurrentItem(i); } } }
/** Hides every tab and shows search UI for phone lookup. */ private void enterSearchUi() { if (mSearchFragment == null) { // We add the search fragment dynamically in the first onLayoutChange() and // mSearchFragment is set sometime later when the fragment transaction is actually // executed, which means there's a window when users are able to hit the (physical) // search key but mSearchFragment is still null. // It's quite hard to handle this case right, so let's just ignore the search key // in this case. Users can just hit it again and it will work this time. return; } if (mSearchView == null) { prepareSearchView(); } final ActionBar actionBar = getActionBar(); final Tab tab = actionBar.getSelectedTab(); // User can search during the call, but we don't want to remember the status. if (tab != null && !DialpadFragment.phoneIsInUse()) { mLastManuallySelectedFragment = tab.getPosition(); } mSearchView.setQuery(null, true); actionBar.setDisplayShowCustomEnabled(true); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowHomeEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); sendFragmentVisibilityChange(mViewPager.getCurrentItem(), false); // Show the search fragment and hide everything else. mSearchFragment.setUserVisibleHint(true); final FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.show(mSearchFragment); transaction.commitAllowingStateLoss(); mViewPager.setVisibility(View.GONE); // We need to call this and onActionViewCollapsed() manually, since we are using a custom // layout instead of asking the search menu item to take care of SearchView. mSearchView.onActionViewExpanded(); mInSearchUi = true; }
@Override public void onTabSelected(Tab tab, android.app.FragmentTransaction fragmentTransaction) { /** On first tab we will show our list */ if (tab.getPosition() == 0) { SimpleListFragment simpleListFragment = new SimpleListFragment(); getSupportFragmentManager() .beginTransaction() .replace(R.id.container, simpleListFragment) .commit(); } else { /** Other tabs will show duffy fragments */ 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(); } }
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { switch (tab.getPosition()) { case 0: ft.replace(R.id.fragment_container, listViewFragment); break; case 1: ft.replace(R.id.fragment_container, mapViewFragment); break; } }
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { FragmentManager manager = getSupportFragmentManager(); android.support.v4.app.FragmentTransaction fts = manager.beginTransaction(); if (tab.getTag() == "HomeTimelineFragment") { fts.replace(R.id.frame_container, new HomeTimelineFragment()); } else { fts.replace(R.id.frame_container, new MentionsFragment()); } fts.commit(); }
public void setUp() { actionBar = getActionBar(); // create new adapter from custom class mAdapter = new MyPagerAdapter(getSupportFragmentManager()); // grab pager and set adapter appropriately mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); // Specify that tabs should be displayed in the action bar. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create a tab listener that is called when the user changes tabs. ActionBar.TabListener tabListener = new ActionBar.TabListener() { @Override public void onTabReselected(Tab tab, android.app.FragmentTransaction ft) {} // when tab is selected go to the correct page @Override public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) { mPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(Tab tab, android.app.FragmentTransaction ft) {} }; // Add 3 tabs, specifying the tab's text and TabListener for (int i = 0; i < 3; i++) { Tab tab = actionBar.newTab().setTabListener(tabListener); if (i == 0) tab.setText("All"); else if (i == 1) tab.setText("Text"); else tab.setText("Images"); actionBar.addTab(tab); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mySharedPreferences = getSharedPreferences(MY_PREFS, Activity.MODE_PRIVATE); boolean primero = mySharedPreferences.getBoolean(PRIMERAVEZ, true); if (primero) { SharedPreferences.Editor editor = mySharedPreferences.edit(); editor.putBoolean(PRIMERAVEZ, false); editor.apply(); Intent intentAlarma = new Intent(this, MyService.class); intentAlarma.putExtra("Url", FragmentoLista.enlace); startService(intentAlarma); } ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); Tab tabLista = actionBar.newTab(); tabLista .setText("Lista") .setTabListener(new TabListener<FragmentoLista>(this, R.id.lista, FragmentoLista.class)); actionBar.addTab(tabLista); Tab tabMapa = actionBar.newTab(); tabMapa .setText("Mapa") .setTabListener(new TabListener<FragmentoMapa>(this, R.id.lista, FragmentoMapa.class)); actionBar.addTab(tabMapa); if (savedInstanceState == null) { FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); fragmentTransaction.add(R.id.lista, new FragmentoLista(), "list"); fragmentTransaction.commit(); } }
@Override public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) { currentTab = (String) tab.getText(); // Check if the fragment is already initialized if (mFragment == null) { // If not, instantiate and add it to the activity mFragment = android.app.Fragment.instantiate(mActivity, mClass.getName()); ft.add(android.R.id.content, mFragment, mTag); } else { // If it exists, simply attach it in order to show it ft.attach(mFragment); } }
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { Object tableInfo = tab.getTag(); for (int i = 0; i < mTabInfos.size(); i++) { if (mTabInfos.get(i) == tableInfo) mViewPager.setCurrentItem(i); } /* * ActionMode actionMode = ((FileManagerMainActivity) * mActivity).getActionMode(); if (actionMode != null) * actionMode.finish(); */ }
public void onTabUnselected(Tab tab, FragmentTransaction ft) { ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out); switch (tab.getPosition()) { case 0: ft.hide(adaptiveFragment); break; case 1: ft.hide(gaugesFragment); break; case 2: ft.hide(fuelFragment); } }
/* Replace FrameLayout container in the layout with the correct fragment, * according to which tab is selected. */ @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { Log.i(LOGTAG, "Tab selected"); Fragment fragment = new Fragment(); switch (tab.getPosition()) { case MakeTagFragment.FRAGMENT_ID: fragment = new MakeTagFragment(); break; case MyTagsFragment.FRAGMENT_ID: fragment = new MyTagsFragment(); break; } getFragmentManager() .beginTransaction() .replace(R.id.container, fragment, FRAGMENT_TAG) .commit(); }
public void attachTabs(ActionBar bar) { TabListener tl = new TabListener(this, this); Tab tab1 = bar.newTab(); tab1.setText("Tab1"); tab1.setTabListener(tl); bar.addTab(tab1); Tab tab2 = bar.newTab(); tab2.setText("Tab2"); tab2.setTabListener(tl); bar.addTab(tab2); }
public void workwithTabbedActionBar() { ActionBar bar = this.getActionBar(); bar.setTitle(tag); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); TabListener tl = new TabListener(this, this); Tab tab1 = bar.newTab(); tab1.setText("Tab1"); tab1.setTabListener(tl); bar.addTab(tab1); Tab tab2 = bar.newTab(); tab2.setText("Tab2"); tab2.setTabListener(tl); bar.addTab(tab2); }
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub vpAssessments.setCurrentItem(tab.getPosition()); setActivityTitle(activityTitle[tab.getPosition()]); }
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { // on tab selected // show respected fragment view viewPager.setCurrentItem(tab.getPosition()); }
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { viewPager.setCurrentItem(tab.getPosition()); }
public void onTabReselected(Tab tab, FragmentTransaction ft) { ft.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out); switch (tab.getPosition()) { case 0: ft.show(adaptiveFragment); break; case 1: ft.show(gaugesFragment); break; case 2: ft.show(fuelFragment); // chart.setAutoRepaint(false); // // short cnt = 0; // ser.clear(); // // for (int x = 0; x < 32; x++) { // for (int y = 0; y < 16; y++) { // double val = REF_TAB[cnt]; // ser.add(x, val, y); // Log.d(TAG, String.format("%d:%d = %.0f", x, y, val)); // cnt++; // } // } // // for (int x = 0; x < chart.getAxes().getCount(); x++) { // chart.getAxes().getAxis(x).getLabels().getItems().clear(); // } // // for (double x = 0; x < 32; x++) { // AxisLabelItem itm = chart.getAxes().getBottom().getLabels().getItems().add(x); // itm.getFont().setSize(10); // itm.getFont().setColor(com.steema.teechart.drawing.Color.white); // itm.setText(String.format("%.0f", 300 * x)); // } // // for (double x = 0; x < 16; x++) { // AxisLabelItem itm = chart.getAxes().getDepth().getLabels().getItems().add(x, x == 0 ? // " " : String.format("%.0f", 13 * x)); // itm.getFont().setSize(10); // itm.getFont().setColor(com.steema.teechart.drawing.Color.white); // } // // chart.getAxes().getBottom().getTitle().setText("Engine RPM"); // // chart.getAxes().getBottom().getTitle().getFont().setColor(com.steema.teechart.drawing.Color.white); // chart.getAxes().getBottom().getTitle().getFont().setSize(14); // // chart.getAxes().getDepth().getTitle().setText("MAP (kPa)"); // // chart.getAxes().getDepth().getTitle().getFont().setColor(com.steema.teechart.drawing.Color.white); // chart.getAxes().getDepth().getTitle().getFont().setSize(14); // // chart.refreshControl(); // chart.setAutoRepaint(true); // } }