Java Code Examples for androidx.appcompat.widget.Toolbar#setSubtitle()
The following examples show how to use
androidx.appcompat.widget.Toolbar#setSubtitle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CrashReporterActivity.java From loco-answers with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.crash_reporter_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(getString(R.string.crash_reporter)); toolbar.setSubtitle(getApplicationName()); setSupportActionBar(toolbar); ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); if (viewPager != null) { setupViewPager(viewPager); } TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); }
Example 2
Source File: UiUtils.java From tindroid with Apache License 2.0 | 6 votes |
static void toolbarSetOnline(final Activity activity, boolean online, Date lastSeen) { final Toolbar toolbar = activity.findViewById(R.id.toolbar); if (toolbar == null) { return; } Drawable logo = toolbar.getLogo(); if (!(logo instanceof LayerDrawable)) { return; } ((OnlineDrawable) ((LayerDrawable) logo).findDrawableByLayerId(LOGO_LAYER_ONLINE)).setOnline(online); if (online) { toolbar.setSubtitle(null); } else if (lastSeen != null) { toolbar.setSubtitle(relativeDateFormat(activity, lastSeen)); } }
Example 3
Source File: FavoritesFragment.java From Easy_xkcd with Apache License 2.0 | 6 votes |
void updateFavorites() { favorites = databaseManager.getFavComics(); /*for (int i = 0; i < favorites.size(); i++) comicMap.put(i, new OfflineComic(favorites.get(i).getComicNumber(), getActivity(), ((MainActivity) getActivity()).getPrefHelper()));*/ if (lastComicNumber != 0) { for (int i = 0; i < favorites.size(); i++) { if (favorites.get(i).getComicNumber() == lastComicNumber) { favoriteIndex = i; } } } lastComicNumber = favorites.get(favoriteIndex).getComicNumber(); getMainActivity().lastComicNumber = lastComicNumber; adapter = new FavoritesPagerAdapter(getActivity(), 0); pager.setAdapter(adapter); pager.setCurrentItem(favoriteIndex); Toolbar toolbar = getMainActivity().getToolbar(); if (getMainActivity().getCurrentFragment() == MainActivity.CurrentFragment.Favorites) toolbar.setSubtitle(prefHelper.subtitleEnabled() ? String.valueOf(favorites.get(favoriteIndex).getComicNumber()) : ""); animateToolbar(); }
Example 4
Source File: DetailsActivity.java From tracker-control-android with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); // Receive about details Intent intent = getIntent(); appPackageName = intent.getStringExtra(INTENT_EXTRA_APP_PACKAGENAME); appUid = intent.getIntExtra(INTENT_EXTRA_APP_UID, -1); appName = intent.getStringExtra(INTENT_EXTRA_APP_NAME); // Set up paging DetailsPagesAdapter detailsPagesAdapter = new DetailsPagesAdapter(this, getSupportFragmentManager(), Common.getAppName(getPackageManager(), appUid), appName, appUid); ViewPager viewPager = findViewById(R.id.view_pager); viewPager.setAdapter(detailsPagesAdapter); TabLayout tabs = findViewById(R.id.tabs); tabs.setupWithViewPager(viewPager); // set toolbar and back arrow Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Set title getSupportActionBar().setDisplayShowTitleEnabled(false); toolbar.setTitle(getString(R.string.app_info)); toolbar.setSubtitle(appName); }
Example 5
Source File: Utils.java From Infinity-For-Reddit with GNU Affero General Public License v3.0 | 5 votes |
public static void displaySortTypeInToolbar(SortType sortType, Toolbar toolbar) { if (sortType != null) { if (sortType.getTime() != null) { toolbar.setSubtitle(sortType.getType().fullName + ": " + sortType.getTime().fullName); } else { toolbar.setSubtitle(sortType.getType().fullName); } } }
Example 6
Source File: TransactionListActivity.java From Gander with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gander_act_transaction_list); Toolbar toolbar = findViewById(R.id.gander_toolbar); setSupportActionBar(toolbar); toolbar.setSubtitle(getApplicationName()); mRecyclerView = findViewById(R.id.gander_transaction_list); final AppBarLayout appBarLayout = findViewById(R.id.gander_appbar); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { appBarLayout.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { appBarLayout.setPadding(0, insets.getSystemWindowInsetTop(), 0, 0); return insets; } }); } mListDiffUtil = new ListDiffUtil(); mTransactionAdapter = new TransactionAdapter(this, mListDiffUtil).setListener(this); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL)); mRecyclerView.setAdapter(mTransactionAdapter); mViewModel = ViewModelProviders.of(this).get(TransactionListViewModel.class); loadResults(null, mViewModel.getTransactions(null)); }
Example 7
Source File: BaseActivity.java From Android-skin-support with MIT License | 5 votes |
protected void initToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setTitle("Title"); toolbar.setSubtitle("Subtitle"); toolbar.setNavigationIcon(R.drawable.ic_settings_black_24dp); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(BaseActivity.this, SettingsActivity.class)); } }); toolbar.setOverflowIcon(getResources().getDrawable(R.drawable.ic_camera_24dp)); }
Example 8
Source File: MessageInfoFragment.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void init() { if (contactImageLoader == null) { contactImageLoader = new ImageLoader(getContext(), getListPreferredItemHeight()) { @Override protected Bitmap processBitmap(Object data) { if(getContext() != null) { return contactService.downloadContactImage(getContext(), (Contact) data); } return null; } }; contactImageLoader.setLoadingImage(R.drawable.applozic_ic_contact_picture_holo_light); contactImageLoader.addImageCache(getActivity().getSupportFragmentManager(), 0.1f); } if (locationImageLoader == null) { locationImageLoader = new ImageLoader(getContext(), ImageUtils.getLargestScreenDimension((Activity) getContext())) { @Override protected Bitmap processBitmap(Object data) { if(getContext() != null) { return fileClientService.loadMessageImage(getContext(), (String) data); } return null; } }; locationImageLoader.setImageFadeIn(false); locationImageLoader.addImageCache(((FragmentActivity) getContext()).getSupportFragmentManager(), 0.1f); } Toolbar toolbar = (Toolbar) getActivity().findViewById(R.id.my_toolbar); toolbar.setClickable(false); toolbar.setTitle(getString(R.string.applozic_message_info)); toolbar.setSubtitle(""); }