T_Presenter - The type of the Presenter.public abstract class ViewCompatActivity<T_Presenter extends Presenter> extends AppCompatActivity implements View, PresentedView<T_Presenter>, Scopeable
ViewCompatActivity provides an abstract base class for concrete Activity
implementations that implement View components for a MVP architectural pattern
implementation.| Modifier and Type | Field and Description |
|---|---|
protected ViewBinder |
binder |
protected DependencyScope |
scope |
protected ViewState |
state |
KEY_DEPENDENCY_SCOPE| Modifier | Constructor and Description |
|---|---|
protected |
ViewCompatActivity() |
| Modifier and Type | Method and Description |
|---|---|
<T extends ViewBinding<?>> |
bind(int viewId)
Creates and binds a
ViewBinding to a View specified by the given view id. |
android.widget.AdapterView |
bind(int viewId,
AdapterViewBinding<?> binding,
AdapterViewBinding.Adapter<?> adapter)
Binds the given
AdapterViewBinding to the specified AdapterView. |
<T extends android.view.View> |
bind(int viewId,
ViewBinding<T> binding)
Binds the given
ViewBinding to the specified View. |
boolean |
canCommitFragment() |
abstract T_Presenter |
getPresenter()
Gets the
Presenter assigned for this ViewCompatActivity. |
DependencyScope |
getScope() |
ViewState |
getState()
|
<T extends android.view.View> |
getView(int viewId)
Looks up and returns a
View with the given layout id. |
java.lang.String |
getViewTag()
Get a tag for this
View. |
protected void |
onCreate(android.os.Bundle inState) |
protected void |
onCreateBindings()
Invoked to bind
ViewBindings to Views. |
protected void |
onDestroy() |
protected void |
onPause() |
void |
onRequestPermissionsResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults) |
protected void |
onRestart() |
protected void |
onRestoreDependencies(DependencyMap dependencies)
This method can be overridden to restore dependencies after the
ViewCompatFragment is
restored, for instance, after recreating it. |
void |
onRestoreInstanceState(android.os.Bundle inState) |
protected void |
onRestoreState(android.os.Bundle inState)
This method can be overridden to restore state of this
ViewCompatActivity from the given
Bundle. |
protected void |
onResume() |
protected void |
onSaveDependencies(DependencyMap dependencies)
This method can be overridden to save dependencies after the
ViewCompatFragment is
restored, for instance, after recreating it. |
void |
onSaveInstanceState(android.os.Bundle outState) |
protected void |
onSaveState(android.os.Bundle outState)
This method can be overridden to save state of this
ViewCompatActivity to the given
Bundle. |
protected void |
onStart() |
protected void |
onStop() |
protected T_Presenter |
resolvePresenter()
Resolves the
Presenter assigned for this ViewCompatActivity. |
void |
setScope(DependencyScope scope) |
protected final ViewBinder binder
protected final ViewState state
protected DependencyScope scope
public abstract T_Presenter getPresenter()
Presenter assigned for this ViewCompatActivity.getPresenter in interface PresentedView<T_Presenter extends Presenter>Presenter.public java.lang.String getViewTag()
ViewView.getViewTag in interface ViewString.protected T_Presenter resolvePresenter()
Presenter assigned for this ViewCompatActivity.Presenter.protected void onCreate(android.os.Bundle inState)
protected void onStart()
protected void onResume()
protected void onStop()
protected void onPause()
protected void onDestroy()
protected void onRestart()
public void onSaveInstanceState(android.os.Bundle outState)
protected void onSaveState(android.os.Bundle outState)
ViewCompatActivity to the given
Bundle.outState - A Bundle.public void onRestoreInstanceState(android.os.Bundle inState)
protected void onRestoreState(android.os.Bundle inState)
ViewCompatActivity from the given
Bundle.inState - A Bundle.protected void onSaveDependencies(DependencyMap dependencies)
ViewCompatFragment is
restored, for instance, after recreating it.dependencies - A DependencyMap for saving the dependencies.protected void onRestoreDependencies(DependencyMap dependencies)
ViewCompatFragment is
restored, for instance, after recreating it.dependencies - A DependencyMap for restoring the dependencies.public void onRequestPermissionsResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults)
public boolean canCommitFragment()
protected void onCreateBindings()
ViewBindings to Views. This method has to be overridden in
classes extended from ViewCompatActivity.public <T extends android.view.View> T getView(int viewId)
View with the given layout id.viewId - A view id used in a layout XML resource.View.public <T extends ViewBinding<?>> T bind(int viewId)
ViewBinding to a View specified by the given view id.T - The parametrised type of the ViewDelagate.viewId - A view id used in a layout XML resource.ViewBinding.public <T extends android.view.View> T bind(int viewId,
ViewBinding<T> binding)
ViewBinding to the specified View.viewId - A view id in a layout XML specifying the target View.binding - An ViewBinding.View.public android.widget.AdapterView bind(int viewId,
AdapterViewBinding<?> binding,
AdapterViewBinding.Adapter<?> adapter)
AdapterViewBinding to the specified AdapterView.viewId - A view id in a layout XML specifying the target AdapterView.binding - An AdapterViewBinding.adapter - An AdapterViewBinding.Adapter that is assigned to AdapterViewBinding.AdapterView.public DependencyScope getScope()
public void setScope(DependencyScope scope)