Giter Club home page Giter Club logo

shield's Introduction

Shield

PRs Welcome License

概述

Shield是一个模块化UI界面解决方案,它不仅仅是一个Native(Android&iOS)的UI开发框架,而是美团点评到店综合团队基于自身复杂的业务场景沉淀出来的UI开发最佳实践,它不但具备高可复用性,协同开发等特性,还包括后端动态配置,动态模块等一系列解决方案。

接入

在工程的build.gradle文件中添加依赖:

compile 'com.dianping.android.sdk:shieldCore:1.6.0'

设计**

1.模块独立

模块具备完整的页面能力(生命周期,Context等),模块可以在不同的页面中自由组合,模块与页面高度解耦,模块不关心具体在哪个页面中运行。模块之间需要解耦,模块只关心自己涉及的状态和数据。

2.数据驱动

模块的表现只取决于所依赖的数据,而与具体的行为无关。

3.接口

整个模块化框架通过抽象接口进行交互,通过接口规范行为,通过接口的不同实现达到多态的目的

整体框架

一个典型的模块化页面主要由页面和多个模块构成。页面通过模块配置(Config)确定加载哪些模块构成页面。模块又分为业务逻辑(Agent)和视图逻辑部分(SectionCellInterface, 包括 Section 和 Row)。 页面包含两个管理器,模块管理器(AgentManager)和视图管理器(CellManager)。其中模块管理器决定了如何创建,更新,恢复及销毁模块以及如何将模块添加到页面中; 视图管理器则决定了页面使用何种视图容器管理视图以及模块中的视图组件(SectionCellInterface)如何添加到视图容器中。 除此之外,页面还持有一个支持数据订阅和通知的白板(WhiteBoard),用于模块与页面,模块与模块之间的数据交互。

接入

请参照Sample中的com.example.shield.fragments.AgentManagerFragment

另外:

  1. 在onCreateView中构建页面容器ContentView。
  2. 在onActivityCreated方法中调用setAgentContainerView方法设置模块容器。
  3. 在getCellManager方法中指定页面使用何种CellManager(默认为SectionRecyclerCellManager,与RecyclerView容器配合使用)。
  4. 在getAgentManager方法中指定页面使用何种AgentManager(默认为LightAgentManager,一般无需定制)。
  5. 通过generaterDefaultConfigAgentList方法指定模块配置。

博客文章

Shield——开源的移动端页面模块化开发框架

技术支持

  • 通过提交issue来寻求帮助
  • 联系我们寻求帮助

ChangeLog

[2018.3.12]

  • RecyclerView容器支持设置是否可以滚动
  • HeaderCell&FooterCell新增置顶置底支持
  • HeaderCell&FooterCell新增上下分割线完善
  • 优化模块配置方式
  • 优化模块曝光计算逻辑
  • Bug Fix

[2019.1.30]

  • 基于Kotlin的全面重构
  • 新的视图管理器ShieldNodeCellManager
  • 新的生命周期路由ShieldLifeCycler
  • 新的ShieldSectionCellItem视图层表达方式
  • Bugfix

贡献代码

  • 欢迎提交issue
  • 欢迎提交PR

LICENSE

Shield is MIT licensed

shield's People

Contributors

nhsprite avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shield's Issues

maven 地址错误了

    maven {
        url "http://mvn.dianpingoa.com/jcenter"
    }
    maven {
        url "http://depot.sankuai.com/nexus/content/groups/public/"
    }

这是安卓版本的

在博客美团的Shield框架里说了支持iOS的,但是没看到这里iOS的开源哈!

项目还有维护吗?

这个项目还有维护吗?
有几个问题想要问一下:
1.项目文档不是很清晰,源码的相关接口的注释也不是很清晰
2.中台配置有什么格式要求吗,有没有相关的计划?
3.IOS端开源进度有进展吗?

怎么后端动态下发配置?

这个功能在readme中有体现,但是sample代码中没看出来。可以支持后端下发配置实现任意模块显示在任意页面中?这个对数据格式有什么要求?

关于Shield的5点问题

1.Shield实现了数据和配置的分离,但是数据加载部分没写
2.和tangram相比,Shield优势在哪?
3.demo和文档可以写详细点么
4.性能如何,通用性强吗
5.感觉项目做得好粗糙呀,要是注意下代码风格更好
@OverRide
public int getRowCount(int sectionPosition) {
if (sectionPosition == 0)
return 2;
else
return 3;
}

编译失败

Error:Could not list contents of 'files-2.1\org.apache.maven.wagon\wagon-http-shared\1.0-beta-6'.

关于模块内的数据

你好,这边我看了项目中的sample,感觉设计非常棒。但是对于view与数据绑定还是有点疑惑,每个单独的模块对应的数据model是不是也要严格定义好,且后端返回的数据类型也要严格参照view内绑定的数据类型。方便的话,建议可以加上有网络获取数据的例子,这样能够更好的了解到在这方面实际应用 :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.