List of usage examples for android.app ActionBar NAVIGATION_MODE_LIST
int NAVIGATION_MODE_LIST
To view the source code for android.app ActionBar NAVIGATION_MODE_LIST.
Click Source Link
From source file:com.ToxicBakery.viewpager.transforms.example.MainActivity.java
@SuppressWarnings("deprecation") @Override//from w ww .ja v a 2s . co m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int selectedPage = 0; if (savedInstanceState != null) { mSelectedItem = savedInstanceState.getInt(KEY_SELECTED_CLASS); selectedPage = savedInstanceState.getInt(KEY_SELECTED_PAGE); } final ArrayAdapter<TransformerItem> actionBarAdapter = new ArrayAdapter<TransformerItem>( getApplicationContext(), android.R.layout.simple_list_item_1, android.R.id.text1, TRANSFORM_CLASSES); setContentView(R.layout.activity_main); mAdapter = new PageAdapter(getFragmentManager()); mPager = (ViewPager) findViewById(R.id.container); mPager.setAdapter(mAdapter); mPager.setCurrentItem(selectedPage); final ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setListNavigationCallbacks(actionBarAdapter, this); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); //noinspection ResourceType actionBar.setDisplayOptions(actionBar.getDisplayOptions() ^ ActionBar.DISPLAY_SHOW_TITLE); actionBar.setSelectedNavigationItem(mSelectedItem); } }
From source file:edu.cmu.sv.trailscribe.view.MapsActivity.java
@Override protected void setActionBar(String color) { super.setActionBar(color); mActionBar.setIcon(R.drawable.button_settings); mDrawerLayout = (DrawerLayout) findViewById(R.id.maps_layout); // Define the listen of the navigation drawer mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.icon_trailscribe, R.string.map_display_tools, R.string.map_hide_tools) { public void onDrawerClosed(View view) { mActionBar.setIcon(R.drawable.button_settings); super.onDrawerClosed(view); }/* w ww .j a v a 2s . co m*/ public void onDrawerOpened(View drawerView) { mActionBar.setIcon(R.drawable.button_settings_toggle); super.onDrawerOpened(drawerView); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); // Create spinner in action bar mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); mActionBar.setDisplayHomeAsUpEnabled(true); mActionBar.setHomeButtonEnabled(true); setSpinner(); }
From source file:com.tweetlanes.android.view.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { //StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().penaltyDialog().build()); //StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build()); //StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build()); super.onCreate(savedInstanceState); AccountDescriptor account = getApp().getCurrentAccount(); // Attempt at fixing a crash found in HomeActivity if (account == null) { Toast.makeText(getApplicationContext(), "No cached account found, restarting", Constant.DEFAULT_TOAST_DISPLAY_TIME).show(); restartApp();/*from w ww .j ava 2 s. c o m*/ return; } ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setTitle(null); actionBar.setDisplayShowTitleEnabled(false); ArrayList<String> adapterList = new ArrayList<String>(); ArrayList<AccountDescriptor> accounts = getApp().getAccounts(); for (int i = 0; i < accounts.size(); i++) { AccountDescriptor acc = accounts.get(i); adapterList.add("@" + acc.getScreenName()); } adapterList.add(getString(R.string.add_account)); mAdapterStrings = adapterList.toArray(new String[adapterList.size()]); mSpinnerAdapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_spinner_dropdown_item, mAdapterStrings); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener); actionBar.setSelectedNavigationItem(0); onCreateNavigationListener(); configureListNavigation(); mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher); updateViewVisibility(); onCreateHandleIntents(); account.setDisplayedLaneDefinitionsDirty(false); configureNotificationService(); }
From source file:com.shafiq.mytwittle.view.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // StrictMode.setThreadPolicy(new // StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().penaltyDialog().build()); // StrictMode.setThreadPolicy(new // StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build()); // StrictMode.setVmPolicy(new // StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build()); super.onCreate(savedInstanceState); AccountDescriptor account = getApp().getCurrentAccount(); // Attempt at fixing a crash found in HomeActivity if (account == null) { Toast.makeText(getApplicationContext(), "No cached account found, restarting", Constant.DEFAULT_TOAST_DISPLAY_TIME).show(); restartApp();//from w ww. j a va 2s. c o m return; } ActionBar actionBar = getActionBar(); actionBar.setDisplayUseLogoEnabled(true); actionBar.setTitle(null); actionBar.setDisplayShowTitleEnabled(false); ArrayList<String> adapterList = new ArrayList<String>(); ArrayList<AccountDescriptor> accounts = getApp().getAccounts(); for (int i = 0; i < accounts.size(); i++) { AccountDescriptor acc = accounts.get(i); adapterList.add("@" + acc.getScreenName() + (acc.getSocialNetType() == SocialNetConstant.Type.Appdotnet ? " (App.net)" : " (Twitter)")); } adapterList.add(getString(R.string.add_account)); mAdapterStrings = adapterList.toArray(new String[adapterList.size()]); mSpinnerAdapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_spinner_dropdown_item, mAdapterStrings); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener); actionBar.setSelectedNavigationItem(0); onCreateNavigationListener(); configureListNavigation(); mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher); updateViewVisibility(); onCreateHandleIntents(); account.setDisplayedLaneDefinitionsDirty(false); configureNotificationService(); }
From source file:nrec.basil.wimuconsole.SensorSettingsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sensor_settings); // Set up the action bar to show a dropdown list which will // contain the various sensors that can be configured. Some // sensors are local (camera) some are remote bluetooth devices // (IMU, Barometer etc.) 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, getResources().getStringArray(R.array.sensors_list)), this); // Specify a SpinnerAdapter to populate the wIMU list ArrayAdapter<CharSequence> imuAdapter = ArrayAdapter.createFromResource(this, R.array.wimu_list, android.R.layout.simple_spinner_item); imuAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); imuSpinner = (Spinner) findViewById(R.id.wimulist); imuSpinner.setAdapter(imuAdapter);//from w ww . j a v a2s . co m // Load the BASIL start/stop/reset commands InputStream input = getResources().openRawResource(R.raw.basilstart); try { input.read(basilStart, 0, 26); } catch (IOException e) { Log.e(TAG, "Could not read BASIL start command", e); } input = getResources().openRawResource(R.raw.basilstop); try { input.read(basilStop, 0, 26); } catch (IOException e) { Log.e(TAG, "Could not read BASIL stop command", e); } input = getResources().openRawResource(R.raw.basilreset); try { input.read(basilReset, 0, 26); } catch (IOException e) { Log.e(TAG, "Could not read BASIL reset command", e); } // Get the default filename for logging EditText logfilename = (EditText) findViewById(R.id.logfilename); mLogFileName = logfilename.toString(); // Get local Bluetooth adapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); // If the adapter is null, then Bluetooth is not supported if (mBluetoothAdapter == null) { Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show(); finish(); return; } }
From source file:com.pac.performance.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (mWidth == 1 || mHeight == 1) { Display display = getWindowManager().getDefaultDisplay(); mWidth = display.getWidth();//from w ww. j a v a 2 s .c o m mHeight = display.getHeight(); } setContentView(R.layout.activity_main); CPUChange = BatteryChange = AudioChange = VoltageChange = IOChange = MinFreeChange = VMChange = false; mFragments.clear(); mFragmentNames.clear(); // add CPU Fragment mFragments.add(new CPUFragment()); mFragmentNames.add(getString(R.string.cpu)); // add Battery Fragment if (Utils.exist(FAST_CHARGE) || Utils.exist(BLX)) { mFragments.add(new BatteryFragment()); mFragmentNames.add(getString(R.string.battery)); } // add Audio Fragment if (Utils.exist(FAUX_SOUND_CONTROL)) { mFragments.add(new AudioFragment()); mFragmentNames.add(getString(R.string.audio)); } // add Voltage Fragment if (Utils.exist(VoltageHelper.CPU_VOLTAGE) || Utils.exist(VoltageHelper.FAUX_VOLTAGE)) { mFragments.add(new VoltageFragment()); mFragmentNames.add(getString(R.string.voltage)); } // add IO Fragment mFragments.add(new IOFragment()); mFragmentNames.add(getString(R.string.io)); // add MinFree Fragment mFragments.add(new MinFreeFragment()); mFragmentNames.add(getString(R.string.minfree)); // add VM Fragment if (VMHelper.getVMValues().size() == VMHelper.getVMFiles().size()) { mFragments.add(new VMFragment()); mFragmentNames.add(getString(R.string.vm)); } // add Information Fragment mFragments.add(new InformationFragment()); mFragmentNames.add(getString(R.string.information)); Utils.saveString("kernelversion", Utils.getFormattedKernelVersion(), getApplicationContext()); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.fragment_list, mFragmentNames)); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { public void onDrawerClosed(View view) { invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { invalidateOptionsMenu(); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(new ArrayAdapter<String>(actionBar.getThemedContext(), android.R.layout.simple_list_item_1, android.R.id.text1, mFragmentNames), this); if (savedInstanceState == null) { setPerm(); Fragment fragment = new ViewPagerFragment(); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); selectItem(0); } }
From source file:ca.ualberta.cmput301w14t08.geochan.fragments.FavouritesFragment.java
/** * Enable the spinner. */ private void enableSpinner() { actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); }
From source file:com.meetingninja.csse.tasks.TasksFragment.java
@Override public void onResume() { getActivity().getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); getActivity().getActionBar().setSelectedNavigationItem(prevSelectedType); super.onResume(); }
From source file:com.nononsenseapps.notepad.MainActivity.java
private void leftOrTabletCreate(Bundle savedInstanceState) { if (savedInstanceState != null) { // currentListId = savedInstanceState.getLong(CURRENT_LIST_ID); listIdToSelect = savedInstanceState.getLong(CURRENT_LIST_ID); // currentListPos = savedInstanceState.getInt(CURRENT_LIST_POS); }//from w w w . j a va 2 s. co m // Set up dropdown navigation final ActionBar actionBar = getActionBar(); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); // Will set cursor in Loader // mSpinnerAdapter = new ExtrasCursorAdapter(this, // R.layout.actionbar_dropdown_item, null, // new String[] { NotePad.Lists.COLUMN_NAME_TITLE }, // new int[] { android.R.id.text1 }, new int[] { -9, -8 }, // new int[] { R.string.show_from_all_lists, R.string.error_title }); mSpinnerAdapter = new SimpleCursorAdapter(this, R.layout.actionbar_dropdown_item, null, new String[] { NotePad.Lists.COLUMN_NAME_TITLE }, new int[] { android.R.id.text1 }, 0); mSpinnerAdapter.setDropDownViewResource(R.layout.actionbar_dropdown_item); // This will listen for navigation callbacks actionBar.setListNavigationCallbacks(mSpinnerAdapter, this); // setContentView(R.layout.fragment_layout); // setUpList(); mSectionAdapter = new SimpleCursorAdapter(this, R.layout.actionbar_dropdown_item, null, new String[] { NotePad.Lists.COLUMN_NAME_TITLE }, new int[] { android.R.id.text1 }, 0); mSectionsPagerAdapter = new ListPagerAdapter(this, getFragmentManager(), mSectionAdapter); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.leftFragment); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int pos) { currentListId = mSectionsPagerAdapter.getItemId(pos); currentListPos = pos; actionBar.setSelectedNavigationItem(pos); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); // Set up navigation list // Set a default list to open if one is set if (listIdToSelect < 0) { listIdToSelect = getAList(this, -1); // Select the first note in that list to open also noteIdToSelect = getANote(this, listIdToSelect); } // Handle the intent first, so we know what to possibly select once // the // loader is finished beforeBoot = true; if (!resuming) { onNewIntent(getIntent()); } getLoaderManager().initLoader(0, null, this); }
From source file:com.miz.mizuu.Actor.java
private void setupActionBarStuff() { actionBar = getActionBar();/*from ww w . ja v a 2 s. c om*/ actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); if (spinnerAdapter == null) spinnerAdapter = new ActionBarSpinner(getApplicationContext(), spinnerItems); setTitle(null); if (!MizLib.isPortrait(getApplicationContext())) findViewById(R.id.layout).setBackgroundResource(0); pbar.setVisibility(View.GONE); awesomePager.setAdapter(new ActorDetailsAdapter(getSupportFragmentManager())); setupSpinnerItems(); findViewById(R.id.layout).setBackgroundResource(0); }