react-native-navigation的迁移库

FabParamsParser.java 1.5KB

123456789101112131415161718192021222324252627282930313233343536
  1. package com.reactnativenavigation.params.parsers;
  2. import android.os.Bundle;
  3. import com.reactnativenavigation.params.FabActionParams;
  4. import com.reactnativenavigation.params.FabParams;
  5. import com.reactnativenavigation.params.StyleParams;
  6. import com.reactnativenavigation.react.ImageLoader;
  7. public class FabParamsParser extends Parser {
  8. public FabParams parse(Bundle params, final String navigatorEventId, String screenInstanceId) {
  9. FabParams fabParams = new FabParams();
  10. fabParams.collapsedId = params.getString("collapsedId");
  11. fabParams.expendedId = params.getString("expendedId");
  12. fabParams.navigatorEventId = navigatorEventId;
  13. fabParams.screenInstanceId = screenInstanceId;
  14. fabParams.backgroundColor = getColor(params, "backgroundColor", new StyleParams.Color());
  15. if (hasKey(params, "collapsedIcon")) {
  16. fabParams.collapsedIcon = ImageLoader.loadImage(params.getString("collapsedIcon"));
  17. }
  18. if (hasKey(params, "expendedIcon")) {
  19. fabParams.expendedIcon = ImageLoader.loadImage(params.getString("expendedIcon"));
  20. }
  21. if (hasKey(params, "actions")) {
  22. fabParams.actions = parseBundle(params.getBundle("actions"), new ParseStrategy<FabActionParams>() {
  23. @Override
  24. public FabActionParams parse(Bundle params) {
  25. return new FabActionParamsParser().parse(params, navigatorEventId);
  26. }
  27. });
  28. }
  29. return fabParams;
  30. }
  31. }