List of usage examples for android.app ActionBar NAVIGATION_MODE_STANDARD
int NAVIGATION_MODE_STANDARD
To view the source code for android.app ActionBar NAVIGATION_MODE_STANDARD.
Click Source Link
From source file:org.dmfs.webcal.fragments.MyCalendarsFragment.java
private void setupActionBarTabs() { ActionBar actionBar = getActivity().getActionBar(); int tabCount = actionBar.getTabCount(); int pageCount = mAdapter.getCount(); // replace titles and listeners of existing tabs int i = 0;/*from www . j a v a2 s .c om*/ for (; i < tabCount && i < pageCount; ++i) { final Tab tab = actionBar.getTabAt(i); tab.setText(mAdapter.getPageTitle(i)); tab.setTabListener(this); } // add missing tabs for (; i < pageCount; ++i) { actionBar.addTab(actionBar.newTab().setText(mAdapter.getPageTitle(i)).setTabListener(this)); } // remove remaining tabs for (; i < tabCount; --tabCount) { actionBar.removeTabAt(i); } if (pageCount > 1) { int selection = mSelectedTab; // changing the navigation mode might trigger a call to onTabSelected, overriding mSelectedTab with a wrong value, so save it actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mSelectedTab = selection; if (selection < pageCount) { mViewPager.setCurrentItem(selection, false); } } else { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); } }
From source file:activities.PaintingActivity.java
public void restoreActionBar() { ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayUseLogoEnabled(true); actionBar.setLogo(R.drawable.navbar_logo); actionBar.setIcon(R.drawable.ic_drawer); }
From source file:net.wespot.pim.controller.InquiryActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { INQ.init(this); INQ.accounts.syncMyAccountDetails(); INQ.inquiry.setCurrentInquiry(DaoConfiguration.getInstance().getInquiryLocalObjectDao() .load(savedInstanceState.getLong(CURRENT_INQUIRY))); INQ.inquiry.getCurrentInquiry().setRunLocalObject(DaoConfiguration.getInstance().getRunLocalObjectDao() .load(savedInstanceState.getLong(CURRENT_INQUIRY_RUN))); Log.e(TAG, "RUN ID: " + INQ.inquiry.getCurrentInquiry().getRunLocalObject().getId() + " " + INQ.inquiry.getCurrentInquiry().getRunLocalObject().getTitle()); Log.e(TAG, "INQUIRY ID: " + INQ.inquiry.getCurrentInquiry().getId() + " " + INQ.inquiry.getCurrentInquiry().getTitle()); }//from w w w .ja v a 2 s .c om if (INQ.inquiry.getCurrentInquiry() == null) { Log.e(TAG, "New inquiry"); setContentView(R.layout.wrapper); FragmentManager fragmentManager = getSupportFragmentManager(); android.support.v4.app.FragmentTransaction fragmentTransaction; fragmentTransaction = fragmentManager.beginTransaction(); InqCreateInquiryFragment fragment = new InqCreateInquiryFragment(); fragmentTransaction.add(R.id.content, fragment); fragmentTransaction.commit(); setTitle(R.string.actionbar_inquiry_list); } else { setContentView(R.layout.activity_inquiry); // Create an adapter that when requested, will return a fragment representing an object in // the collection. // ViewPager and its adapters use support library fragments, so we must use // getSupportFragmentManager. /* The {@link android.support.v4.view.PagerAdapter} that will provide fragments representing each object in a collection. We use a {@link android.support.v4.app.FragmentStatePagerAdapter} derivative, which will destroy and re-create fragments as needed, saving and restoring their state in the process. This is important to conserve memory and is a best practice when allowing navigation between objects in a potentially large collection. */ InquiryPagerAdapter mInquiryPagerAdapter = new InquiryPagerAdapter(getSupportFragmentManager(), mViewPager); getmActionBarHelper().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); // Set up the ViewPager, attaching the adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mInquiryPagerAdapter); mViewPager.setOnPageChangeListener(this); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mInquiryPagerAdapter.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. getmActionBarHelper().addTab(getmActionBarHelper().newTab() .setText(mInquiryPagerAdapter.getPageTitle(i)).setTabListener(this)); } getActionBar().setTitle(getResources().getString(R.string.actionbar_inquiry) + " - " + INQ.inquiry.getCurrentInquiry().getTitle()); Bundle extras = getIntent().getExtras(); if (extras != null) { mViewPager.setCurrentItem(extras.getInt(PHASE)); } } }
From source file:net.wespot.pim.compat.controller.InquiryActivityBack.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Avoiding NULL exceptions when resuming the PIM // if (INQ.inquiry == null ){ //// Intent intent = new Intent(getApplicationContext(), MainActivity.class); //// startActivity(intent); // INQ.init(this); // INQ.accounts.syncMyAccountDetails(); // INQ.inquiry.syncInquiries(); // Log.e(TAG, "recover INQ.inquiry is needed in InquiryActivity."); // }//from w w w .j a va2 s .c o m if (savedInstanceState != null) { INQ.init(this); INQ.accounts.syncMyAccountDetails(); // INQ.inquiry.syncInquiries(); INQ.inquiry.setCurrentInquiry(DaoConfiguration.getInstance().getInquiryLocalObjectDao() .load(savedInstanceState.getLong("currentInquiry"))); Log.e(TAG, "recover INQ.inquiry is needed in InquiryActivity."); } if (INQ.inquiry.getCurrentInquiry() == null) { Log.e(TAG, "New inquiry"); setContentView(R.layout.wrapper); FragmentManager fragmentManager = getSupportFragmentManager(); android.support.v4.app.FragmentTransaction fragmentTransaction; fragmentTransaction = fragmentManager.beginTransaction(); InqCreateInquiryFragment fragment = new InqCreateInquiryFragment(); fragmentTransaction.add(R.id.content, fragment); fragmentTransaction.commit(); getSupportActionBar().setTitle(R.string.actionbar_inquiry_list); } else { setContentView(R.layout.activity_inquiry); Log.e(TAG, "Show inquiry"); // Create an adapter that when requested, will return a fragment representing an object in // the collection. // ViewPager and its adapters use support library fragments, so we must use // getSupportFragmentManager. /* The {@link android.support.v4.view.PagerAdapter} that will provide fragments representing each object in a collection. We use a {@link android.support.v4.app.FragmentStatePagerAdapter} derivative, which will destroy and re-create fragments as needed, saving and restoring their state in the process. This is important to conserve memory and is a best practice when allowing navigation between objects in a potentially large collection. */ // Set up the ViewPager, attaching the adapter. /* The {@link android.support.v4.view.ViewPager} that will display the object collection. */ ViewPager mViewPager = (ViewPager) findViewById(R.id.pager); InquiryPagerAdapter mInquiryPagerAdapter = new InquiryPagerAdapter(getSupportFragmentManager(), mViewPager); getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); mViewPager.setAdapter(mInquiryPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // When swiping between different app sections, select the corresponding tab. // We can also use ActionBar.Tab#select() to do this if we have a reference to the // Tab. // getmActionBarHelper().setSelectedNavigationItem(position); } }); getSupportActionBar().setTitle(getResources().getString(R.string.actionbar_inquiry) + " - " + INQ.inquiry.getCurrentInquiry().getTitle()); Bundle extras = getIntent().getExtras(); if (extras != null) { mViewPager.setCurrentItem(extras.getInt(PHASE)); } } }
From source file:org.jorge.lolin1.ui.frags.NavigationDrawerFragment.java
private void restoreActionBar() { ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(Boolean.TRUE); actionBar.setTitle(LoLin1Utils.getString(getActivity(), "title_section" + (DrawerLayoutFragmentActivity.getLastSelectedNavDrawerIndex() + 1), "Home")); }
From source file:com.medisa.myspacecal.Range.java
@SuppressLint("NewApi") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_range); sideNavigationView = (SideNavigationView) findViewById(R.id.side_navigation_view); sideNavigationView.setMenuItems(R.menu.side_navigation_menu); sideNavigationView.setMenuClickCallback(this); PagerAdapter adapter = new FragmentStatePagerAdapter(getSupportFragmentManager()) { @Override/*from www.jav a 2 s.c o m*/ public Fragment getItem(int position) { switch (position) { case 0: return new StickyFragment(); } return null; } @Override public int getCount() { return 1; } @Override public CharSequence getPageTitle(int position) { switch (position) { case 0: return getString(R.string.sticky_item); } return null; } }; mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(adapter); mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @SuppressLint("NewApi") @Override public void onPageSelected(int position) { getActionBar().setHomeButtonEnabled(true); } }); mPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.page_margin)); getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); for (int position = 0; position < adapter.getCount(); position++) { getActionBar() .addTab(getActionBar().newTab().setText(adapter.getPageTitle(position)).setTabListener(this)); } getActionBar().setDisplayShowHomeEnabled(true); getActionBar().setDisplayShowTitleEnabled(true); getActionBar().setHomeButtonEnabled(true); }
From source file:org.mars3142.android.toaster.activity.MainActivity.java
private 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 2s .c o m*/ } }
From source file:ca.ualberta.cmput301w14t08.geochan.fragments.FavouritesFragment.java
/** * Disable the spinner. */ private void disableSpinner() { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); }
From source file:com.meetingninja.csse.tasks.TasksFragment.java
@Override public void onPause() { prevSelectedType = getActivity().getActionBar().getSelectedNavigationIndex(); getActivity().getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); super.onPause(); }
From source file:com.rastating.droidbeard.MainActivity.java
public void restoreActionBar() { ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); if (mTitle != null) { actionBar.setTitle(mTitle);//from ww w . j av a 2 s . c om } }