public abstract class GeneralViewModel extends java.lang.Object implements FactoryViewModel
FactoryViewModel.Factory| Modifier and Type | Field and Description |
|---|---|
protected android.app.Activity |
mActivity |
protected GeneralController |
mController |
protected PanFragment |
mFragment |
android.view.View |
mRootView |
| Constructor and Description |
|---|
GeneralViewModel() |
| Modifier and Type | Method and Description |
|---|---|
void |
bindViews() |
android.app.Activity |
getActivity() |
GeneralController |
getController() |
PanFragment |
getFragment() |
LifecycleObserved |
getObserving()
return the observing Activity/Fragment
handy for nesting use of ViewModel
|
android.view.View |
getRootView()
用于在整体绑定事件
|
protected void |
onInit()
在注入了views之后会被调用,允许子类进行一些初始化操作
|
void |
reInit()
允许外部重新初始化控件状态
|
void |
setActivity(android.app.Activity activity) |
void |
setController(GeneralController c) |
void |
setFragment(PanFragment fragment) |
void |
setRootView(android.view.View rootView) |
public transient android.view.View mRootView
protected transient android.app.Activity mActivity
protected transient PanFragment mFragment
protected GeneralController mController
public GeneralController getController()
getController in interface FactoryViewModelpublic void setController(GeneralController c)
setController in interface FactoryViewModelpublic android.app.Activity getActivity()
getActivity in interface FactoryViewModelpublic void setActivity(android.app.Activity activity)
setActivity in interface FactoryViewModelpublic PanFragment getFragment()
getFragment in interface FactoryViewModelpublic LifecycleObserved getObserving()
public void setFragment(PanFragment fragment)
setFragment in interface FactoryViewModelpublic android.view.View getRootView()
getRootView in interface ViewModelpublic void setRootView(android.view.View rootView)
setRootView in interface FactoryViewModelpublic void bindViews()
bindViews in interface FactoryViewModelprotected void onInit()
public void reInit()