List of usage examples for android.app ActionBar setNavigationMode
@Deprecated public abstract void setNavigationMode(@NavigationMode int mode);
From source file:org.floens.chan.ui.activity.BoardActivity.java
private void updateActionBarStateCallback() { final ActionBar actionBar = getActionBar(); if (threadPane.isSlideable()) { if (threadPane.isOpen()) { int index = getBoardIndexNavigator(boardLoadable.board); if (index >= 0) { // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); setActionBarListMode();//from w w w .ja va2 s. c o m actionBar.setTitle(""); } else { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); String niceTitle = ChanApplication.getBoardManager().getBoardKey(boardLoadable.board); if (niceTitle == null) { actionBar.setTitle("/" + boardLoadable.board + "/"); } else { actionBar.setTitle(niceTitle); } } actionBar.setHomeButtonEnabled(true); pinDrawerListener.setDrawerIndicatorEnabled(true); if (boardLoadable.isBoardMode()) setShareUrl(ChanUrls.getBoardUrlDesktop(boardLoadable.board)); } else { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setTitle(threadLoadable.title); pinDrawerListener.setDrawerIndicatorEnabled(false); if (threadLoadable.isThreadMode()) setShareUrl(ChanUrls.getThreadUrlDesktop(threadLoadable.board, threadLoadable.no)); } actionBar.setDisplayHomeAsUpEnabled(true); } else { setActionBarListMode(); // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); pinDrawerListener.setDrawerIndicatorEnabled(true); actionBar.setTitle(threadLoadable.title); actionBar.setDisplayHomeAsUpEnabled(true); if (threadLoadable.isThreadMode()) setShareUrl(ChanUrls.getThreadUrlDesktop(threadLoadable.board, threadLoadable.no)); } actionBar.setDisplayShowTitleEnabled(true); invalidateOptionsMenu(); }
From source file:cn.jasonlv.siri.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ??? ???/*from w ww . j a v a 2 s .c o m*/ musicManager = new MusicManager(getApplicationContext()); // ?? initImageLoader(getApplicationContext()); /* get the installed package list*/ // ?? mPackageManager = new NativePackageManager(getApplicationContext()); // ? setVolumeControlStream(AudioManager.STREAM_MUSIC); // ? mSynthesizer = new Synthesizer(getApplicationContext()); //mSynthesizer.speak("EDI"); // ? mContactManager = new ContactsManager(getApplicationContext()); mContactManager.getContactList(); // ?? detactor = new LocationDetactor(getApplicationContext()); info = detactor.getLocationInfo(); Log.d("location info", info.lat + ", " + info.lon); //for(Object o : mPackageManager.getPackageList()){ // System.out.println(o.toString()); setContentView(R.layout.sdk2_api); //txtLog = (TextView) findViewById(R.id.txtLog); btn = (ActionButton) findViewById(R.id.btn); // ? speechRecognizer = SpeechRecognizer.createSpeechRecognizer(this, new ComponentName(this, VoiceRecognitionService.class)); speechRecognizer.setRecognitionListener(this); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(MainActivity.this); boolean api = sp.getBoolean("api", false); if (api) { switch (status) { case STATUS_None: start(); //btn.setText("?"); status = STATUS_WaitingReady; break; case STATUS_WaitingReady: cancel(); status = STATUS_None; //btn.setText(""); break; case STATUS_Ready: cancel(); status = STATUS_None; //btn.setText(""); break; case STATUS_Speaking: stop(); status = STATUS_Recognition; //btn.setText(""); break; case STATUS_Recognition: cancel(); status = STATUS_None; //btn.setText(""); break; } } else { start(); } } }); ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); container = (LinearLayout) findViewById(R.id.container); scrollView = (ScrollView) findViewById(R.id.scroll); scrollView.fullScroll(View.FOCUS_DOWN); }
From source file:com.concentricsky.android.khanacademy.app.VideoListActivity.java
@Override protected void onStart() { Log.d(LOG_TAG, "onStart"); super.onStart(); stopped = false;//from w w w . j a va 2s. c o m mainMenuDelegate = new MainMenuDelegate(this); listView = (AbsListView) findViewById(android.R.id.list); listView.setOnItemClickListener(clickListener); if (listView instanceof ListView) { // It is important that this is inflated with listView passed as the parent, despite the attach false parameter. // Otherwise, the view ends up with incorrect LayoutParams and we see crazy, crazy behavior. headerView = getLayoutInflater().inflate(R.layout.header_video_list, listView, false); ListView lv = (ListView) listView; if (lv.getHeaderViewsCount() == 0) { lv.addHeaderView(headerView); } } else { // GridView, fixed header headerView = findViewById(R.id.header_video_list); } /** Responsive layout stuff * * Based on screen width, we will find either * narrow * a listview with a header view * items are a thumbnail to the left and a title on white space to the right. * header is a thumbnail with overlaid title across the bottom * * middle * a fixed header on top and a grid view below * header is thumb to left, title above scrolling description to right * items are thumbs with title overlaid across the bottom (3 across) * * wide * a fixed header to the left and a grid view on the right * header is thumb on top, title next, description at bottom * items are thumbs with title overlaid across the bottom (3 across) * * * So in this class, we * find view by id 'list' * if it's a ListView, inflate and attach header view * if not, then the header is fixed and already in the layout * either way, now we can find header views by id * adapter is the same either way * * * * **/ ActionBar ab = getActionBar(); displayOptionsAdapter = new ArrayAdapter<String>(getActionBar().getThemedContext(), android.R.layout.simple_list_item_1, displayOptions); ab.setDisplayHomeAsUpEnabled(true); ab.setTitle(""); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); ab.setListNavigationCallbacks(displayOptionsAdapter, navListener); ab.setSelectedNavigationItem(isShowingDownloadedVideosOnly ? 1 : 0); requestDataService(new ObjectCallback<KADataService>() { @Override public void call(KADataService dataService) { VideoListActivity.this.dataService = dataService; if (topicId != null) { Dao<Topic, String> topicDao; try { topicDao = dataService.getHelper().getTopicDao(); topic = topicDao.queryForId(topicId); } catch (SQLException e) { e.printStackTrace(); } } else { Log.e(LOG_TAG, "Topic id not set for video list"); topic = dataService.getRootTopic(); topicId = topic.getId(); } thumbnailManager = dataService.getThumbnailManager(); api = dataService.getAPIAdapter(); api.registerUserUpdateListener(userUpdateListener); // This instead happens in ActionBar.OnNavigationListener#onNavigationItemSelected, which // fires after onResume. // setParentTopic(topic); } }); IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_LIBRARY_UPDATE); filter.addAction(ACTION_BADGE_EARNED); filter.addAction(ACTION_OFFLINE_VIDEO_SET_CHANGED); filter.addAction(ACTION_DOWNLOAD_PROGRESS_UPDATE); filter.addAction(ACTION_TOAST); LocalBroadcastManager.getInstance(this).registerReceiver(receiver, filter); thumbExecutor = Executors.newSingleThreadExecutor(); }
From source file:com.geotrackin.gpslogger.GpsMainActivity.java
public void SetUpActionBar() { ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); SpinnerAdapter spinnerAdapter = ArrayAdapter.createFromResource(actionBar.getThemedContext(), R.array.gps_main_views, android.R.layout.simple_spinner_dropdown_item); actionBar.setListNavigationCallbacks(spinnerAdapter, this); //Reload the user's previously selected view f73 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); actionBar.setSelectedNavigationItem(prefs.getInt("dropdownview", 0)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(""); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.actionbar); ImageButton helpButton = (ImageButton) actionBar.getCustomView().findViewById(R.id.imgHelp); helpButton.setOnClickListener(new View.OnClickListener() { @Override/* w ww.jav a 2 s . co m*/ public void onClick(View view) { Intent faqtivity = new Intent(getApplicationContext(), Faqtivity.class); startActivity(faqtivity); } }); }
From source file:com.hardcopy.retroband.MainActivity.java
/***************************************************** * Overrided methods/*from w w w . j ava 2 s. 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); // Load static utilities mUtils = new Utils(mContext); // 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 LLFragmentAdapter(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(); }
From source file:com.example.android.cardreader.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.alternate_main_fragment); //TODO Stop Executing Eden //Globals.executeEden(); getUsers(1);/* w w w .j a v a2 s . co m*/ instance = this; final ActionBar actionBar = getActionBar(); actionBar.setTitle(" TartanHacks"); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg)); actionBar.setStackedBackgroundDrawable(getResources().getDrawable(R.drawable.tab_bg)); actionBar.setDisplayShowHomeEnabled(true); frags.add(new PersonListFrag(Globals.pending)); frags.add(new PersonListFrag(Globals.allUsers)); frags.add(new PersonListFrag(Globals.checkedIn)); mAdapter = new FragmentAdapter(getFragmentManager()); fab = findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { View dialogView = View.inflate(instance, R.layout.dialog_signup, null); idField = (EditText) dialogView.findViewById(R.id.andrewIdField); pb = (ProgressBar) dialogView.findViewById(R.id.progress); nameField = (TextView) dialogView.findViewById(R.id.name); scanView = (TextView) dialogView.findViewById(R.id.scan_view); idField.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String id = s.toString(); pb.setVisibility(View.VISIBLE); queryId(id); } @Override public void afterTextChanged(Editable s) { } }); AlertDialog.Builder builder; builder = new AlertDialog.Builder(instance); builder.setView(dialogView); builder.setCancelable(true); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { Globals.adding = false; } }); signupDialog = builder.show(); } }); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(0); mViewPager.setAdapter(mAdapter); 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); } }); actionBar.addTab(actionBar.newTab().setText("Pending").setTabListener(this)); actionBar.addTab(actionBar.newTab().setText("All").setTabListener(this)); actionBar.addTab(actionBar.newTab().setText("Checked In").setTabListener(this)); mLoyaltyCardReader = new LoyaltyCardReader(this); // Disable Android Beam and register our card reader callback enableReaderMode(); new UpdateThread().executeOnExecutor(Executors.newSingleThreadExecutor()); }
From source file:com.example.mydemos.view.RingtonePickerActivity.java
private void setViewPager() { // need cancel these feature in onCreate requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_NO_TITLE); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mViewPager = (ViewPager) findViewById(R.id.pager); //using TabsPageAdapter mTabsAdapter = new TabsPageAdapter(this, mViewPager); mViewPager.setAdapter(mTabsAdapter); mViewPager.setOnPageChangeListener(mTabsAdapter); ActionBar actionBar = this.getActionBar(); Tab tab1 = actionBar.newTab();//from w ww. j a va 2 s . c om mTabsAdapter.addTab(tab1, TabContentFragment.class, null); Tab tab2 = actionBar.newTab(); mTabsAdapter.addTab(tab2, TabContentFragment.class, null); }
From source file:com.ibm.watson.developer_cloud.android.examples.IBMSpeechToText.java
/** public static class TTSCommands extends AsyncTask<Void, Void, JSONObject> { // w w w . j a v a 2 s .c o m protected JSONObject doInBackground(Void... none) { return TextToSpeech.sharedInstance().getVoices(); } }*/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); StorageReference mStorageRef; mStorageRef = FirebaseStorage.getInstance().getReference(); // Strictmode needed to run the http/wss request for devices > Gingerbread if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } //setContentView(R.layout.activity_main); setContentView(R.layout.activity_tab_text); ActionBar action = getActionBar(); action.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); tabSTT = action.newTab().setText("Meeting Recorder"); // tabTTS = actionBar.newTab().setText("Text to Speech"); tabSTT.setTabListener(new MyTabListener(fragmentTabSTT)); // tabTTS.setTabListener(new MyTabListener(fragmentTabTTS)); action.addTab(tabSTT); // actionBar.addTab(tabTTS); //actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#B5C0D0"))); }
From source file:org.dmfs.webcal.fragments.MyCalendarsFragment.java
private void setupActionBarTabs() { ActionBar actionBar = getActivity().getActionBar(); int tabCount = actionBar.getTabCount(); int pageCount = mAdapter.getCount(); // replace titles and listeners of existing tabs int i = 0;// w ww . ja va2s. c om for (; i < tabCount && i < pageCount; ++i) { final Tab tab = actionBar.getTabAt(i); tab.setText(mAdapter.getPageTitle(i)); tab.setTabListener(this); } // add missing tabs for (; i < pageCount; ++i) { actionBar.addTab(actionBar.newTab().setText(mAdapter.getPageTitle(i)).setTabListener(this)); } // remove remaining tabs for (; i < tabCount; --tabCount) { actionBar.removeTabAt(i); } if (pageCount > 1) { int selection = mSelectedTab; // changing the navigation mode might trigger a call to onTabSelected, overriding mSelectedTab with a wrong value, so save it actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mSelectedTab = selection; if (selection < pageCount) { mViewPager.setCurrentItem(selection, false); } } else { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); } }
From source file:lth.pontus.getResults.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mContext = getApplicationContext();/*w w w . j a v a 2 s. c o m*/ // 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); actionBar.setDisplayUseLogoEnabled(false); // 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); exercisel = new ExerciseProvider(); DateHelper = new DateProvider(); openDB(); // 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. Tab a = actionBar.newTab().setIcon(mAppSectionsPagerAdapter.getPageICon(i)); a.setTabListener(this); actionBar.addTab(a); } }