Java Code Examples for androidx.appcompat.widget.Toolbar#OnMenuItemClickListener

The following examples show how to use androidx.appcompat.widget.Toolbar#OnMenuItemClickListener . 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: FormFragment.java    From shaky-android with Apache License 2.0 6 votes vote down vote up
@NonNull
private Toolbar.OnMenuItemClickListener createMenuClickListener(@NonNull final EditText messageEditText) {
    return new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            if (item.getItemId() == R.id.action_submit) {
                String message = messageEditText.getText().toString();

                if (validate(message)) {
                    Intent intent = new Intent(ACTION_SUBMIT_FEEDBACK);
                    intent.putExtra(EXTRA_USER_MESSAGE, message);
                    LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intent);
                    return true;
                }
            }
            return false;
        }
    };
}
 
Example 2
Source File: ConversationActivity.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handleReaction(@NonNull View maskTarget,
                           @NonNull MessageRecord messageRecord,
                           @NonNull Toolbar.OnMenuItemClickListener toolbarListener,
                           @NonNull ConversationReactionOverlay.OnHideListener onHideListener)
{
  reactionOverlay.setOnToolbarItemClickedListener(toolbarListener);
  reactionOverlay.setOnHideListener(onHideListener);
  reactionOverlay.show(this, maskTarget, messageRecord, panelParent.getMeasuredHeight());
}
 
Example 3
Source File: ToolbarHelper.java    From Paginize with MIT License 5 votes vote down vote up
@SuppressLint("ResourceType")
public static void setupMenu(Toolbar toolbar,
                             @MenuRes int menuResId,
                             Toolbar.OnMenuItemClickListener listener) {
  if (menuResId > 0) {
    toolbar.inflateMenu(menuResId);
    if (listener != null) {
      toolbar.setOnMenuItemClickListener(listener);
    }
  }
}
 
Example 4
Source File: ToolbarHelper.java    From Paginize with MIT License 5 votes vote down vote up
@SuppressLint("ResourceType")
public static void setupMenu(Toolbar toolbar,
                             @MenuRes int menuResId,
                             Toolbar.OnMenuItemClickListener listener) {
  if (menuResId > 0) {
    toolbar.inflateMenu(menuResId);
    if (listener != null) {
      toolbar.setOnMenuItemClickListener(listener);
    }
  }
}
 
Example 5
Source File: ConversationReactionOverlay.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
public void setOnToolbarItemClickedListener(@Nullable Toolbar.OnMenuItemClickListener onToolbarItemClickedListener) {
  this.onToolbarItemClickedListener = onToolbarItemClickedListener;
}
 
Example 6
Source File: ConversationFragment.java    From mollyim-android with GNU General Public License v3.0 4 votes vote down vote up
void handleReaction(@NonNull View maskTarget,
@NonNull MessageRecord messageRecord,
@NonNull Toolbar.OnMenuItemClickListener toolbarListener,
@NonNull ConversationReactionOverlay.OnHideListener onHideListener);
 
Example 7
Source File: AbstractTabRecyclerAdapter.java    From ChromeLikeTabSwitcher with Apache License 2.0 4 votes vote down vote up
@Override
public final void onToolbarMenuInflated(@MenuRes final int resourceId,
                                        @Nullable final Toolbar.OnMenuItemClickListener listener) {

}
 
Example 8
Source File: TabletContentRecyclerAdapterWrapper.java    From ChromeLikeTabSwitcher with Apache License 2.0 4 votes vote down vote up
@Override
public final void onToolbarMenuInflated(@MenuRes final int resourceId,
                                        @Nullable final Toolbar.OnMenuItemClickListener listener) {

}
 
Example 9
Source File: DisplayUtils.java    From Mysplash with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static void inflateToolbarMenu(Toolbar toolbar, @MenuRes int menuId,
                                      Toolbar.OnMenuItemClickListener listener) {
    toolbar.inflateMenu(menuId);
    toolbar.setOnMenuItemClickListener(listener);
    // setOverflowMenuIconsVisible(toolbar.getMenu());
}