You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ha...@apache.org on 2018/05/14 06:03:37 UTC

[2/5] incubator-weex-site git commit: * [doc] Update android apil

* [doc] Update android apil


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/commit/a6c603ba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/tree/a6c603ba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex-site/diff/a6c603ba

Branch: refs/heads/master
Commit: a6c603bab2a17f22d565594fe517b5396e8641a8
Parents: d6503a1
Author: york.sy <yo...@alibaba-inc.com>
Authored: Thu May 10 20:15:28 2018 +0800
Committer: york.sy <yo...@alibaba-inc.com>
Committed: Thu May 10 20:15:28 2018 +0800

----------------------------------------------------------------------
 source/cn/references/android-apis.md | 288 +++++++++++++++--------------
 source/references/android-apis.md    | 292 +++++++++++++++---------------
 2 files changed, 299 insertions(+), 281 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/a6c603ba/source/cn/references/android-apis.md
----------------------------------------------------------------------
diff --git a/source/cn/references/android-apis.md b/source/cn/references/android-apis.md
index a00b83b..3c24a4f 100644
--- a/source/cn/references/android-apis.md
+++ b/source/cn/references/android-apis.md
@@ -10,100 +10,141 @@ version: 2.1
 
 Weex 初步接入请参考:https://github.com/weexteam/article/issues/25
 
-## WXSDKEngine 是 Weex 对外的总入口。
+## WXSDKEngine
+WXSDKEngine 是 Weex 对外的总入口。
 主要提供了一下功能:
 
-1. 设置相关 Adapter 和获取 adapter。
-2. 注册自定义 module 和 component
-3. 重置 JSFramework
+1. 注册自定义 module 和 component
+1. 设置相关 adapter 和获取 adapter。
 
-## Adapter 介绍
-Weex 为了重用 Native 通用库提供了对应的接口进行设置。
-1. IWXImgLoaderAdapter 图片适配器。
+### 注册自定义 module 和 component
+#### component
+Weex提供多种注册 Component的方式,其中效率最高的为
 
-  Weex 会把需要设置图片的 View 和 URL 透露出来,Native 端需要实现这个接口进行图片下载。 Weex 没有提供图片默认实现。
+    public static boolean registerComponent(IFComponentHolder holder, boolean appendTree, String ... names)
 
-  接口定义如下:
+* holder 为一个抽象工厂,用于创建component,可使用 SimpleComponentHolder 来快速的构建该对象。
+* appendTree 为一个扩展标记位,目前暂无意义。
+* names 表示该 component 在前端代码中名称,可把多个前端组件映射成一个 component 。
 
-  ```java
-  public interface IWXImgLoaderAdapter {
-    void setImage(String url, ImageView view, WXImageQuality quality, WXImageStrategy strategy);
-  }
-  ```
+#### module
+Weex 提供如下注册 Module 的方式:
 
-  `WXImageQuality` 表示图片的质量,`WXImageQuality` 取如下值 `LOW`, `NORMAL`, `HIGH`, `ORIGINAL` 图片质量依次变高。默认为 `LOW`。`WXImageStrategy` 为扩展类,表示了图片是否可以裁剪 (isClipping) 锐化 (isSharpen) 占位符 (placeHolder) 等。
+    public static <T extends WXModule> boolean registerModule(String moduleName, Class<T> moduleClass,boolean global) throws WXException
 
-2. IWXHttpAdapter 网络下载适配器。
+* moduleName 前端代码中module的名称
+* moduleClass module对应的Class,需要提供一个不含参数的构造函数,或使用默认构造函数。
+* global 是否为全局唯一,true 为全局唯一,false 表示和 WXSDKInstance 绑定。
 
-  Weex 自定义了 `WXRequest` 和 `OnHttpListener`,Native 重载接口后可以从 Request 中获取URL,Header 等参数,网络请求完成后可以通过 `OnHttpListener` 进行回调通知。Weex 提供了默认网络请求:`DefaultWXHttpAdapter`, 使用的是 `HttpURLConnection` 进行网络请求。
+### Adapter 介绍
+第三方 App 可能需要实现下述的 Adapter,才能完整的使用Weex的能力。
 
