react-native-navigation的迁移库

TopBarBackgroundViewController.java 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package com.reactnativenavigation.viewcontrollers.topbar;
  2. import android.app.Activity;
  3. import com.reactnativenavigation.parse.Component;
  4. import com.reactnativenavigation.parse.Options;
  5. import com.reactnativenavigation.react.events.ComponentType;
  6. import com.reactnativenavigation.utils.CompatUtils;
  7. import com.reactnativenavigation.viewcontrollers.ViewController;
  8. import com.reactnativenavigation.viewcontrollers.YellowBoxDelegate;
  9. import com.reactnativenavigation.viewcontrollers.viewcontrolleroverlay.ViewControllerOverlay;
  10. import com.reactnativenavigation.views.topbar.TopBarBackgroundView;
  11. import com.reactnativenavigation.views.topbar.TopBarBackgroundViewCreator;
  12. public class TopBarBackgroundViewController extends ViewController<TopBarBackgroundView> {
  13. private TopBarBackgroundViewCreator viewCreator;
  14. private Component component;
  15. public TopBarBackgroundViewController(Activity activity, TopBarBackgroundViewCreator viewCreator) {
  16. super(activity, CompatUtils.generateViewId() + "", new YellowBoxDelegate(), new Options(), new ViewControllerOverlay(activity));
  17. this.viewCreator = viewCreator;
  18. }
  19. @Override
  20. protected TopBarBackgroundView createView() {
  21. return viewCreator.create(getActivity(), component.componentId.get(), component.name.get());
  22. }
  23. @Override
  24. public void onViewAppeared() {
  25. super.onViewAppeared();
  26. getView().sendComponentStart(ComponentType.Background);
  27. }
  28. @Override
  29. public void onViewDisappear() {
  30. getView().sendComponentStop(ComponentType.Background);
  31. super.onViewDisappear();
  32. }
  33. @Override
  34. public void sendOnNavigationButtonPressed(String buttonId) {
  35. }
  36. public void setComponent(Component component) {
  37. this.component = component;
  38. }
  39. public Component getComponent() {
  40. return component;
  41. }
  42. }