public abstract class BaseFragment<P extends IPresenter> extends Fragment implements IFragment, FragmentLifecycleable
Fragment 的三方库, 那你就需要自己自定义 @Fragment
继承于这个特定的 @Fragment, 然后再按照 BaseFragment 的格式, 将代码复制过去, 记住一定要实现IFragment| Modifier and Type | Field and Description |
|---|---|
protected android.content.Context |
mContext |
protected P |
mPresenter |
protected java.lang.String |
TAG |
| Constructor and Description |
|---|
BaseFragment() |
| Modifier and Type | Method and Description |
|---|---|
void |
onAttach(android.content.Context context) |
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState) |
void |
onDestroy() |
void |
onDetach() |
Cache<java.lang.String,java.lang.Object> |
provideCache()
提供在
Fragment 生命周期内的缓存容器, 可向此 Fragment 存取一些必要的数据
此缓存容器和 Fragment 的生命周期绑定, 如果 Fragment 在屏幕旋转或者配置更改的情况下
重新创建, 那此缓存容器中的数据也会被清空, 如果你想避免此种情况请使用 LifecycleModel |
<any> |
provideLifecycleSubject() |
boolean |
useEventBus()
是否使用 EventBus
Arms 核心库现在并不会依赖某个 EventBus, 要想使用 EventBus, 还请在项目中自行依赖对应的 EventBus
现在支持两种 EventBus, greenrobot 的 EventBus 和畅销书 《Android源码设计模式解析与实战》的作者 何红辉 所作的 AndroidEventBus
确保依赖后, 将此方法返回 true, Arms 会自动检测您依赖的 EventBus, 并自动注册
这种做法可以让使用者有自行选择三方库的权利, 并且还可以减轻 Arms 的体积
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitData, initView, setData, setupFragmentComponentprotected final java.lang.String TAG
protected android.content.Context mContext
protected P extends IPresenter mPresenter
public Cache<java.lang.String,java.lang.Object> provideCache()
IFragmentFragment 生命周期内的缓存容器, 可向此 Fragment 存取一些必要的数据
此缓存容器和 Fragment 的生命周期绑定, 如果 Fragment 在屏幕旋转或者配置更改的情况下
重新创建, 那此缓存容器中的数据也会被清空, 如果你想避免此种情况请使用 LifecycleModelprovideCache in interface IFragmentLruCachepublic final <any> provideLifecycleSubject()
provideLifecycleSubject in interface Lifecycleable<FragmentEvent>public void onAttach(android.content.Context context)
public android.view.View onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
public void onDestroy()
public void onDetach()
public boolean useEventBus()
useEventBus in interface IFragmenttrue (默认为 true), Arms 会自动注册 EventBus