List of usage examples for android.app ActionBar setNavigationMode
@Deprecated public abstract void setNavigationMode(@NavigationMode int mode);
From source file:com.indragie.cmput301as1.ExpenseClaimListActivity.java
/** * Set up fragments to display expense claim data. *//*from w w w . ja v a2s . co m*/ private void setupFragments() { User user = userManager.getActiveUser(); Session session = new Session(this, user); Session.setSharedSession(session); pagerAdapter = new ExpenseClaimPagerAdapter(this, getSupportFragmentManager(), user); pager.setAdapter(pagerAdapter); // From http://developer.android.com/training/implementing-navigation/lateral.html final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.TabListener tabListener = new ActionBar.TabListener() { public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) { pager.setCurrentItem(tab.getPosition()); } public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) { } public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) { } }; pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); Tab ownedTab = actionBar.newTab().setText(R.string.tab_owned).setTabListener(tabListener); Tab reviewalTab = actionBar.newTab().setText(R.string.tab_reviewal).setTabListener(tabListener); actionBar.addTab(ownedTab); actionBar.addTab(reviewalTab); }
From source file:com.android.dialer.calllog.CallLogActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.call_log_activity); final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowHomeEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(true); final Tab allTab = actionBar.newTab(); final String allTitle = getString(R.string.call_log_all_title); allTab.setContentDescription(allTitle); allTab.setText(allTitle);/*from w w w . j a va 2s . c om*/ allTab.setTabListener(mTabListener); actionBar.addTab(allTab); final Tab missedTab = actionBar.newTab(); final String missedTitle = getString(R.string.call_log_missed_title); missedTab.setContentDescription(missedTitle); missedTab.setText(missedTitle); missedTab.setTabListener(mTabListener); actionBar.addTab(missedTab); mViewPager = (ViewPager) findViewById(R.id.call_log_pager); mViewPagerAdapter = new ViewPagerAdapter(getFragmentManager()); mViewPager.setAdapter(mViewPagerAdapter); mViewPager.setOnPageChangeListener(mOnPageChangeListener); mViewPager.setOffscreenPageLimit(1); }
From source file:net.forkk.autocron.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set up the action bar. final ActionBar actionBar = getActionBar(); assert actionBar != null; actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the app. mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // 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/*w w w . j a va2s. c om*/ 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 callback (listener) for when // this tab is selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:com.example.emulator8051.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); /* 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 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.*//* www. j a v a2 s. co m*/ 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 callback (listener) for when this tab is selected.*/ actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:com.SpitsinStafichuk.vkazam_remastered.DrawerActivity.java
public void restoreActionBar() { ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle);//w w w.j ava 2 s. com } }
From source file:org.jorge.lolin1.ui.activities.DrawerLayoutFragmentActivity.java
protected void restoreActionBar() { ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(Boolean.TRUE); actionBar.setTitle(mTitle);//from w ww . j ava2 s . co m }
From source file:com.yangtsaosoftware.pebblemessenger.activities.NavigationActivity.java
public void restoreActionBar() { ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle);//from w w w . j a v a 2 s. c o m } }
From source file:ti.android.ble.devicemonitor.ViewPagerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate"); super.onCreate(savedInstanceState); setContentView(mResourceFragmentPager); // Set up the action bar final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ImageView view = (ImageView) findViewById(android.R.id.home); view.setPadding(10, 0, 20, 10);// ww w . ja v a 2 s . c o m // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(mResourceIdPager); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int n) { Log.d(TAG, "onPageSelected: " + n); actionBar.setSelectedNavigationItem(n); } }); // Create the adapter that will return a fragment for each section mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager.setAdapter(mSectionsPagerAdapter); }
From source file:com.little.ibooks.file.FileExplorerTabActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.file_fragment_pager); mViewPager = (ViewPager) findViewById(R.id.pager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_sd), FileViewActivity.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_remote), ServerControlActivity.class, null); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt(INSTANCESTATE_TAB, 0)); }//from w w w . j a v a2s .c o m // ?"WIFI" Intent intent = getIntent(); if (intent != null) { String fileMode = intent.getStringExtra("mode"); if (fileMode != null && "wifi".equals(fileMode)) { mViewPager.setCurrentItem(1); } } }
From source file:net.cherryzhang.sekuhara.LoginAndRegistration.LoginAndRegistrationActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_swipe_view_login_and_registration); mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); Parse.initialize(this, "TsVbzF7jXzY1C0o86V2xxAxgSxvy4jmbyykOabPl", "VzamwWm4WswbDFxrxos2oSerQ2Av4RM6J5mNnNgr"); final ActionBar actionBar = getActionBar(); actionBar.hide();// w w w .j a v a2s .c o m actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAppSectionsPagerAdapter); ViewPager.SimpleOnPageChangeListener mPageChangeListener = new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }; pageIndicator = (CirclePageIndicator) findViewById(R.id.CPI_pageIndicator); pageIndicator.setViewPager(mViewPager); pageIndicator.setOnPageChangeListener(mPageChangeListener); pageIndicator.setCurrentItem(0); //TODO: make circle page indicator look better final float density = getResources().getDisplayMetrics().density; pageIndicator.setRadius(6 * density); pageIndicator.setPageColor(0xFFFFCCFF); pageIndicator.setFillColor(0xFFFF6699); pageIndicator.setStrokeColor(0xFF000000); pageIndicator.setStrokeWidth(1); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mAppSectionsPagerAdapter.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. actionBar.addTab( actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }