回复
     鸿蒙开源组件——后台页面动态变更组件
jacksky
 发布于 2021-12-7 18:00
 浏览
 0收藏
Proteus
项目介绍
- 项目名称:Proteus
 - 所属系列:openharmony 第三方组件适配移植
 - 功能:一个可从后台动态变更页面的组件
 - 项目移植状态:主功能完成
 - 调用差异:有(json数据中将布局名称等更换为openharmony 布局名称)
 - 开发版本:sdk6,DevEco Studio2.2 beta1
 - 基线版本:Release 5.0.1
 
效果演示
安装教程
- 在项目根目录下的build.gradle文件中,
// 添加maven仓库 repositories { maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' } } - 在entry模块的build.gradle文件中,
// 添加依赖库 dependencies { implementation 'com.gitee.chinasoft_ohos:proteus-core:1.0.0' implementation 'com.gitee.chinasoft_ohos:proteus-support-v4:1.0.0' implementation 'com.gitee.chinasoft_ohos:proteus-recyclerview-v7:1.0.0' implementation 'com.gitee.chinasoft_ohos:proteus-cardview-v7:1.0.0' implementation 'com.gitee.chinasoft_ohos:proteus-gson-adapter:1.0.0' } 
在sdk5,DevEco Studio2.2 beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
使用说明
Sample layout
{ 
  “ type”:“ DirectionalLayout” ,
  “ orientation”:“ vertical” ,
  “ padding”:“ 16vp” ,
  “ children”:[ { 
    “ type”:“ Text” ,
    “ width”:“ 200vp” ,
    “ gravity”:“ center” ,
    “ text”:“ @ {user.profile.name}” 
  } , { 
    “ type”:“ ProgressBar” ,
    “ width“ :” 200vp“ ,
    ” layout_marginTop“:” 8vp“,
    “ max”:6000 ,
    “ progress”:“ @ {user.profile.experience}” 
  } ] 
}
Sample data
{ 
  “ user”:{ 
    “ profile”:{ 
      “ name”:“ John Doe” ,
      “ experience”:4192 
    } 
  } 
}
Sample Java code
ProteusView view = proteusLayoutInflater.inflate(<layout>, <data>);
container.addView(view.getAsView());
Output
- 
Setting up the Demo App
The demo app will let you play around with proteus as well as help you understand the internals better.
- Install NodeJS here
 - open a terminal
 - cd into the project directory
 - run 
npm start - Start an AVD emulator
 - Install the Demo App
 
Ready to tinker
- Tinker around with the layout and data
 - Hit the FAB to refresh the app.
 
 
测试信息
CodeCheck代码测试无异常
CloudTest代码测试无异常
病毒安全检测通过
当前版本demo功能与原组件基本无差异
版本迭代
- 1.0.0
 
版权和许可信息
Apache v2.0
If you are using proteus check out the can, cannot and mustproteus-master.zip 4.52M 7次下载  
已于2021-12-7 18:00:26修改
 
        赞
        
 
        收藏 
      
 回复
  相关推荐
 



















