Java Code Examples for com.actionbarsherlock.app.ActionBar#setNavigationMode()
The following examples show how to use
com.actionbarsherlock.app.ActionBar#setNavigationMode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListStyleActivity.java From android-opensource-library-56 with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_style); ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1); for (int i = 0; i < 5; i++) { adapter.add("item" + i); } actionBar.setListNavigationCallbacks(adapter, new OnNavigationListener() { @Override public boolean onNavigationItemSelected(int itemPosition, long itemId) { Toast.makeText(This(), "pos" + itemPosition, Toast.LENGTH_SHORT).show(); return false; } }); }
Example 2
Source File: Codecs.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.codecs_pager); final ActionBar ab = getSupportActionBar(); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ab.setDisplayShowHomeEnabled(true); ab.setDisplayShowTitleEnabled(true); mViewPager = (ViewPager) findViewById(R.id.pager); TabsAdapter tabAdapter = new TabsAdapter(this, ab, mViewPager); useCodecsPerSpeed = SipConfigManager.getPreferenceBooleanValue(this, SipConfigManager.CODECS_PER_BANDWIDTH); showVideoCodecs = SipConfigManager.getPreferenceBooleanValue(this, SipConfigManager.USE_VIDEO); if(useCodecsPerSpeed) { Tab audioNb = ab.newTab().setText( R.string.slow ).setIcon(R.drawable.ic_prefs_media); Tab audioWb = ab.newTab().setText( R.string.fast ).setIcon(R.drawable.ic_prefs_media); tabAdapter.addTab(audioWb, CodecsFragment.class); tabAdapter.addTab(audioNb, CodecsFragment.class); if(showVideoCodecs) { Tab videoNb = ab.newTab().setText( R.string.slow ).setIcon(R.drawable.ic_prefs_media_video); Tab videoWb = ab.newTab().setText( R.string.fast ).setIcon(R.drawable.ic_prefs_media_video); tabAdapter.addTab(videoWb, CodecsFragment.class); tabAdapter.addTab(videoNb, CodecsFragment.class); } }else { Tab audioTab = ab.newTab().setIcon(R.drawable.ic_prefs_media); tabAdapter.addTab(audioTab, CodecsFragment.class); if(showVideoCodecs) { Tab videoTab = ab.newTab().setIcon(R.drawable.ic_prefs_media_video); tabAdapter.addTab(videoTab, CodecsFragment.class); } } }
Example 3
Source File: TabStyleActivity.java From android-opensource-library-56 with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tab_style); ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); for (int i = 0; i < 3; i++) { addTab(actionBar, i + 1); } }
Example 4
Source File: SipHome.java From CSipSimple with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { //prefWrapper = new PreferencesWrapper(this); prefProviderWrapper = new PreferencesProviderWrapper(this); super.onCreate(savedInstanceState); setContentView(R.layout.sip_home); final ActionBar ab = getSupportActionBar(); ab.setDisplayShowHomeEnabled(false); ab.setDisplayShowTitleEnabled(false); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); // showAbTitle = Compatibility.hasPermanentMenuKey Tab dialerTab = ab.newTab() .setContentDescription(R.string.dial_tab_name_text) .setIcon(R.drawable.ic_ab_dialer_holo_dark); Tab callLogTab = ab.newTab() .setContentDescription(R.string.calllog_tab_name_text) .setIcon(R.drawable.ic_ab_history_holo_dark); Tab favoritesTab = null; if(CustomDistribution.supportFavorites()) { favoritesTab = ab.newTab() .setContentDescription(R.string.favorites_tab_name_text) .setIcon(R.drawable.ic_ab_favourites_holo_dark); } Tab messagingTab = null; if (CustomDistribution.supportMessaging()) { messagingTab = ab.newTab() .setContentDescription(R.string.messages_tab_name_text) .setIcon(R.drawable.ic_ab_text_holo_dark); } warningTab = ab.newTab().setIcon(android.R.drawable.ic_dialog_alert); warningTabfadeAnim = ObjectAnimator.ofInt(warningTab.getIcon(), "alpha", 255, 100); warningTabfadeAnim.setDuration(1500); warningTabfadeAnim.setRepeatCount(ValueAnimator.INFINITE); warningTabfadeAnim.setRepeatMode(ValueAnimator.REVERSE); mDualPane = getResources().getBoolean(R.bool.use_dual_panes); mViewPager = (ViewPager) findViewById(R.id.pager); mTabsAdapter = new TabsAdapter(this, getSupportActionBar(), mViewPager); mTabsAdapter.addTab(dialerTab, DialerFragment.class, TAB_ID_DIALER); mTabsAdapter.addTab(callLogTab, CallLogListFragment.class, TAB_ID_CALL_LOG); if(favoritesTab != null) { mTabsAdapter.addTab(favoritesTab, FavListFragment.class, TAB_ID_FAVORITES); } if (messagingTab != null) { mTabsAdapter.addTab(messagingTab, ConversationsListFragment.class, TAB_ID_MESSAGES); } hasTriedOnceActivateAcc = false; if (!prefProviderWrapper.getPreferenceBooleanValue(SipConfigManager.PREVENT_SCREEN_ROTATION)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); } selectTabWithAction(getIntent()); Log.setLogLevel(prefProviderWrapper.getLogLevel()); // Async check asyncSanityChecker = new Thread() { public void run() { asyncSanityCheck(); }; }; asyncSanityChecker.start(); }