-  接口定义如下:
+#### 图片适配器
+Weex 图片适配器负责根据URL,加载对应的图片,图片适配器分为两种:
+1. 将 URL 对应的图片加载到 View 上
+1. 将 URL 对应的图片加载到 Drawable 对象上。
 
-  ```java
-  public interface IWXHttpAdapter {
-    void sendRequest(WXRequest request, OnHttpListener listener);
-  }
-  ```
+第一种图片适配器是必须实现,第二种图片适配器是可选实现。Weex对于这两种图片适配器均没有默认实现。
 
-  `WXRequest` 定义了网络请求相关的参数,请求方法,请求主体,超时时间。Weex默认超时时间是3000.
+##### IWXImgLoaderAdapter
+Weex 会把需要设置图片的 View 和 URL 透露出来,Native 端需要实现这个接口进行图片下载。
 
-  `OnHttpListener` 定义了网络请求结束后对应方法。定义如下:
+接口定义如下:
 
-  ```java
-  interface OnHttpListener {
-    /**
-    * start request
-    */
-    void onHttpStart();
+    public interface IWXImgLoaderAdapter {
+      void setImage(String url, ImageView view, WXImageQuality quality,WXImageStrategy strategy);
+    }
+  
+* `WXImageQuality` 表示图片的质量,`WXImageQuality` 取如下值 `LOW`, `NORMAL`, `HIGH`, `ORIGINAL` 图片质量依次变高。默认为 `LOW`。
+* `WXImageStrategy` 为扩展类,表示了图片是否可以裁剪 (isClipping) 锐化 (isSharpen) 占位符 (placeHolder) 等。
 
-    /**
-    * headers received
-    */
-    void onHeadersReceived(int statusCode,Map<String,List<String>> headers);
+##### IDrawableLoader 
+Weex 会把需要设置图片的 对象(DrawableTarget) 和 URL 透露出来,Native 端需要实现这个接口进行图片下载。
 
-    /**
-    * post progress
-    * @param uploadProgress
-    */
-    void onHttpUploadProgress(int uploadProgress);
+接入者需要实现DrawableTarget这个类,并实现
+    void setDrawable(String url, DrawableTarget drawableTarget, DrawableStrategy drawableStrategy);
+* `DrawableTarget` 表示待加载的对象,需要是`StaticTarget`或`AnimatedTarget`中的一个。
 
-    /**
-    * response loaded length (bytes), full length should read from headers (content-length)
-    * @param loadedLength
-    */
-    void onHttpResponseProgress(int loadedLength);
+#### IWXHttpAdapter 网络下载适配器
 
-    /**
-    * http response finish
-    * @param response
-    */
-    void onHttpFinish(WXResponse response);
-  }
-  ```
+Weex 自定义了 `WXRequest` 和 `OnHttpListener`,Native 重载接口后可以从 Request 中获取URL,Header 等参数,网络请求完成后可以通过 `OnHttpListener` 进行回调通知。Weex 提供了默认网络请求:`DefaultWXHttpAdapter`, 使用的是 `HttpURLConnection` 进行网络请求。
+
+接口定义如下:
 
-3. IWXUserTrackAdapter Weex 相关性能数据 (首屏加载时间、JS-Native 通信时间、dom 更新时间等) 和其他通用信息 (JSLib 文件大小, Weex SDK 版本号等)。
+    public interface IWXHttpAdapter {
+      void sendRequest(WXRequest request, OnHttpListener listener);
+    }
+
+`WXRequest` 定义了网络请求相关的参数,请求方法,请求主体,超时时间。Weex默认超时时间是3000.
+
+`OnHttpListener` 定义了网络请求结束后对应方法。定义如下:
+
+    interface OnHttpListener {
+      /**
+      * start request
+      */
+      void onHttpStart();
+
+      /**
+      * headers received
+      */
+      void onHeadersReceived(int statusCode,Map<String,List<String>> headers);
+
+      /**
+      * post progress
+      * @param uploadProgress
+      */
+      void onHttpUploadProgress(int uploadProgress);
+
+      /**
+      * response loaded length (bytes), full length should read from headers (content-length)
+      * @param loadedLength
+      */
+      void onHttpResponseProgress(int loadedLength);
+
+      /**
+      * http response finish
+      * @param response
+      */
+      void onHttpFinish(WXResponse response);
+    }
 
