@Override public String loadURL(URL url, String basePath, boolean animated) { basePath = URL.stringAddPathComponent(basePath, getAlias()); String alias = url.firstPathComponent(basePath); if (alias != null) { IViewController<T> topController = getCenterViewController(); if (topController == null || !alias.equals(topController.getAlias())) { if (topController != null) { if (topController.isViewAppeared()) { topController.viewRemoveForSuperView(animated); } topController.setParentController(null); } topController = getViewControllerContext().getViewController(url, basePath); if (topController != null) { topController.setParentController(this); View v = topController.getView(); if (_topControllerDirection == TopControllerDirectionLeft) { v.setX(v.getWidth() - FoldWidth); } else if (_topControllerDirection == TopControllerDirectionRight) { v.setX(FoldWidth - v.getWidth()); } else { v.setX(0); } if (isViewAppeared()) { topController.viewAppearToSuperView(getContentView(), animated); } setCenterViewController(topController); } } if (topController != null) { basePath = topController.loadURL(url, basePath, animated); } } return basePath; }
@Override public boolean openURL(URL url, boolean animated) { String scheme = getScheme(); if (scheme == null) { scheme = "fold"; } if (scheme.equals(url.getScheme())) { String alias = url.firstPathComponent("/"); if (alias != null) { IViewController<T> topController = getLeftViewController(); if (topController != null && alias.equals(topController.getAlias())) { Log.d(Framework.TAG, url.toString()); topController.loadURL(url, "/", animated); setTopControllerDirection(TopControllerDirectionLeft, animated); return true; } topController = getCenterViewController(); if (topController != null && alias.equals(topController.getAlias())) { Log.d(Framework.TAG, url.toString()); topController.loadURL(url, "/", animated); setTopControllerDirection(TopControllerDirectionCenter, animated); return true; } topController = getRightViewController(); if (topController != null && alias.equals(topController.getAlias())) { Log.d(Framework.TAG, url.toString()); topController.loadURL(url, "/", animated); setTopControllerDirection(TopControllerDirectionRight, animated); return true; } } else { Log.d(Framework.TAG, url.toString()); setTopControllerDirection(TopControllerDirectionCenter, animated); return true; } } return super.openURL(url, animated); }