List of usage examples for android.app ActionBar setSubtitle
public abstract void setSubtitle(@StringRes int resId);
From source file:com.android.ex.photo.PhotoViewActivity.java
/** * Adjusts the activity title and subtitle to reflect the photo name and count. *//*from w w w .j av a 2 s . co m*/ protected void updateActionBar(PhotoViewFragment fragment) { final int position = mViewPager.getCurrentItem() + 1; final String title; final String subtitle; final boolean hasAlbumCount = mAlbumCount >= 0; final Cursor cursor = getCursorAtProperPosition(); if (cursor != null) { final int photoNameIndex = cursor.getColumnIndex(PhotoContract.PhotoViewColumns.NAME); title = cursor.getString(photoNameIndex); } else { title = null; } if (mIsEmpty || !hasAlbumCount || position <= 0) { subtitle = null; } else { subtitle = getResources().getString(R.string.photo_view_count, position, mAlbumCount); } final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); actionBar.setTitle(title); actionBar.setSubtitle(subtitle); }
From source file:za.ac.uct.cs.lwsjam005.eshelf.activities.ReadActivity.java
private void setupActionBar() { ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#aa000022"))); actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#aa000022"))); actionBar.setSplitBackgroundDrawable(new ColorDrawable(Color.parseColor("#aa000022"))); actionBar.setIcon(thisBook.getIcon()); actionBar.setTitle(thisBook.getTitle()); actionBar.setSubtitle(thisBook.getAuthor()); }
From source file:com.dictionary.activity.ArticleCollectionActivity.java
private void updateTitle(int position) { Log.d("updateTitle", "" + position + " count: " + articleCollectionPagerAdapter.getCount()); Slob.Blob blob = articleCollectionPagerAdapter.get(position); CharSequence pageTitle = articleCollectionPagerAdapter.getPageTitle(position); Log.d("updateTitle", "" + blob); ActionBar actionBar = getActionBar(); if (blob != null) { String dictLabel = blob.owner.getTags().get("label"); actionBar.setTitle(dictLabel);/*from w ww .j a v a 2 s .c om*/ Application app = (Application) getApplication(); app.history.add(app.getUrl(blob)); } else { actionBar.setTitle("???"); } actionBar.setSubtitle(pageTitle); }
From source file:com.example.android.naradaonline.DatagramFragment.java
/** * Updates the status on the action bar. * * @param resId a string resource ID// w w w .j av a2s.co m */ private void setStatus(int resId) { FragmentActivity activity = getActivity(); if (null == activity) { return; } final ActionBar actionBar = activity.getActionBar(); if (null == actionBar) { return; } actionBar.setSubtitle(resId); }
From source file:com.example.android.naradaonline.DatagramFragment.java
/** * Updates the status on the action bar. * * @param subTitle status// w ww. j a v a 2s . com */ private void setStatus(CharSequence subTitle) { FragmentActivity activity = getActivity(); if (null == activity) { return; } final ActionBar actionBar = activity.getActionBar(); if (null == actionBar) { return; } actionBar.setSubtitle(subTitle); }
From source file:com.alcoapps.navigationdrawer.NavdrawerModule.java
@Kroll.method public void attach() { // as a first step I'll play around with the actual activity and actionbar to make sure // I can properly get access to it // some feedback is always nice Log.d(TAG, "called the attach method"); // declare stuff TiApplication appContext = TiApplication.getInstance(); Activity activity = appContext.getCurrentActivity(); ActionBar actionBar; if (!TiApplication.isUIThread()) { // Within which the entire activity is enclosed //DrawerLayout mDrawerLayout; // ListView represents Navigation Drawer //ListView mDrawerList; // ActionBarDrawerToggle indicates the presence of Navigation Drawer in the action bar //ActionBarDrawerToggle mDrawerToggle; // Play with the action bar String mTitle = "This is a test"; String mSubtitle = "This is the subtitle"; actionBar = activity.getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setSubtitle(mSubtitle); actionBar.setTitle(mTitle);/* w w w . j a va2s . c o m*/ } }
From source file:com.android.contacts.activities.ContactDetailActivity.java
/** * Setup the activity title and subtitle with contact name and company. *///from w w w . j a va 2 s.co m private void setupTitle() { CharSequence displayName = ContactDetailDisplayUtils.getDisplayName(this, mContactData); String company = ContactDetailDisplayUtils.getCompany(this, mContactData); ActionBar actionBar = getActionBar(); actionBar.setTitle(displayName); actionBar.setSubtitle(company); final StringBuilder talkback = new StringBuilder(); if (!TextUtils.isEmpty(displayName)) { talkback.append(displayName); } if (!TextUtils.isEmpty(company)) { if (talkback.length() != 0) { talkback.append(", "); } talkback.append(company); } if (talkback.length() != 0) { AccessibilityManager accessibilityManager = (AccessibilityManager) this .getSystemService(Context.ACCESSIBILITY_SERVICE); if (accessibilityManager.isEnabled()) { View decorView = getWindow().getDecorView(); decorView.setContentDescription(talkback); decorView.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); } } }
From source file:spring16.cs442.com.obtchat_10.BluetoothChatFragment.java
/** * Updates the status on the action bar. * * @param resId a string resource ID// w w w . ja v a 2s . co m */ private void setStatus(int resId) { final ActionBar actionBar = getActionBar(); if (null == actionBar) { return; } actionBar.setSubtitle(resId); }
From source file:spring16.cs442.com.obtchat_10.BluetoothChatFragment.java
/** * Updates the status on the action bar. * * @param subTitle status//from w w w . j a v a 2 s. c o m */ private void setStatus(CharSequence subTitle) { final ActionBar actionBar = getActionBar(); if (null == actionBar) { return; } actionBar.setSubtitle(subTitle); }
From source file:com.networksaremadeofstring.anonionooid.RelayDetailsSwipe.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_relay_details_swipe); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mContext = this; if (null == lc) lc = new LocalCache(mContext); lc.open();/* w ww . ja v a2 s . c o m*/ isFavourite = lc.isAFavourite(getIntent().getStringExtra(Ooo.ARG_ITEM_ID)); lc.close(); // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setIcon(R.drawable.ab_icon); try { //fingerprint = actionBar.setSubtitle(getIntent().getStringExtra(Ooo.ARG_ITEM_ID)); } catch (Exception e) { e.printStackTrace(); } if (savedInstanceState == null) { // Create the detail fragment and add it to the activity // using a fragment transaction. arguments = new Bundle(); arguments.putString(Ooo.ARG_ITEM_ID, getIntent().getStringExtra(Ooo.ARG_ITEM_ID)); /*RelayDetailFragment fragment = new RelayDetailFragment(); fragment.setArguments(arguments); getFragmentManager().beginTransaction() .add(R.id.relay_detail_container, fragment) .commit();*/ } // 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 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)); } }