-  接口定义:
+#### IWXUserTrackAdapter 埋点适配器
 
-  ```java
-  public interface IWXUserTrackAdapter {
-    void commit(Context context, String eventId, String type, WXPerformance perf, Map<String, Serializable> params);
-  }
-  ```
-  Native 实现接口后可以通过 `WXPerformance` 和 `params` 获取对应的信息。
-  WXPerformane 对应字段表示含义请参考文档:https://github.com/weexteam/article/issues/124
+接口定义:
+
+    public interface IWXUserTrackAdapter {
+      void commit(Context context, String eventId, String type, WXPerformance perf, Map<String, Serializable> params);
+    }
 
-  后续随着开发 Weex 还会定义更多的 Adapter,此文档也会定时更新。
+* Native 实现接口后可以通过 `WXPerformance` 和 `params` 获取对应的信息。
+* WXPerformane 对应字段表示含义请参考文档:https://github.com/weexteam/article/issues/124
 
-## Native 和 JS 通信
+后续随着开发 Weex 还会定义更多的 Adapter,此文档也会定时更新。
 
-1. 自定义事件通知
+#### IActivityNavBarSetter Weex导航适配器
+
+Weex 提供了 `WXNavigatorModule` 进行导航控制,对应的方法可以通过设置 `IActivityNavBarSetter` 接口进行定制。
+
+使用方法:
 
-  多用于某个自定义控件进行事件通知,例如自定义点击事件,响应下拉事件等。
+    WXSDKEngine.setActivityNavBarSetter(new IActivityNavBarSetter(){});
+
+#### IWXStorageAdapter
+Weex提供了`WXStorageModule`将一些数据存储到本地,WXStorageModule依赖`IWXStorageAdapter`来操作本地存储系统。 Weex提供了一个默认的实现,DefaultWXStorage。
+
+#### IWXJSExceptionAdapter
+Weex依赖`IWXJSExceptionAdapter`来实现JavaScript异常的处理,默认行为是忽略JavaScript异常。
+
+## WXSDKInstance
+
+### Weex 中 Native 和 JS 通信
+
+#### 自定义事件通知
+多用于某个自定义控件进行事件通知,例如自定义点击事件,响应下拉事件等。
 
   WXSDKInstance.java
 
-  ```java
     public void fireEvent(String elementRef,final String type, final Map<String, Object> data,final Map<String, Object> domChanges){  }
 
     public void fireEvent(String elementRef,final String type, final Map<String, Object> data){
@@ -113,21 +154,15 @@ Weex 为了重用 Native 通用库提供了对应的接口进行设置。
     public void fireEvent(String elementRef, String type){
       fireEvent(ref,type,new HashMap<String, Object>());
     }
-  ```
-
-  `elementRef`:事件发生的控件 ID。
-
-  `type`: 自定义事件,Weex 默认以 onXxxxx 开头为自定义事件。onPullDown (下拉事件)。
-
-  `data`: 需要透出的参数,例如当前控件的大小,坐标等其他信息。
-
-  `domChanges`:更新 ref 对应控件的 Attribute 和 Style。
 
-2. 事件回调
+* `elementRef`:事件发生的控件 ID。
+* `type`: 自定义事件,Weex 默认以 onXxxxx 开头为自定义事件。onPullDown (下拉事件)。
+* `data`: 需要透出的参数,例如当前控件的大小,坐标等其他信息。
+* `domChanges`:更新 ref 对应控件的 Attribute 和 Style。
 
-  多用于 Module 回调,例如定位 Module 完成后需要通知 JS。使用方法如下:
+#### 事件回调
+多用于 Module 回调,例如定位 Module 完成后需要通知 JS。使用方法如下:
 
-  ```java
   public class WXLocation extends WXModule {
 
     @JSMethod
@@ -143,60 +178,47 @@ Weex 为了重用 Native 通用库提供了对应的接口进行设置。
 
       //invoke方法和invokeAndKeepAlive两个方法二选一
     }
-  }
-  ```
 
-## 注册滑动事件
+### Weex 和其他 Native 组件通讯
+
+#### 注册滑动事件
 
 Weex 获取滑动事件可以通过 `WXSDKInstance` 注册 `registerOnWXScrollListener` 监听
 
 接口定义如下:
 
