Java Code Examples for androidx.appcompat.widget.Toolbar#setLogo()

The following examples show how to use androidx.appcompat.widget.Toolbar#setLogo() . 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: EditFiltersActivity.java    From mimi-reader with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_filter);

    filterList = (RecyclerView) findViewById(R.id.filter_list);
    boardSpinner = (AppCompatSpinner) findViewById(R.id.board_spinner);

    initRecyclerView();

    Toolbar toolbar = (Toolbar) findViewById(R.id.mimi_toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_nav_arrow_back);
    toolbar.setLogo(null);
    toolbar.setTitle(R.string.edit_filters);
    setToolbar(toolbar);

    String boardName = getIntent().getStringExtra(EXTRA_BOARD_NAME);
    loadBoards(boardName);
}
 
Example 2
Source File: MainActivity.java    From WebviewProject with MIT License 5 votes vote down vote up
void addToolbar(){
    Toolbar toolbar=findViewById(R.id.main_toolbar);
    setSupportActionBar(toolbar);
    toolbar.setTitleTextColor(getResources().getColor(R.color.backgroundWhite));//TODO Title color of toolbar
    toolbar.setLogo(R.mipmap.ic_launcher);//TODO Logo of toolbar
    toolbar.setElevation(2);//TODO Shadow under the toolbar
}
 
Example 3
Source File: StoreFragment.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
@Override protected void setupToolbarDetails(Toolbar toolbar) {
  toolbar.setTitle(title);
  toolbar.setBackgroundResource(
      themeManager.getAttributeForTheme(storeTheme, R.attr.toolbarBackground).resourceId);
  if (userId != null) {
    toolbar.setLogo(R.drawable.ic_user_shape_white);
  } else {
    toolbar.setLogo(R.drawable.ic_store_white);
  }
}
 
Example 4
Source File: UiUtils.java    From tindroid with Apache License 2.0 5 votes vote down vote up
private static void constructToolbarLogo(final Activity activity, Bitmap avatar, String name,
                                         String uid, boolean online) {
    final Toolbar toolbar = activity.findViewById(R.id.toolbar);
    if (toolbar == null) {
        return;
    }

    Drawable avatarDrawable;
    if (avatar != null) {
        avatarDrawable = new RoundImageDrawable(activity.getResources(), avatar);
    } else {
        avatarDrawable = new LetterTileDrawable(activity)
                .setLetterAndColor(name, uid)
                .setContactTypeAndColor(Topic.getTopicTypeByName(uid) == Topic.TopicType.P2P ?
                        LetterTileDrawable.ContactType.PERSON : LetterTileDrawable.ContactType.GROUP);
    }
    AnimationDrawable typing = (AnimationDrawable)
            activity.getResources().getDrawable(R.drawable.typing_indicator);
    typing.setOneShot(false);
    typing.setVisible(false, true);
    typing.setAlpha(0);
    LayerDrawable layers = new LayerDrawable(
            new Drawable[]{
                    avatarDrawable,
                    new OnlineDrawable(online),
                    typing});
    layers.setId(0, LOGO_LAYER_AVATAR);
    layers.setId(1, LOGO_LAYER_ONLINE);
    layers.setId(2, LOGO_LAYER_TYPING);
    toolbar.setLogo(layers);
    Rect b = toolbar.getLogo().getBounds();
    if (!b.isEmpty()) {
        typing.setBounds(b.right - b.width() / 4, b.bottom - b.height() / 4, b.right, b.bottom);
    }
}
 
Example 5
Source File: GridRecyclerSwipeWithToolbarFragment.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override public void setupToolbarDetails(Toolbar toolbar) {
  toolbar.setTitle(Translator.translate(title, getContext().getApplicationContext(), marketName));
  toolbar.setLogo(R.drawable.logo_toolbar);
}
 
Example 6
Source File: TopStoresFragment.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override public void setupToolbarDetails(Toolbar toolbar) {
  toolbar.setTitle(R.string.top_stores_fragment_title);
  toolbar.setLogo(R.drawable.logo_toolbar);
}
 
Example 7
Source File: StoreTabGridRecyclerFragment.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override public void setupToolbarDetails(Toolbar toolbar) {
  toolbar.setTitle(Translator.translate(title, getContext().getApplicationContext(), marketName));
  toolbar.setLogo(R.drawable.logo_toolbar);
}
 
Example 8
Source File: MyStoresFragment.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override public void setupToolbarDetails(Toolbar toolbar) {
  toolbar.setTitle(null);
  toolbar.setLogo(null);
}