List of usage examples for android.app ActionBar setNavigationMode
@Deprecated public abstract void setNavigationMode(@NavigationMode int mode);
From source file:fr.cph.chicago.activity.BusActivity.java
@Override public final boolean onCreateOptionsMenu(final Menu menu) { super.onCreateOptionsMenu(menu); this.mMenu = menu; // Inflate menu with no search MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_no_search, menu); // Modify action bar title ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle("Bus"); // Load top bar animation MenuItem refreshMenuItem = menu.findItem(R.id.action_refresh); refreshMenuItem.setActionView(R.layout.progressbar); refreshMenuItem.expandActionView();/*from www . ja v a 2 s. co m*/ return true; }
From source file:com.emman.tame.MainActivity.java
public void restoreActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(R.layout.action_bar); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle);//from w ww .j a v a2 s. c o m }
From source file:com.hmdone.serialbluetooth.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(); 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 ww . ja v a2 s. 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: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 . ja v a 2 s. co m 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:gis.iwacu_new.rit.edu.main.swipetabs.SwipeTabsMainActivity.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(); // Specify that the Home/Up button should be enabled, since there is a hierarchical // parent./*from w ww . j a v a2s. c om*/ actionBar.setHomeButtonEnabled(true); // Specify that we will be displaying tabs in the action bar. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // 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); } }); /* not needed? // For each of the sections in the app, add a tab to the action bar. //will we want to keep this? 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)); } */ }
From source file:com.example.swipedemo.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(); // Specify that the Home/Up button should not be enabled, since there is // no hierarchical // parent./* w w 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); // 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)); } }
From source file:com.xortech.sender.SenderMain.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sender_main); // REMOVE THE TITLE FROM THE ACTIONBAR getActionBar().setDisplayShowTitleEnabled(false); preferences = PreferenceManager.getDefaultSharedPreferences(this); mapType = preferences.getString("mapType", GMAPS); // CHECK FOR "DON'T KEEP ACTIVITIES" IN DEVELOPER OPTIONS boolean checkDeveloper = isAlwaysFinishActivitiesOptionEnabled(); if (checkDeveloper) { showDeveloperOptionsScreen();/*from ww w . j ava2 s . c o m*/ } /* * IF GOOGLE MAPS IS SELECTED AS THE DEFAULT, THEN CHECK TO * SEE IF THE USER HAS THE CORRECT VERSION OF GOOGLE PLAY SERVICES */ if (mapType.equals(GMAPS)) { // GET GOOGLE PLAY STATUS int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); // CHECK IF GOOGLE PLAY SERVICE IS AVAILABLE try { if (status != ConnectionResult.SUCCESS) { GooglePlayServicesUtil.getErrorDialog(status, this, RQS_GooglePlayServices).show(); } } catch (Exception e) { Log.e("Error: GooglePlayServiceUtil: ", "" + e); } } // REGISTER A BROADCAST RECEIVER IntentFilter localIntentFilter = new IntentFilter("android.provider.Telephony.SMS_RECEIVED"); localIntentFilter.setPriority(2147483646); mReceiver = new SmsReceiver(); registerReceiver(mReceiver, localIntentFilter); try { // TRY TO LAUNCH APP RATER AppRater.app_launched(this); } catch (Exception e) { Log.e("Error AppRater: ", "" + e); } // 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); 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++) { actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:com.google.adsensequickstart.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_main); apiController = ApiController.getApiController(this); // Set up the action bar to show a dropdown list. final ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); // Set up the dropdown list navigation in the action bar. actionBar.setListNavigationCallbacks( // Specify a SpinnerAdapter to populate the dropdown list. new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, new String[] { getString(R.string.title_section1), getString(R.string.title_section2), getString(R.string.title_section3) }), this); }
From source file:com.paranoid.lukemovement.halolauncher.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try {//from w w w . ja va 2 s . c o m } catch (Exception e) { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Error"); alertDialog.setMessage( "This app will not work on your device because your rom does not support HALO\n\nPlease install a rom that does support this feature(e.g. 'Paranoid Android')"); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); } }); } SP = getSharedPreferences(getPackageName() + "_preferences", Context.MODE_PRIVATE); // 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(); // Specify that the Home/Up button should not be enabled, since there is no hierarchical // parent. actionBar.setHomeButtonEnabled(false); // Specify that we will be displaying tabs in the action bar. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // 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)); } }
From source file:com.hardcopy.blechat.MainActivity.java
/***************************************************** * Overrided methods//from w w w . j av a 2s. c om ******************************************************/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //----- System, Context mContext = this; //.getApplicationContext(); mActivityHandler = new ActivityHandler(); AppSettings.initializeAppSettings(mContext); setContentView(R.layout.activity_main); // 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 primary sections of the app. mFragmentManager = getSupportFragmentManager(); mSectionsPagerAdapter = new FragmentAdapter(mFragmentManager, mContext, this, mActivityHandler); // 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. 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. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } // Setup views mImageBT = (ImageView) findViewById(R.id.status_title); mImageBT.setImageDrawable(getResources().getDrawable(android.R.drawable.presence_invisible)); mTextStatus = (TextView) findViewById(R.id.status_text); mTextStatus.setText(getResources().getString(R.string.bt_state_init)); // Do data initialization after service started and binded doStartService(); }