feat: add DoricAssets resource
This commit is contained in:
@@ -41,8 +41,9 @@ import pub.doric.plugin.ShaderPlugin;
|
||||
import pub.doric.plugin.StatusBarPlugin;
|
||||
import pub.doric.plugin.StoragePlugin;
|
||||
import pub.doric.refresh.RefreshableNode;
|
||||
import pub.doric.resource.DoricAssetsLoader;
|
||||
import pub.doric.resource.DoricAndroidAssetsLoader;
|
||||
import pub.doric.resource.DoricAndroidLoader;
|
||||
import pub.doric.resource.DoricAssetsLoader;
|
||||
import pub.doric.resource.DoricBase64Loader;
|
||||
import pub.doric.resource.DoricLocalLoader;
|
||||
import pub.doric.resource.DoricRemoteLoader;
|
||||
@@ -136,6 +137,7 @@ public class DoricRegistry {
|
||||
this.registerViewNode(AeroEffectViewNode.class);
|
||||
this.getResourceManager().registerLoader(new DoricAndroidLoader("drawable"));
|
||||
this.getResourceManager().registerLoader(new DoricAndroidLoader("raw"));
|
||||
this.getResourceManager().registerLoader(new DoricAndroidAssetsLoader());
|
||||
this.getResourceManager().registerLoader(new DoricAssetsLoader());
|
||||
this.getResourceManager().registerLoader(new DoricLocalLoader());
|
||||
this.getResourceManager().registerLoader(new DoricRemoteLoader());
|
||||
|
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright [2021] [Doric.Pub]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package pub.doric.resource;
|
||||
|
||||
import pub.doric.DoricContext;
|
||||
|
||||
/**
|
||||
* @Description: This loads resource from android's assets dir
|
||||
* @Author: pengfei.zhou
|
||||
* @CreateDate: 2021/10/20
|
||||
*/
|
||||
public class DoricAndroidAssetsLoader implements DoricResourceLoader {
|
||||
@Override
|
||||
public String resourceType() {
|
||||
return "android_assets";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoricResource load(DoricContext doricContext, String identifier) {
|
||||
return new DoricAssetsResource(doricContext, identifier);
|
||||
}
|
||||
}
|
@@ -18,18 +18,18 @@ package pub.doric.resource;
|
||||
import pub.doric.DoricContext;
|
||||
|
||||
/**
|
||||
* @Description: This loads resource from android's assets dir
|
||||
* @Description: This loads resource from doric project's assets/ file
|
||||
* @Author: pengfei.zhou
|
||||
* @CreateDate: 2021/10/20
|
||||
*/
|
||||
public class DoricAssetsLoader implements DoricResourceLoader {
|
||||
@Override
|
||||
public String resourceType() {
|
||||
return "assets";
|
||||
return "doric_assets";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoricResource load(DoricContext doricContext, String identifier) {
|
||||
return new DoricAssetsResource(doricContext, identifier);
|
||||
return new DoricAssetsResource(doricContext, "assets/" + identifier);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user