Last active
August 29, 2015 14:13
-
-
Save weefbellington/190ad9fb84ea3518c18b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DataBindingComponent<DataType> implements Scene.Component { | |
private final Bindable target; | |
private final Data data; | |
public DataBindingComponent(Data data, Bindable<DataType> target) { | |
this.data = data; | |
this.target = target; | |
} | |
@Override | |
public void afterSetUp(Context context, Scene scene, View view) { | |
target.bind(data) | |
} | |
@Override | |
public void beforeTearDown(Context context, Scene scene, View view) { | |
//do we need to unbind here? | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Bindable<DataType> { | |
public void bind(Data data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment