react-native-navigation的迁移库

ScreenFactory.java 1.1KB

123456789101112131415161718192021222324252627
  1. package com.reactnativenavigation.screens;
  2. import android.support.v7.app.AppCompatActivity;
  3. import com.reactnativenavigation.params.ScreenParams;
  4. import com.reactnativenavigation.views.LeftButtonOnClickListener;
  5. class ScreenFactory {
  6. static Screen create(AppCompatActivity activity,
  7. ScreenParams screenParams,
  8. LeftButtonOnClickListener leftButtonOnClickListener) {
  9. if (screenParams.isFragmentScreen()) {
  10. return new FragmentScreen(activity, screenParams, leftButtonOnClickListener);
  11. } else if (screenParams.hasTopTabs()) {
  12. if (screenParams.hasCollapsingTopBar()) {
  13. return new CollapsingViewPagerScreen(activity, screenParams, leftButtonOnClickListener);
  14. } else {
  15. return new ViewPagerScreen(activity, screenParams, leftButtonOnClickListener);
  16. }
  17. } else if (screenParams.hasCollapsingTopBar()) {
  18. return new CollapsingSingleScreen(activity, screenParams, leftButtonOnClickListener);
  19. } else {
  20. return new SingleScreen(activity, screenParams, leftButtonOnClickListener);
  21. }
  22. }
  23. }