Giter Site home page Giter Site logo

xcombine's Introduction

xCombine 介绍:

  • xCombine 是一个 android 的插件框架。
  • xCombine 遵循简单易用,易扩展,约定大于配置的**开发。

框架的约定:

  • 插件分为 容器(Container)模块(Module) 两类(继承自Plugin)。
  • Module 的实现类必须命名为:packageName + ".CustomModule"。
  • Container 随意命名,并在主界面初始化(参考tests/MainContainer)。
  • Container 和 Module 必须使用相同的 android:sharedUserId。

使用方法:

  • 插件之间互通可使用 插件消息MOP(可以叫它面向方法约定编程)
  • 使用 插件消息 时消息遵守接受者的实现约定,适用同步或非同步返回的场景。
  • 使用 MOP 定义一个外部插件实现的方法时,方法名和参数类型与外部插件保持一致,返回值类有多个时变为List,适用同步返回场景。
  • MOP 可用在 Module, Container 和 初始化Container的Activity 中(用法参考tests)。
  • 上面的介绍在tests中有详细的示例,包含插件之间传递对象和View组件的例子。

注意:

  • Module依赖xCombine, 但不要将xCombine编译进Module。

    • MainContainer依赖插件库,编译进源码;
    • 但ModuleTest是运行时依赖,不编译进去,eclipse怎么设置自己百度,我用idea开发依赖设置为provided。
  • 需要在AndroidManifest.xml为主界面Activity添加下面的intent-filter:

<intent-filter>
    <action android:name="android.intent.action.PACKAGE_ADDED"/>
    <action android:name="android.intent.action.PACKAGE_REMOVED"/>
    <data android:scheme="package"/>
</intent-filter>

关于:


xCombine Introduction:

  • xCombine is a plugin framework of android.
  • xCombine comply with the principle: easy, extendable, convention over configuration.

Convention of Framework:

  • Plugins can be divided into Container & Module (extends Plugin)。
  • The impl class of Module must be named:packageName + ".CustomModule"。
  • The impl class of Container can be named casually,and init it in the main Activity.(reference: tests/MainContainer).
  • Container & Module must have the same android:sharedUserId.

Usage:

  • Plugins can communicate with each other by PluginMessage & MOP(Method Oriented Programming).
  • When using PluginMessage, you should comply with the convention of the receiver. It's suitable to sync & non-sync situation.
  • When using MOP define an external method from other Plugin, method name and types of args keep same with the other Plugin. It's suitable to sync.
  • MOP could be used by Module, Container and the main Activity(reference: tests).

Attention:

  • Module dependence on xCombine, but don't compile xCombine code in Module.
  • need add the following intent-filter in AndroidManifest.xml
<intent-filter>
    <action android:name="android.intent.action.PACKAGE_ADDED"/>
    <action android:name="android.intent.action.PACKAGE_REMOVED"/>
    <data android:scheme="package"/>
</intent-filter>

About:

xcombine's People

Contributors

wyouflf avatar

Watchers

James Cloos avatar  avatar

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.