Created
March 14, 2017 16:41
-
-
Save toori67/11db8878568fc6eb9df2ccba3c017b20 to your computer and use it in GitHub Desktop.
android mvvm
This file contains 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
interface ICommand { | |
String getKey(); | |
void onChange(Map<String, Object> props); | |
} | |
class NotifyTextView extends TextView implements ICommand { | |
... | |
@Override | |
public String getKey() { | |
return "topic"; | |
} | |
@Override | |
public void onChange(Map<String, Object> props) { | |
setText((String) props.get("topic")) | |
} | |
} | |
class Presenter { | |
Map<String, List<ICommand>> keyViewMap; | |
public onTopicChange(Map<String, Object> props) { | |
... | |
for command : keyViewMap.get("topic") { | |
command.onChange(props); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment