react-native-navigation的迁移库

SideMenuParamsParser.java 1.2KB

123456789101112131415161718192021222324252627282930
  1. package com.reactnativenavigation.params.parsers;
  2. import android.os.Bundle;
  3. import android.support.annotation.Nullable;
  4. import com.reactnativenavigation.params.NavigationParams;
  5. import com.reactnativenavigation.params.SideMenuParams;
  6. import com.reactnativenavigation.views.SideMenu.Side;
  7. class SideMenuParamsParser extends Parser {
  8. public static SideMenuParams[] parse(Bundle sideMenues) {
  9. SideMenuParams[] result = new SideMenuParams[2];
  10. result[Side.Left.ordinal()] = parseSideMenu(sideMenues.getBundle("left"), Side.Left);
  11. result[Side.Right.ordinal()] = parseSideMenu(sideMenues.getBundle("right"), Side.Right);
  12. return result;
  13. }
  14. private static SideMenuParams parseSideMenu(@Nullable Bundle sideMenu, Side side) {
  15. if (sideMenu == null || sideMenu.isEmpty()) {
  16. return null;
  17. }
  18. SideMenuParams result = new SideMenuParams();
  19. result.screenId = sideMenu.getString("screenId");
  20. result.navigationParams = new NavigationParams(sideMenu.getBundle("navigationParams"));
  21. result.disableOpenGesture = sideMenu.getBoolean("disableOpenGesture", false);
  22. result.side = side;
  23. return result;
  24. }
  25. }