react-native-navigation的迁移库

ContextualMenuButton.java 1.0KB

1234567891011121314151617181920212223242526272829
  1. package com.reactnativenavigation.views;
  2. import android.view.Menu;
  3. import android.view.MenuItem;
  4. import android.view.View;
  5. import com.reactnativenavigation.params.ContextualMenuButtonParams;
  6. class ContextualMenuButton extends TitleBarButton {
  7. private ContextualMenuButtonParams contextualMenuButtonParams;
  8. private ContextualButtonClickListener contextualButtonClickListener;
  9. interface ContextualButtonClickListener {
  10. void onClick(int index);
  11. }
  12. ContextualMenuButton(Menu menu, View parent, ContextualMenuButtonParams contextualMenuButtonParams, ContextualButtonClickListener contextualButtonClickListener) {
  13. super(menu, parent, contextualMenuButtonParams, null);
  14. this.contextualMenuButtonParams = contextualMenuButtonParams;
  15. this.contextualButtonClickListener = contextualButtonClickListener;
  16. }
  17. @Override
  18. public boolean onMenuItemClick(MenuItem item) {
  19. contextualButtonClickListener.onClick(contextualMenuButtonParams.index);
  20. return true;
  21. }
  22. }