List of usage examples for android.app ActionBar newTab
@Deprecated public abstract Tab newTab();
From source file:com.otaupdater.TabDisplay.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Context context = getApplicationContext(); cfg = Config.getInstance(context);//from ww w .j av a 2 s . c o m if (!Utils.haveProKey(context)) { cfg.setKeyExpiry(0); } else if (!cfg.hasValidProKey()) { if (cfg.isProKeyTemporary()) { if (cfg.getKeyExpires() < System.currentTimeMillis()) { Utils.verifyProKey(context); } } else { Utils.verifyProKey(context); } } if (!Utils.isRomOtaEnabled() && !Utils.isKernelOtaEnabled()) { if (!cfg.getIgnoredUnsupportedWarn()) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.alert_unsupported_title); alert.setMessage(R.string.alert_unsupported_message); alert.setCancelable(false); alert.setNegativeButton(R.string.alert_exit, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); finish(); } }); alert.setPositiveButton(R.string.alert_ignore, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { cfg.setIgnoredUnsupportedWarn(true); dialog.dismiss(); } }); alert.create().show(); } if (Utils.marketAvailable(this)) { GCMRegistrar.checkDevice(context); GCMRegistrar.checkManifest(context); final String regId = GCMRegistrar.getRegistrationId(context); if (regId.length() != 0) { GCMRegistrar.unregister(context); } } } else { if (Utils.marketAvailable(this)) { GCMRegistrar.checkDevice(context); GCMRegistrar.checkManifest(context); final String regId = GCMRegistrar.getRegistrationId(context); if (regId.length() != 0) { if (cfg.upToDate()) { Log.v(Config.LOG_TAG + "GCMRegister", "Already registered"); } else { Log.v(Config.LOG_TAG + "GCMRegister", "Already registered, out-of-date"); cfg.setValuesToCurrent(); new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { Utils.updateGCMRegistration(context, regId); return null; } }.execute(); } } else { GCMRegistrar.register(context, Config.GCM_SENDER_ID); Log.v(Config.LOG_TAG + "GCMRegister", "GCM registered"); } } else { UpdateCheckReceiver.setAlarm(context); } } mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager); setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); bar.setTitle(R.string.app_name); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.main_about), AboutTab.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.main_rom), ROMTab.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.main_kernel), KernelTab.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.main_walls), WallsTab.class, null); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
From source file:org.monospace.smsfilter.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTabs = new TabSet(NUM_TABS); mTabs.add(TAB_SMS, R.string.tab_sms_list, SMSListFragment.class); mTabs.add(TAB_FILTER, R.string.tab_filter_list, FilterListFragment.class); ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowTitleEnabled(false); ViewPager pager = new ViewPager(this); pager.setId(R.id.main_pager);//ww w. java 2s . c o m TabHelper helper = new TabHelper(this, pager); pager.setAdapter(helper); pager.setOnPageChangeListener(helper); for (TabSet.Tab t : mTabs) { Tab tab = actionBar.newTab().setText(t.textId).setTabListener(helper); actionBar.addTab(tab); } setContentView(pager); mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { SMSListFragment fragment = (SMSListFragment) mTabs.getItem(TAB_SMS); fragment.refresh(); } }; registerReceiver(mReceiver, new IntentFilter("org.monospace.smsfilter.NEW_BLOCKED_SMS")); }
From source file:org.tunesremote.LibraryBrowseActivity.java
@SuppressLint("NewApi") @Override//from w ww. ja v a 2 s . co m public void onCreate(Bundle saved) { super.onCreate(saved); this.prefs = PreferenceManager.getDefaultSharedPreferences(this); if (this.prefs.getBoolean(this.getString(R.string.pref_fullscreen), true) && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); } setContentView(R.layout.act_browse_library); artists = new ArtistsListFragment(); albums = new AllAlbumsListFragment(); playlists = new PlaylistsFragment(); isTablet = findViewById(R.id.frame_artists) != null; if (!isTablet) { (pager = (ViewPager) findViewById(R.id.view_pager)) .setAdapter(new LibraryPagerAdapter(getSupportFragmentManager())); pager.setOnPageChangeListener(this); pager.setOffscreenPageLimit(2); findViewById(R.id.tab_artists).setSelected(true); } else { getSupportFragmentManager().beginTransaction().add(R.id.frame_artists, artists) .add(R.id.frame_albums, albums).add(R.id.frame_playlists, playlists).commit(); registerListener(artists, albums, playlists); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { handler = new TabHandler(); ActionBar ab = getActionBar(); ab.setTitle(R.string.control_menu_library); if (!isTablet) { findViewById(R.id.legacy_tabs).setVisibility(View.GONE); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); Tab artTab = ab.newTab().setText(R.string.control_menu_artists).setTabListener(handler); Tab albTab = ab.newTab().setText(R.string.control_menu_albums).setTabListener(handler); Tab plyTab = ab.newTab().setText(R.string.control_menu_playlists).setTabListener(handler); ab.addTab(artTab); ab.addTab(albTab); ab.addTab(plyTab); } } }
From source file:net.seedboxer.seedroid.activities.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.main_activity_view); // Set up the action bar. final ActionBar actionBar = getActionBar(); // Specify that the Home/Up button should not be enabled, since there is no hierarchical // parent./*from ww w. j ava 2 s .c o m*/ actionBar.setHomeButtonEnabled(false); // Specify that we will be displaying tabs in the action bar. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mViewPager = (ViewPager) findViewById(R.id.pager); mAppSectionsPagerAdapter = new TabsAdapter(this, getSupportFragmentManager(), mViewPager); mAppSectionsPagerAdapter.addTab(actionBar.newTab().setText(R.string.tab_title_inprogres), StatusFragment.class, null); mAppSectionsPagerAdapter.addTab(actionBar.newTab().setText(R.string.tab_title_queue), InQueueFragment.class, null); mAppSectionsPagerAdapter.addTab(actionBar.newTab().setText(R.string.tab_title_downloads), DownloadsFragment.class, null); if (savedInstanceState != null) { actionBar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } GCMRegistrar.checkManifest(this); GCMRegistrar.checkDevice(this); }
From source file:com.stockbrowser.ComboViewActivity.java
@TargetApi(14) @Override//from ww w . j av a 2 s. c o m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setResult(RESULT_CANCELED); Bundle extras = getIntent().getExtras(); Bundle args = extras.getBundle(EXTRA_COMBO_ARGS); // // String svStr = extras.getString(EXTRA_INITIAL_VIEW, null); String svStr = extras.getString(EXTRA_INITIAL_VIEW); UI.ComboViews startingView = svStr != null ? UI.ComboViews.valueOf(svStr) : UI.ComboViews.Bookmarks; mViewPager = new ViewPager(this); mViewPager.setId(R.id.tab_view); setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); if (BrowserActivity.isTablet(this)) { bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO); bar.setHomeButtonEnabled(true); } else { bar.setDisplayOptions(0); } mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_bookmarks), BrowserBookmarksPage.class, args); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_TAB, 0)); } else { switch (startingView) { case Bookmarks: mViewPager.setCurrentItem(0); break; case History: mViewPager.setCurrentItem(1); break; case Snapshots: mViewPager.setCurrentItem(2); break; } } }
From source file:com.android.browser.ComboViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setResult(RESULT_CANCELED);//from www . j a va2 s . com Bundle extras = getIntent().getExtras(); Bundle args = extras.getBundle(EXTRA_COMBO_ARGS); String svStr = extras.getString(EXTRA_INITIAL_VIEW, null); ComboViews startingView = svStr != null ? ComboViews.valueOf(svStr) : ComboViews.Bookmarks; mViewPager = new ViewPager(this); mViewPager.setId(R.id.tab_view); setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); if (BrowserActivity.isTablet(this)) { bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO); bar.setHomeButtonEnabled(true); } else { bar.setDisplayOptions(0); } mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_bookmarks), BrowserBookmarksPage.class, args); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_history), BrowserHistoryPage.class, args); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_TAB, 0)); } else { switch (startingView) { case Bookmarks: mViewPager.setCurrentItem(0); break; case History: mViewPager.setCurrentItem(1); break; case Snapshots: mViewPager.setCurrentItem(2); break; } } }
From source file:com.baohume.browser.ComboViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setResult(RESULT_CANCELED);// w ww . j a v a 2s . co m Bundle extras = getIntent().getExtras(); Bundle args = extras.getBundle(EXTRA_COMBO_ARGS); String svStr = extras.getString(EXTRA_INITIAL_VIEW, null); UI.ComboViews startingView = svStr != null ? UI.ComboViews.valueOf(svStr) : UI.ComboViews.Bookmarks; mViewPager = new ViewPager(this); mViewPager.setId(R.id.tab_view); setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); if (BrowserActivity.isTablet(this)) { bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO); bar.setHomeButtonEnabled(true); } else { bar.setDisplayOptions(0); } mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_bookmarks), BrowserBookmarksPage.class, args); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_history), BrowserHistoryPage.class, args); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_snapshots), BrowserSnapshotPage.class, args); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_TAB, 0)); } else { switch (startingView) { case Bookmarks: mViewPager.setCurrentItem(0); break; case History: mViewPager.setCurrentItem(1); break; case Snapshots: mViewPager.setCurrentItem(2); break; } } }
From source file:com.android.stockbrowser.ComboViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setResult(RESULT_CANCELED);//from ww w .j a v a 2s . com Bundle extras = getIntent().getExtras(); Bundle args = extras.getBundle(EXTRA_COMBO_ARGS); String svStr = extras.getString(EXTRA_INITIAL_VIEW, null); ComboViews startingView = svStr != null ? ComboViews.valueOf(svStr) : ComboViews.Bookmarks; mViewPager = new ViewPager(this); mViewPager.setId(R.id.tab_view); setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); if (BrowserActivity.isTablet(this)) { bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO); bar.setHomeButtonEnabled(true); } else { bar.setDisplayOptions(0); } mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_bookmarks), BrowserBookmarksPage.class, args); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_history), BrowserHistoryPage.class, args); mTabsAdapter.addTab(bar.newTab().setText(R.string.tab_snapshots), BrowserSnapshotPage.class, args); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_TAB, 0)); } else { switch (startingView) { case Bookmarks: mViewPager.setCurrentItem(0); break; case History: mViewPager.setCurrentItem(1); break; case Snapshots: mViewPager.setCurrentItem(2); break; } } }
From source file:fr.leicht.androideip.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mContext = this; // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // For each of the sections in the app, add a tab to the action bar. actionBar.addTab(actionBar.newTab().setText(R.string.title_section1).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.title_section2).setTabListener(this)); actionBar.addTab(actionBar.newTab().setText(R.string.title_section3).setTabListener(this)); Thread threadInit = new Thread(new Runnable() { public void run() { Message msg = null;/*from w w w . j a v a2 s .c om*/ try { comm = new SimpleLogixCommunicator("192.168.1.18", 0xAF12); //Declaration des Tag myTags.add(EJP = new Tag(comm, "EJP", 30000)); myTags.add(Temp_Ext = new Tag(comm, "Temp_Ext", 60000)); myTags.add(Temp_Confort_Quentin = new Tag(comm, "Temp_Confort_Quentin", 10000)); myTags.add(Temp_Confort_Salle = new Tag(comm, "Temp_Confort_Salle", 10000)); myTags.add(Temp_Confort_Tim = new Tag(comm, "Temp_Confort_Tim", 10000)); myTags.add(Temp_Tim = new Tag(comm, "Temp_Tim", 60000)); myTags.add(Temp_Salle = new Tag(comm, "Temp_Salle", 60000)); myTags.add(Temp_Quentin = new Tag(comm, "Temp_Quentin", 60000)); myTags.add(Autorisation_IHM_Plancher = new Tag(comm, "Autorisation_IHM_Plancher", 5000)); myTags.add(BP_IHM_Chauffage_Quentin = new Tag(comm, "BP_IHM_Chauffage_Quentin", 5000)); myTags.add(BP_IHM_Chauffage_Salle = new Tag(comm, "BP_IHM_Chauffage_Salle", 5000)); myTags.add(BP_IHM_Chauffage_Tim = new Tag(comm, "BP_IHM_Chauffage_Tim_Enabled", 5000)); myTags.add(intensite_A = new Tag(comm, "intensite_A", 1000)); myTags.add(Temp_Veranda = new Tag(comm, "Temp_Veranda", 60000)); myTags.add(BP_IHM_Light_SS_Milieu = new Tag(comm, "BP_IHM_Light_SS_Milieu", 60000)); myTags.add(Light_SS_Milieu = new Tag(comm, "Light_SS_Milieu", 500)); myTags.add(BP_IHM_Light_SS_Chenil = new Tag(comm, "BP_IHM_Light_SS_Chenil", 60000)); myTags.add(Light_SS_Chenil = new Tag(comm, "Light_SS_Chenil", 500)); myTags.add(BP_IHM_Light_SS_Garage = new Tag(comm, "BP_IHM_Light_SS_Garage", 60000)); myTags.add(Light_SS_Garage = new Tag(comm, "Light_SS_Garage", 500)); myTags.add(Time_Reste_Light_Devant = new Tag(comm, "Time_Reste_Light_Devant", 500)); myTags.add(BP_IHM_Light_Devant = new Tag(comm, "BP_IHM_Light_Devant", 50000)); myTags.add(BP_IHM_Off_Light_Devant = new Tag(comm, "BP_IHM_Off_Light_Devant", 50000)); myTags.add(Light_Devant = new Tag(comm, "Light_Devant", 5000)); Hora = new Tags(comm, "Hora", 7); enExecution = true; Integer i = 0; while (enExecution) { try { i++; for (Tag tag : myTags) { tag.updateTag(); } /*Hora.updateTag(); for (int k=0;k<7;k++) { Log.d("[EIP]","Hora :"+Hora.getStringValue(k)+"/"+k); }*/ //Log.d("[AndroidEIP]Main","WRITE Cycle :"+i); UpdateIHM("Cycle :" + i); Thread.sleep(100); } catch (InterruptedException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (PathSegmentException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (ItemNotFoundException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (ProcessingAttributesException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (InsufficientCommandException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (InsufficientNrOfAttributesException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (OtherWithExtendedCodeException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (ResponseBufferOverflowException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (InvalidTypeException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } catch (EmbeddedServiceException e) { Log.d("[AndroidEIP]Main", e.getMessage()); } } } catch (IOException e) { msg = mHandler.obtainMessage(MSG_ERR, (Object) e.getMessage()); mHandler.sendMessage(msg); Log.d("[AndroidEIP]Main", e.getMessage()); } catch (NotImplementedException e) { msg = mHandler.obtainMessage(MSG_ERR, (Object) e.getMessage()); mHandler.sendMessage(msg); Log.d("[AndroidEIP]Main", e.getMessage()); } } }); threadInit.start(); }
From source file:ca.mymenuapp.ui.activities.MainActivity.java
/** Setup the tabs to display our fragments. */ private void setupTabs(int tab) { DelegateOnPageChangeListener delegateOnPageChangeListener = new DelegateOnPageChangeListener(); viewPager.setOnPageChangeListener(delegateOnPageChangeListener); final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); SwipeableActionBarTabsAdapter tabsAdapter = new SwipeableActionBarTabsAdapter(this, viewPager, delegateOnPageChangeListener); tabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.map)), RestaurantsMapFragment.class, null); tabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.specials)), SpecialsGridFragment.class, null);/*from w w w . jav a2s . c om*/ if (!userPreference.get().isGuest()) { tabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.dietary_preferences)), DietaryPreferencesFragment.class, null); tabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.settings)), SettingsFragment.class, null); } actionBar.setSelectedNavigationItem(tab); delegateOnPageChangeListener.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position == 0) { // Enable user to slide the drawer layout drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); drawerToggle.setDrawerIndicatorEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); } else { // Disable user from sliding the drawer layout drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); drawerToggle.setDrawerIndicatorEnabled(false); getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setHomeButtonEnabled(false); } } @Override public void onPageSelected(int position) { // ignore } @Override public void onPageScrollStateChanged(int state) { // ignore } }); }