react-native-navigation的迁移库

TopTabParamsParser.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.reactnativenavigation.params.parsers;
  2. import android.os.Bundle;
  3. import android.support.annotation.NonNull;
  4. import com.reactnativenavigation.params.NavigationParams;
  5. import com.reactnativenavigation.params.PageParams;
  6. import java.util.List;
  7. public class TopTabParamsParser extends Parser {
  8. private static final String KEY_SCREEN_ID = "screenId";
  9. private static final String KEY_TITLE = "title";
  10. private static final String NAVIGATION_PARAMS = "navigationParams";
  11. @SuppressWarnings("ConstantConditions")
  12. public List<PageParams> parse(Bundle params) {
  13. return parseBundle(params, new ParseStrategy<PageParams>() {
  14. @Override
  15. public PageParams parse(Bundle topTabs) {
  16. return parseItem(topTabs);
  17. }
  18. });
  19. }
  20. @NonNull
  21. private static PageParams parseItem(Bundle params) {
  22. PageParams result = new PageParams();
  23. result.screenId = params.getString(KEY_SCREEN_ID);
  24. result.title = params.getString(KEY_TITLE);
  25. result.navigationParams = new NavigationParams(params.getBundle(NAVIGATION_PARAMS));
  26. result.leftButton = ButtonParser.parseLeftButton(params);
  27. result.rightButtons = ButtonParser.parseRightButton(params);
  28. result.fabParams = ButtonParser.parseFab(params, result.navigationParams.navigatorEventId, result.navigationParams.screenInstanceId);
  29. result.styleParams = new StyleParamsParser(params.getBundle("styleParams")).parse();
  30. return result;
  31. }
  32. }