-```java
-public interface OnWXScrollListener {
-
-  /**
-   * The  view is not currently scrolling.
-   */
-  int IDLE = RecyclerView.SCROLL_STATE_IDLE;
-  /**
-   * The view is currently being dragged by outside input such as user touch input.
-   */
-  int DRAGGING = RecyclerView.SCROLL_STATE_DRAGGING;
-  /**
-   * The view is currently animating to a final position while not under
-   * outside control.
-   */
-  int SETTLING = RecyclerView.SCROLL_STATE_SETTLING;
-
-  /**
-   * Callback method to be invoked when the view has been scrolled. This will be
-   * called after the scroll has completed.
-   * <p>
-   * This callback will also be called if visible item range changes after a layout
-   * calculation. In that case, dx and dy will be 0.
-   *
-   */
-  void onScrolled(View view, int x, int y);
-
-  /**
-   * Callback method to be invoked when view's scroll state changes.
-   *
-   */
-  void onScrollStateChanged(View view, int x, int y, int newState);
-}
-```
-
-## 自定义NavBar
-
-Weex 提供了 `WXNavigatorModule` 进行导航控制,对应的方法可以通过设置 `IActivityNavBarSetter` 接口进行定制。
-
-使用方法:
-
-```java
-WXSDKEngine.setActivityNavBarSetter(new IActivityNavBarSetter(){
-});
-```
+    public interface OnWXScrollListener {
+
+      /**
+      * The  view is not currently scrolling.
+      */
+      int IDLE = RecyclerView.SCROLL_STATE_IDLE;
+      /**
+      * The view is currently being dragged by outside input such as user touch input.
+      */
+      int DRAGGING = RecyclerView.SCROLL_STATE_DRAGGING;
+      /**
+       * The view is currently animating to a final position while not under
+       * outside control.
+       */
+      int SETTLING = RecyclerView.SCROLL_STATE_SETTLING;
+
+     /**
+       * Callback method to be invoked when the view has been scrolled. This will be
+       * called after the scroll has completed.
+       * <p>
+       * This callback will also be called if visible item range changes after a layout
+       * calculation. In that case, dx and dy will be 0.
+       *
+       */
+      void onScrolled(View view, int x, int y);
+
+      /**
+       * Callback method to be invoked when view's scroll state changes.
+       *
+       */
+      void onScrollStateChanged(View view, int x, int y, int newState);
+    }
 
 ## 其他介绍
 ### 动态适配容器
