public class ViewBinder
extends java.lang.Object
ViewBinder
is a component that can be used to establish bindings between View
s
and Presenter
s. It also automagically deploys a concrete implementation of
PresenterDelegate
for a Presenter
interface annotated with OnClick
and
OnTextChanged
annotations.Constructor and Description |
---|
ViewBinder(PresentedView view) |
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. |
<T extends 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 . |
void |
dispose()
Disposes this
ViewBinder by clearing the Binding Cache. |
<T extends ViewBinding> |
getBinding(int viewId)
Gets a
ViewBinding for the specified View . |
protected PresentedView |
getPresentedView() |
<T extends android.view.View> |
getView(int viewId)
Looks up and returns a
View with the given layout id. |
void |
initialise() |
void |
setActivity(android.app.Activity activity) |
void |
setContentView(android.view.ViewGroup contentView) |
public ViewBinder(PresentedView view)
protected PresentedView getPresentedView()
public void setActivity(android.app.Activity activity)
public void setContentView(android.view.ViewGroup contentView)
public void initialise()
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 getBinding(int viewId)
ViewBinding
for the specified View
.viewId
- A view id used in a layout XML resource.View
.public void dispose()
ViewBinder
by clearing the Binding Cache.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 <T extends android.widget.AdapterView> T 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
.