List of usage examples for android.app ActionBar setNavigationMode
@Deprecated public abstract void setNavigationMode(@NavigationMode int mode);
From source file:com.aniruddhc.acemusic.player.PlaylistEditorActivity.PlaylistEditorActivity.java
@Override public void onCreate(Bundle savedInstanceState) { //Initialize Context and SharedPreferences. mContext = this; mApp = (Common) this.getApplicationContext(); sharedPreferences = mContext.getSharedPreferences("com.aniruddhc.acemusic.player", Context.MODE_PRIVATE); //Set the UI theme. if (mApp.getCurrentTheme() == Common.DARK_THEME) { setTheme(R.style.AppTheme);/*w ww . j av a2s . co m*/ } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); //Create a set of options to optimize the bitmap memory usage. final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; options.inJustDecodeBounds = false; options.inPurgeable = true; //Display Image Options. displayImageOptions = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.default_album_art) .showImageOnFail(R.drawable.default_album_art).showStubImage(R.drawable.transparent_drawable) .cacheInMemory(false).cacheOnDisc(true).decodingOptions(options) .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565) .displayer(new FadeInBitmapDisplayer(400)).delayBeforeLoading(100).build(); //Attach tabs to the ActionBar. ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //Add the artists tab. String artistsLabel = getResources().getString(R.string.artists); Tab tab = actionBar.newTab(); tab.setText(artistsLabel); TabListener<ArtistsPickerFragment> artistsTabListener = new TabListener<ArtistsPickerFragment>(this, artistsLabel, ArtistsPickerFragment.class); tab.setTabListener(artistsTabListener); actionBar.addTab(tab); //Add the albums tab. String albumsLabel = getResources().getString(R.string.albums); tab = actionBar.newTab(); tab.setText(albumsLabel); TabListener<AlbumsPickerFragment> albumsTabListener = new TabListener<AlbumsPickerFragment>(this, albumsLabel, AlbumsPickerFragment.class); tab.setTabListener(albumsTabListener); actionBar.addTab(tab); //Add the songs tab. String songsLabel = getResources().getString(R.string.songs); tab = actionBar.newTab(); tab.setText(songsLabel); TabListener<SongsPickerFragment> songsTabListener = new TabListener<SongsPickerFragment>(this, songsLabel, SongsPickerFragment.class); tab.setTabListener(songsTabListener); actionBar.addTab(tab); }
From source file:com.Duo.music.player.PlaylistEditorActivity.PlaylistEditorActivity.java
@Override public void onCreate(Bundle savedInstanceState) { //Initialize Context and SharedPreferences. mContext = this; mApp = (Common) this.getApplicationContext(); sharedPreferences = mContext.getSharedPreferences("com.jams.music.player", Context.MODE_PRIVATE); //Set the UI theme. if (mApp.getCurrentTheme() == Common.DARK_THEME) { setTheme(R.style.AppTheme);/*from w w w . ja va 2s. c o m*/ } else { setTheme(R.style.AppThemeLight); } super.onCreate(savedInstanceState); //Create a set of options to optimize the bitmap memory usage. final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; options.inJustDecodeBounds = false; options.inPurgeable = true; //Display Image Options. displayImageOptions = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.default_album_art) .showImageOnFail(R.drawable.default_album_art).showStubImage(R.drawable.transparent_drawable) .cacheInMemory(false).cacheOnDisc(true).decodingOptions(options) .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565) .displayer(new FadeInBitmapDisplayer(400)).delayBeforeLoading(100).build(); //Attach tabs to the ActionBar. ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //Add the artists tab. String artistsLabel = getResources().getString(R.string.artists); Tab tab = actionBar.newTab(); tab.setText(artistsLabel); TabListener<ArtistsPickerFragment> artistsTabListener = new TabListener<ArtistsPickerFragment>(this, artistsLabel, ArtistsPickerFragment.class); tab.setTabListener(artistsTabListener); actionBar.addTab(tab); //Add the albums tab. String albumsLabel = getResources().getString(R.string.albums); tab = actionBar.newTab(); tab.setText(albumsLabel); TabListener<AlbumsPickerFragment> albumsTabListener = new TabListener<AlbumsPickerFragment>(this, albumsLabel, AlbumsPickerFragment.class); tab.setTabListener(albumsTabListener); actionBar.addTab(tab); //Add the songs tab. String songsLabel = getResources().getString(R.string.songs); tab = actionBar.newTab(); tab.setText(songsLabel); TabListener<SongsPickerFragment> songsTabListener = new TabListener<SongsPickerFragment>(this, songsLabel, SongsPickerFragment.class); tab.setTabListener(songsTabListener); actionBar.addTab(tab); }
From source file:net.vexelon.bgrates.ui.activities.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); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setTitle(R.string.app_name_pure); // actionBar.setDisplayUseLogoEnabled(true); // actionBar.setLogo(R.drawable.icon); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // 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 www .jav a 2 s . c o m*/ 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)); } // load default values PreferenceManager.setDefaultValues(this, R.xml.preferences, false); // Start Service startService(); }
From source file:org.aakashlabs.arthashastra.Novice_Activity.java
/** Called when the activity is first created. */ @Override// w w w. jav a 2 s . com public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_novice); //ActionBar gets initiated ActionBar actionbar = getActionBar(); //Tell the ActionBar we want to use Tabs. actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //initiating both tabs and set text to it. ActionBar.Tab Part1NTab = actionbar.newTab().setText("Part 1"); ActionBar.Tab Part2NTab = actionbar.newTab().setText("Part 2"); ActionBar.Tab Part3NTab = actionbar.newTab().setText("Part 3"); //create the two fragments we want to use for display content // these are two objects of the fragment classes (yet to be made) Fragment Part1NFragment = new Part1N(); Fragment Part2NFragment = new Part2N(); Fragment Part3NFragment = new Part3N(); //set the Tab listener. Now we can listen for clicks. Part1NTab.setTabListener(new MyTabsListener(Part1NFragment)); Part2NTab.setTabListener(new MyTabsListener(Part2NFragment)); Part3NTab.setTabListener(new MyTabsListener(Part3NFragment)); //add the two tabs to the action bar actionbar.addTab(Part1NTab); actionbar.addTab(Part2NTab); actionbar.addTab(Part3NTab); }
From source file:com.matze5800.paupdater.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set View//from w w w . j av a 2 s. c om setContentView(R.layout.activity_main); context = this; // Get SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); // ActionBar / PagerAdapter mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getFragmentManager()); final ActionBar actionBar = getActionBar(); actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAppSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) { actionBar.addTab( actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } // Finishes Activity if device is not supported device = Functions.detectDevice(context); if (device.equals("unsupported")) { finish(); } }
From source file:com.whitespider.impact.ble.sensortag.ViewPagerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // Log.d(TAG, "onCreate"); super.onCreate(savedInstanceState); setContentView(mResourceFragmentPager); // Set up the action bar final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ImageView view = (ImageView) findViewById(android.R.id.home); //view.setPadding(10, 0, 20, 10); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(mResourceIdPager); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override//w ww .j a v a 2s . c o m public void onPageSelected(int n) { // Log.d(TAG, "onPageSelected: " + n); actionBar.setSelectedNavigationItem(n); } }); // Create the adapter that will return a fragment for each section mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager.setAdapter(mSectionsPagerAdapter); this.getActionBar().setDisplayShowTitleEnabled(false); this.getActionBar().setDisplayShowHomeEnabled(false); this.busyDialog = new Dialog(this); this.busyDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); ; this.busyDialog.setContentView(R.layout.frame_progress); this.progressBarTextView = (TextView) this.busyDialog.findViewById(R.id.progressTextView); }
From source file:com.android.cts.uiautomator.Test4DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) { View rootView = inflater.inflate(R.layout.test4_detail_fragment, container, false); // Set up the action bar. final ActionBar actionBar = getActivity().getActionBar(); if (actionBar.getTabCount() > 0) { return rootView; }//from w w w. j a va 2 s . com 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(getActivity().getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) rootView.findViewById(R.id.test_4_detail_container); 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 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 listener for when this tab is // selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } return rootView; }
From source file:org.aakashlabs.arthashastra.Advanced_Activity.java
/** Called when the activity is first created. */ @Override//w ww .ja va2s . c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_advanced); //ActionBar gets initiated ActionBar actionbar = getActionBar(); //Tell the ActionBar we want to use Tabs. actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //initiating both tabs and set text to it. ActionBar.Tab Part1ATab = actionbar.newTab().setText("Part 1"); ActionBar.Tab Part2ATab = actionbar.newTab().setText("Part 2"); // ActionBar.Tab Part3ATab = actionbar.newTab().setText("Part 3"); //create the two fragments we want to use for display content // these are two objects of the fragment classes (yet to be made) Fragment Part1AFragment = new Part1A(); Fragment Part2AFragment = new Part2A(); // Fragment Part3AFragment= new Part3A(); //set the Tab listener. Now we can listen for clicks. Part1ATab.setTabListener(new MyTabsListener3(Part1AFragment)); Part2ATab.setTabListener(new MyTabsListener3(Part2AFragment)); // Part3ATab.setTabListener(new MyTabsListener3(Part3AFragment)); //add the two tabs to the action bar actionbar.addTab(Part1ATab); actionbar.addTab(Part2ATab); // actionbar.addTab(Part3ATab); }
From source file:scmu.nutweet.bluetooth.BluetoothChat.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (D)/* ww w. j a va2 s .c o m*/ Log.e(TAG, "+++ ON CREATE +++"); // Set up the window layout setContentView(R.layout.activity_chat); // Set up the action bar to show tabs. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayHomeAsUpEnabled(true); // For each of the sections in the app, add a tab to the action bar. actionBar.addTab(actionBar.newTab().setIcon(R.drawable.friends_black).setTabListener(this)); actionBar.addTab(actionBar.newTab().setIcon(R.drawable.chatmsg_black).setTabListener(this)); //stateChange(Const.mService.getState()); }
From source file:com.ternup.caddisfly.activity.MainActivity.java
/** * *///from w w w . jav a 2s . co m void restoreActionBar() { ActionBar actionBar = getActionBar(); if (actionBar != null) { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); } }