@@ -204,14 +226,12 @@ WXSDKEngine.setActivityNavBarSetter(new IActivityNavBarSetter(){
 因为 Android 手机的碎片化导致屏幕适配很困难。Weex 对外提供的接口 render 需要动态传入容器的宽高,但是传入的宽高有时会发生变化,例如 ActionBar 隐藏等,这是传入的 Weex 容器也要进行对应的变化。
 为了适应这种变化,Weex 提供了接口 `WXSDKInstance.setSize(int width, int height)` 来改变容器的大小。
 
-```java
-/**
-   *
-   * @param width 容器宽度
-   * @param height 容器高度
-   */
-  public void setSize(int width, int height){};
-```
+    /**
+       *
+       * @param width 容器宽度
+       * @param height 容器高度
+       */
+    public void setSize(int width, int height){};
 
 ### 降级使用
 

http://git-wip-us.apache.org/repos/asf/incubator-weex-site/blob/a6c603ba/source/references/android-apis.md
----------------------------------------------------------------------
diff --git a/source/references/android-apis.md b/source/references/android-apis.md
index 44d1fe2..e262b39 100644
--- a/source/references/android-apis.md
+++ b/source/references/android-apis.md
@@ -10,203 +10,201 @@ version: 2.1
 
 ## WXSDKEngine
 
+1. Register the module and component
 1. Set up various adapters
 
-```java
-WXSDKEngine.initialize(this, new InitConfig.Builder().setImgAdapter(new ImageAdapter()).setDebugAdapter(new PlayDebugAdapter()).build());
-```
+### Module & Component
+#### Component
+One can register a component using the following function:
 
-2. Register the module and component
+    public static boolean registerComponent(IFComponentHolder holder, boolean appendTree, String ... names)
 
-```java
-WXSDKEngine.registerComponent("richtext", RichText.class);
-WXSDKEngine.registerModule("event", WXEventModule.class);
-```
-3. Overloading framework
+* holder is a abstract factory designed for create Component, and SimpleComponentHolder is the a simple way to achieve IFComponentHolder.
+* appendTree is an additional flag which is unused now.
+* names is the component's name in front end template file. A Android component could be mapped into multiple names.
 
-```java
-WXSDKEngine.reload(this,framework,false);
-```
+#### Module
+One can register a module using the following way:
 
-## Adapter
+    public static <T extends WXModule> boolean registerModule(String moduleName, Class<T> moduleClass,boolean global) throws WXException
 
-1. IWXImgLoaderAdapter
+* moduleName is the name in front end template.
+* moduleClass is the Java class of the module, which provide a constructor with an empty parameter.
+* global is a flag, true for singleton in the whole app, false for creating an object for each WXSDKIntance.
 
-  Weex need to implement this interface to download the picture
-  The interface is defined as follows:
+### Adapter
+#### ImageAdapter
+Image adapter is responsible for loading images according to URLs. There are two types of image adapter:
+1. Loading a image to a view according to URL.
+1. Loading a image to a specified object according to URL.
 
-  ```java
-  public interface IWXImgLoaderAdapter {
+In order to use image component, one must implement the first adapter, while the second adapter is optional.
 
-    void setImage(String url, ImageView view, WXImageQuality quality, WXImageStrategy strategy);
-  }
-  ```
+##### IWXImgLoaderAdapter
 
-  `WXImageQuality` that the quality of the picture variables, take the following values `LOW`, `NORMAL`, `HIGH`, `ORIGINAL` picture quality in turn higher. The default is `LOW`.
+    public interface IWXImgLoaderAdapter {
+      void setImage(String url, ImageView view, WXImageQuality quality, WXImageStrategy strategy);
+    }
 
-  `WXImageStrategy` is an extension class that indicates whether the image can be cut (isClipping) sharpening (isSharpen) placeholder (placeHolder) and so on.
+ * `WXImageQuality` that the quality of the picture variables, take the following values `LOW`, `NORMAL`, `HIGH`, `ORIGINAL` picture quality in turn higher. The default is `LOW`.
+ * `WXImageStrategy` is an extension class that indicates whether the image can be cut (isClipping) sharpening (isSharpen) placeholder (placeHolder) and so on.
 
-2. IWXHttpAdapter
+##### IDrawableLoaderAdapter
+This adapter is optional.
 
-  Weex custom `WXRequest` and `OnHttpListener`, Native reload interface can be obtained from the Request URL, Header and other parameters, the network request can be completed through `OnHttpListener` callback notification. Weex provides the default network request: `DefaultWXHttpAdapter`, using `HttpURLConnection` for network requests.
+    void setDrawable(String url, DrawableTarget drawableTarget, DrawableStrategy drawableStrategy);
 
-  The interface is defined as follows:
+*  `DrawableTarget` is a object into where will load an image. `DrawableTarget` is one of `StaticTarget` or `AnimatedTarget`.
 
-  ```java
-  public interface IWXHttpAdapter {
-    void sendRequest(WXRequest request, OnHttpListener listener);
-  }
-  ```
+#### IWXHttpAdapter
 
-  `WXRequest` defines the parameters related to the network request, the request method, the request body, and the timeout time. Weex default timeout is 3000.
+Weex custom `WXRequest` and `OnHttpListener`, Native reload interface can be obtained from the Request URL, Header and other parameters, the network request can be completed through `OnHttpListener` callback notification. Weex provides the default network request: `DefaultWXHttpAdapter`, using `HttpURLConnection` for network requests.
 
-  `OnHttpListener` defines the corresponding method after the network request ends. Defined as follows:
+The interface is defined as follows:
 
-  ```java
-  interface OnHttpListener {
+    public interface IWXHttpAdapter {
+      void sendRequest(WXRequest request, OnHttpListener listener);
+    }
 
-      /**
-      * start request
-      */
-      void onHttpStart();
+* `WXRequest` defines the parameters related to the network request, the request method, the request body, and the timeout time. Weex default timeout is 3000.
 
-      /**
-      * headers received
-      */
-      void onHeadersReceived(int statusCode,Map<String,List<String>> headers);
+* `OnHttpListener` defines the corresponding method after the network request ends. Defined as follows:
 
-      /**
-      * post progress
-      * @param uploadProgress
-      */
-      void onHttpUploadProgress(int uploadProgress);
+      interface OnHttpListener {
 
-      /**
-      * response loaded length (bytes), full length should read from headers (content-length)
-      * @param loadedLength
-      */
-      void onHttpResponseProgress(int loadedLength);
+        /**
+        * start request
+        */
+        void onHttpStart();
 
-      /**
-      * http response finish
-      * @param response
-      */
-      void onHttpFinish(WXResponse response);
+        /**
+        * headers received
+        */
+        void onHeadersReceived(int statusCode,Map<String,List<String>> headers);
+
+        /**
+        * post progress
+        * @param uploadProgress
+        */
+        void onHttpUploadProgress(int uploadProgress);
+
+        /**
+        * response loaded length (bytes), full length should read from headers (content-length)
+        * @param loadedLength
+        */
+        void onHttpResponseProgress(int loadedLength);
+
+        /**
+        * http response finish
+        * @param response
+        */
+        void onHttpFinish(WXResponse response);
+      }
+
+#### IWXUserTrackAdapter
+Weex related performance data (first screen loading time, JS-Native communication time, dom update time, etc.) and other general information (JSLib file size, Weex SDK version number, etc.).
+
+    public interface IWXUserTrackAdapter {
+      void commit(Context context, String eventId, String type, WXPerformance perf, Map<String, Serializable> params);
     }
-  ```
-3. IWXUserTrackAdapter
 
-  Weex related performance data (first screen loading time, JS-Native communication time, dom update time, etc.) and other general information (JSLib file size, Weex SDK version number, etc.).
-  Interface definition:
+Native implementation interface can be obtained through `WXPerformance` and `params` corresponding information.
+
+#### IActivityNavBarSetter
+Weex provided the ability of navigation through `WXNavigatorModule` which relys on IActivityNavBarSetter.
 
+Usage:
 
-  ```java
-  public interface IWXUserTrackAdapter {
-    void commit(Context context, String eventId, String type, WXPerformance perf, Map<String, Serializable> params);
-  }
-  ```
+    WXSDKEngine.setActivityNavBarSetter(new IActivityNavBarSetter(){});    
 
-  Native implementation interface can be obtained through `WXPerformance` and `params` corresponding information.
+#### IWXStorageAdapter
+Weex provided the ability of local storage through `WXStorageModule` which depends on IWXStorageAdapter. One can use `DefaultWXStorage` as the default implementation of IWXStorageAdapter.
 
-## Native interacts with JavaScript
 
-### Custom events
+#### IWXJSExceptionAdapter
+IWXJSExceptionAdapter is used to handle JavaScript exception.
 
+## WXSDKInstace
+### Weex Native and JavaScript communication.
+
+#### Custom events
 Used for a custom control for event notifications, such as custom click events, response drop events, and so on.
 
 `WXSDKInstance.java `
 
-```java
-  public void fireEvent(String elementRef,final String type, final Map<String, Object> data,final Map<String, Object> domChanges){  }
+    public void fireEvent(String elementRef,final String type, final Map<String, Object> data,final Map<String, Object> domChanges){  }
 
-  public void fireEvent(String elementRef,final String type, final Map<String, Object> data){
-    fireEvent(elementRef,type,data,null);
-  }
+    public void fireEvent(String elementRef,final String type, final Map<String, Object> data){
+      fireEvent(elementRef,type,data,null);
+    }
 
-  public void fireEvent(String elementRef, String type){
-    fireEvent(ref,type,new HashMap<String, Object>());
-  }
-```
+    public void fireEvent(String elementRef, String type){
+      fireEvent(ref,type,new HashMap<String, Object>());
+    }
 
-`elementRef`:The event occurred for the control ID。
+* `elementRef`:The event occurred for the control ID。
 
-`type`: Custom events, Weex defaults to a custom event starting with onXxxxx. OnPullDown (drop-down event)
+* `type`: Custom events, Weex defaults to a custom event starting with onXxxxx. OnPullDown (drop-down event)
 
-`data`: Need to reveal the parameters, such as the current control of the size, coordinates and other information。
+* `data`: Need to reveal the parameters, such as the current control of the size, coordinates and other information。
 
-`domChanges`:Update ref for the control's Attribute and Style
+* `domChanges`:Update ref for the control's Attribute and Style
 
-## Event callback
+#### Event callback
 Used for Module callback, for example, after the completion of positioning Module need to notify JS. Use as follows:
 
-```java
-public class WXLocation extends WXModule {
+    public class WXLocation extends WXModule {
+
+      @JSMethod
+      public void getLocation(JSCallback callback){
+      //Get the code for the location information .....
+      Map<String,String> data=new HashMap<>();
+      data.put("x","x");
+      data.put("y","y");
+      //notify once
+      callback.invoke(data);
+      //Continuous connection
+      callback.invokeAndKeepAlive(data);
+      //Invoke method and invokeAndKeepAlive two methods of choice  }
+    }
 
-  @JSMethod
-  public void getLocation(JSCallback callback){
-    //Get the code for the location information .....
-    Map<String,String> data=new HashMap<>();
-    data.put("x","x");
-    data.put("y","y");
-    //notify once
-    callback.invoke(data);
-    //Continuous connection
-    callback.invokeAndKeepAlive(data);
+### Weex Native and other Native code communication
+#### OnWXScrollListener
+Weex gets the scroll event You can register `registerOnWXScrollListener` via `WXSDKInstance`
+The interface is defined as follows:
 
-    //Invoke method and invokeAndKeepAlive two methods of choice  }
-}
-```
+    public interface OnWXScrollListener {
 
-# OnWXScrollListener
+      /**
+      * The  view is not currently scrolling.
+      */
+      int IDLE = RecyclerView.SCROLL_STATE_IDLE;
+      /**
+      * The view is currently being dragged by outside input such as user touch input.
+      */
+      int DRAGGING = RecyclerView.SCROLL_STATE_DRAGGING;
+      /**
+      * The view is currently animating to a final position while not under
+      * outside control.
+      */
+      int SETTLING = RecyclerView.SCROLL_STATE_SETTLING;
 
-Weex gets the scroll event You can register `registerOnWXScrollListener` via `WXSDKInstance`
-The interface is defined as follows:
+      /**
+      * Callback method to be invoked when the view has been scrolled. This will be
+      * called after the scroll has completed.
+      * <p>
+      * This callback will also be called if visible item range changes after a layout
+      * calculation. In that case, dx and dy will be 0.
+      *
+      */
+      void onScrolled(View view, int x, int y);
 
-```java
-public interface OnWXScrollListener {
-
-  /**
-   * The  view is not currently scrolling.
-   */
-  int IDLE = RecyclerView.SCROLL_STATE_IDLE;
-  /**
-   * The view is currently being dragged by outside input such as user touch input.
-   */
-  int DRAGGING = RecyclerView.SCROLL_STATE_DRAGGING;
-  /**
-   * The view is currently animating to a final position while not under
-   * outside control.
-   */
-  int SETTLING = RecyclerView.SCROLL_STATE_SETTLING;
-
-  /**
-   * Callback method to be invoked when the view has been scrolled. This will be
-   * called after the scroll has completed.
-   * <p>
-   * This callback will also be called if visible item range changes after a layout
-   * calculation. In that case, dx and dy will be 0.
-   *
-   */
-  void onScrolled(View view, int x, int y);
-
-  /**
-   * Callback method to be invoked when view's scroll state changes.
-   *
-   */
-  void onScrollStateChanged(View view, int x, int y, int newState);
-}
-```
-
-## IActivityNavBarSetter
-
-Weex provides `WXNavigatorModule` for navigation control, and the corresponding method can be customized by setting the `IActivityNavBarSetter` interface.
-
-Instructions:
-
-```java
- WXSDKEngine.setActivityNavBarSetter(new IActivityNavBarSetter(){
-});
-```
+      /**
+      * Callback method to be invoked when view's scroll state changes.
+      *
+      */
+      void onScrollStateChanged(View view, int x, int y, int newState);
+    }
 
 ## Other Introduction
 ### setSize