Java Code Examples for androidx.appcompat.app.actionbar#getCustomView()
The following examples show how to use
androidx.appcompat.app.actionbar#getCustomView() .
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: FragmentBase.java From FairEmail with GNU General Public License v3.0 | 6 votes |
private void updateSubtitle() { AppCompatActivity activity = (AppCompatActivity) getActivity(); if (activity != null && !isPane()) { ActionBar actionbar = activity.getSupportActionBar(); if (actionbar != null) if ((actionbar.getDisplayOptions() & DISPLAY_SHOW_CUSTOM) == 0) { actionbar.setTitle(title == null ? getString(R.string.app_name) : title); actionbar.setSubtitle(subtitle); } else { View custom = actionbar.getCustomView(); TextView tvTitle = custom.findViewById(R.id.title); TextView tvSubtitle = custom.findViewById(R.id.subtitle); tvTitle.setText(title == null ? getString(R.string.app_name) : title); tvSubtitle.setText(subtitle); } } }
Example 2
Source File: ProfileActivity.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle bundle, boolean ready) { setContentView(R.layout.profile_activity); initializeResources(); setSupportActionBar(this.toolbar); ActionBar supportActionBar = getSupportActionBar(); supportActionBar.setDisplayHomeAsUpEnabled(false); supportActionBar.setCustomView(R.layout.conversation_title_view); supportActionBar.setDisplayShowCustomEnabled(true); supportActionBar.setDisplayShowTitleEnabled(false); Toolbar parent = (Toolbar) supportActionBar.getCustomView().getParent(); parent.setPadding(0,0,0,0); parent.setContentInsetsAbsolute(0,0); titleView = (ConversationTitleView) supportActionBar.getCustomView(); titleView.setOnBackClickedListener(view -> onBackPressed()); titleView.setOnClickListener(view -> onEnlargeAvatar()); updateToolbar(); this.tabLayout.setupWithViewPager(viewPager); this.viewPager.setAdapter(new ProfilePagerAdapter(getSupportFragmentManager())); dcContext.eventCenter.addObserver(DcContext.DC_EVENT_CHAT_MODIFIED, this); dcContext.eventCenter.addObserver(DcContext.DC_EVENT_CONTACTS_CHANGED, this); }
Example 3
Source File: HoneycombUtil.java From shortyz with GNU General Public License v3.0 | 5 votes |
public View onActionBarCustom(AppCompatActivity a, int id) { ActionBar bar = a.getSupportActionBar(); if(bar == null){ return null; } bar.setDisplayShowCustomEnabled(true); bar.setDisplayShowTitleEnabled(false); bar.setDisplayShowHomeEnabled(true); bar.setCustomView(id); return bar.getCustomView(); }
Example 4
Source File: GingerbreadUtil.java From shortyz with GNU General Public License v3.0 | 5 votes |
public View onActionBarCustom(AppCompatActivity a, int id) { System.out.println("Setting custom ActionBar view"); ActionBar bar = a.getSupportActionBar(); if(bar == null){ return null; } bar.setDisplayShowCustomEnabled(true); bar.setDisplayShowTitleEnabled(false); bar.setDisplayShowHomeEnabled(true); bar.setCustomView(id); return bar.getCustomView(); }
Example 5
Source File: ConversationActivity.java From deltachat-android with GNU General Public License v3.0 | 4 votes |
private void initializeViews() { ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar == null) throw new AssertionError(); titleView = (ConversationTitleView) supportActionBar.getCustomView(); buttonToggle = ViewUtil.findById(this, R.id.button_toggle); sendButton = ViewUtil.findById(this, R.id.send_button); attachButton = ViewUtil.findById(this, R.id.attach_button); composeText = ViewUtil.findById(this, R.id.embedded_text_editor); emojiDrawerStub = ViewUtil.findStubById(this, R.id.emoji_drawer_stub); composePanel = ViewUtil.findById(this, R.id.bottom_panel); container = ViewUtil.findById(this, R.id.layout_container); reminderView = ViewUtil.findStubById(this, R.id.reminder_stub); quickAttachmentDrawer = ViewUtil.findById(this, R.id.quick_attachment_drawer); quickAttachmentToggle = ViewUtil.findById(this, R.id.quick_attachment_toggle); inputPanel = ViewUtil.findById(this, R.id.bottom_panel); ImageButton quickCameraToggle = ViewUtil.findById(this, R.id.quick_camera_toggle); container.addOnKeyboardShownListener(this); inputPanel.setListener(this); inputPanel.setMediaListener(this); attachmentTypeSelector = null; attachmentManager = new AttachmentManager(this, this); audioRecorder = new AudioRecorder(this); SendButtonListener sendButtonListener = new SendButtonListener(); ComposeKeyPressedListener composeKeyPressedListener = new ComposeKeyPressedListener(); composeText.setOnEditorActionListener(sendButtonListener); attachButton.setOnClickListener(new AttachButtonListener()); attachButton.setOnLongClickListener(new AttachButtonLongClickListener()); sendButton.setOnClickListener(sendButtonListener); sendButton.setEnabled(true); sendButton.addOnTransportChangedListener((newTransport, manuallySelected) -> { composeText.setTransport(newTransport); buttonToggle.getBackground().invalidateSelf(); }); titleView.setOnClickListener(v -> handleProfile()); titleView.setOnBackClickedListener(view -> onBackPressed()); composeText.setOnKeyListener(composeKeyPressedListener); composeText.addTextChangedListener(composeKeyPressedListener); composeText.setOnEditorActionListener(sendButtonListener); composeText.setOnClickListener(composeKeyPressedListener); composeText.setOnFocusChangeListener(composeKeyPressedListener); if (QuickAttachmentDrawer.isDeviceSupported(this)) { quickAttachmentDrawer.setListener(this); quickCameraToggle.setOnClickListener(new QuickCameraToggleListener()); } else { quickCameraToggle.setVisibility(View.GONE); quickCameraToggle.setEnabled(false); } initializeBackground(); }