List of usage examples for android.app ActionBar setDisplayShowHomeEnabled
public abstract void setDisplayShowHomeEnabled(boolean showHome);
From source file:com.art2cat.dev.moonlightnote.controller.settings.SettingsSecondActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_security_second); android.app.ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowHomeEnabled(true); }/*from ww w . j a v a 2 s. c o m*/ int type = getIntent().getIntExtra(Constants.EXTRA_TYPE_FRAGMENT, 0); FragmentManager fragmentManager = getSupportFragmentManager(); int id = R.id.activity_security; switch (type) { case Constants.FRAGMENT_POLICY: FragmentUtils.addFragment(fragmentManager, id, new PrivacyPolicyFragment().newInstance()); break; case Constants.FRAGMENT_LICENSE: FragmentUtils.addFragment(fragmentManager, id, new LicenseFragment().newInstance()); break; case Constants.FRAGMENT_ABOUT: FragmentUtils.addFragment(fragmentManager, id, new AboutAppFragment().newInstance()); break; } }
From source file:com.norman0406.slimgress.ActivityOps.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ops); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowTitleEnabled(false); 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. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override/*from w w w. j ava 2s . c o m*/ 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.witmob.nocollapsetabs.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create the adapter that will return a fragment for each of the three primary sections // of the app. mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowTitleEnabled(false); // Specify that the Home/Up button should not be enabled, since there is no hierarchical // parent.//from w w w .jav a 2 s. c o m actionBar.setHomeButtonEnabled(false); // Specify that we will be displaying tabs in the action bar. // Set up the ViewPager, attaching the adapter and setting up a listener for when the // user swipes between sections. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAppSectionsPagerAdapter); 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. actionBar.setSelectedNavigationItem(position); } }); // 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)); } actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); }
From source file:com.klinker.android.twitter.settings.SettingsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.slide_in_left, R.anim.activity_zoom_exit); AppSettings.invalidate();//from w w w. jav a 2 s . co m Utils.setUpTheme(this, AppSettings.getInstance(this)); ActionBar ab = getActionBar(); ab.setDisplayHomeAsUpEnabled(true); ab.setDisplayShowHomeEnabled(true); getFragmentManager().beginTransaction().replace(android.R.id.content, new MainPrefFrag()).commit(); }
From source file:com.dirtyunicorns.hfm.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set up the ViewPager with the sections adapter. mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager);/*from w ww .j ava2s . c o m*/ setContentView(mViewPager); ActionBar actionbar = getActionBar(); actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionbar.setDisplayShowHomeEnabled(false); actionbar.setDisplayShowTitleEnabled(false); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.title_section1), mainFragment.class, null); //mTabsAdapter.addTab(actionbar.newTab().setText(R.string.title_section2),customFragment.class, null); }
From source file:nz.ac.otago.psyanlab.common.designer.assets.ImportAssetActivity.java
@SuppressLint("NewApi") @Override//from www . j av a 2 s . co m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_import); Resources resources = getResources(); mFilePickerFragment = (FilePickerFragment) getSupportFragmentManager().findFragmentById(R.id.file_picker); if (savedInstanceState == null) { mFilePickerFragment.setRootDir(Environment.getExternalStorageDirectory()); mFilePickerFragment.setColumnWidth(resources.getDimensionPixelSize(R.dimen.grid_column_width)); mFilePickerFragment.setNumColumns(StickyGridHeadersGridView.AUTO_FIT); mFilePickerFragment.setMultiSelectEnabled(true); } ActionBar abs = getActionBar(); abs.setDisplayUseLogoEnabled(false); abs.setDisplayShowHomeEnabled(false); abs.setTitle(R.string.title_import_asset); }
From source file:com.yohpapa.overlaymusicplayer.activity.MainActivity.java
private void setupActionBar() { ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayShowHomeEnabled(false); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); int lastPosition = PrefUtils.getInt(this, R.string.pref_last_tab_position, 0); for (int i = 0; i < fragmentNames.length; i++) { ActionBar.Tab tab = bar.newTab(); tab.setText(fragmentNames[i]);//from w w w . j a va 2s. c o m tab.setTabListener(new ActionBar.TabListener() { @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { Log.d(TAG, "onTabUnselected"); } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { ViewPager pager = (ViewPager) findViewById(R.id.fragment_pager); pager.setCurrentItem(tab.getPosition()); PrefUtils.setInt(MainActivity.this, R.string.pref_last_tab_position, tab.getPosition()); } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { Fragment fragment = fragments[tab.getPosition()]; if (fragment instanceof CommonListFragment) { ((CommonListFragment) fragment).onTapWhenSelected(); } } }); boolean isSelected = false; if (i == lastPosition) { isSelected = true; } bar.addTab(tab, isSelected); } }
From source file:com.android.photos.GalleryActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mMultiChoiceManager = new MultiChoiceManager(this); mViewPager = new ViewPager(this); mViewPager.setId(R.id.viewpager);//ww w . j a va 2s . c om setContentView(mViewPager); ActionBar ab = getActionBar(); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ab.setDisplayShowHomeEnabled(false); ab.setDisplayShowTitleEnabled(false); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(ab.newTab().setText(R.string.tab_photos), PhotoSetFragment.class, null); mTabsAdapter.addTab(ab.newTab().setText(R.string.tab_albums), AlbumSetFragment.class, null); if (savedInstanceState != null) { ab.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
From source file:nz.ac.otago.psyanlab.common.ImportPaleActivity.java
@SuppressLint("NewApi") @Override/*w w w .j a v a 2 s .c o m*/ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mUserDelegate = getIntent().getParcelableExtra(Args.USER_DELEGATE); mUserDelegate.init(this); setContentView(R.layout.activity_import); Resources resources = getResources(); mFilePickerFragment = (FilePickerFragment) getSupportFragmentManager().findFragmentById(R.id.file_picker); if (savedInstanceState == null) { mFilePickerFragment.setRootDir(Environment.getExternalStorageDirectory()); mFilePickerFragment.setColumnWidth(resources.getDimensionPixelSize(R.dimen.grid_column_width)); mFilePickerFragment.setNumColumns(StickyGridHeadersGridView.AUTO_FIT); mFilePickerFragment.setMultiSelectEnabled(true); } ActionBar abs = getActionBar(); abs.setDisplayUseLogoEnabled(false); abs.setDisplayShowHomeEnabled(false); abs.setTitle(R.string.title_import); // startActionMode(this); }
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 ww . ja va 2s . c o m 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); }