/** This is called when the native library are ready. */ public void onNativeLibraryReady( WindowAndroid windowAndroid, TabContentManager tabContentManager) { assert mLayerTitleCache == null : "Should be called once"; if (DeviceClassManager.enableLayerDecorationCache()) { mLayerTitleCache = new LayerTitleCache(getContext()); } mCompositorView.initNativeCompositor( SysUtils.isLowEndDevice(), windowAndroid, mLayerTitleCache, tabContentManager); if (mLayerTitleCache != null) { mLayerTitleCache.setResourceManager(getResourceManager()); } if (mControlContainer != null) { mCompositorView .getResourceManager() .getDynamicResourceLoader() .registerResource(R.id.control_container, mControlContainer.getToolbarResourceAdapter()); ViewResourceAdapter progressAdapter = mControlContainer.getProgressResourceAdapter(); if (progressAdapter != null) { mCompositorView .getResourceManager() .getDynamicResourceLoader() .registerResource(R.id.progress, progressAdapter); } } }
/** @param controlContainer The ControlContainer. */ public void setControlContainer(ControlContainer controlContainer) { DynamicResourceLoader loader = mCompositorView.getResourceManager() != null ? mCompositorView.getResourceManager().getDynamicResourceLoader() : null; if (loader != null && mControlContainer != null) { loader.unregisterResource(R.id.control_container); loader.unregisterResource(R.id.progress); } mControlContainer = controlContainer; if (loader != null && mControlContainer != null) { loader.registerResource( R.id.control_container, mControlContainer.getToolbarResourceAdapter()); ViewResourceAdapter progressAdapter = mControlContainer.getProgressResourceAdapter(); if (progressAdapter != null) { loader.registerResource(R.id.progress, progressAdapter); } } }