自动缺省页
模块化依赖
如果自己处理缺省页可跳过本章, Net可以仅仅作为简单的网络框架存在
Net可依赖三方库实现自动缺省页, 以下二选一依赖
- 依赖 StateLayout 
 - 依赖 BRV (因为BRV包含StateLayout) 
 
初始化¶
在Application中初始化缺省页
StateConfig.apply {
    emptyLayout = R.layout.layout_empty
    loadingLayout = R.layout.layout_loading
    errorLayout = R.layout.layout_error
}
创建¶
使用StateLayout包裹的内容即内容(content)
<com.drake.statelayout.StateLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:id="@+id/state"
    android:layout_height="match_parent"
    tools:context=".ui.fragment.StateLayoutFragment">
    <TextView
        android:id="@+id/tv"
        android:padding="32dp"
        android:textStyle="bold"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="内容" />
</com.drake.statelayout.StateLayout>
网络请求¶
- 请求开始, 显示
加载中缺省页 - 请求成功, 显示
内容缺省页 - 请求失败,  显示
错误缺省页 
生命周期¶
| 生命周期 | 描述 | 
|---|---|
| 开始 | showLoading触发onRefresh, 开始请求 | 
| 结束 | 缺省页被销毁, 请求自动取消 |