Created
April 25, 2012 14:09
-
-
Save firexel/2489970 to your computer and use it in GitHub Desktop.
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
public class NewCallbackClient implements SimpleDispatcher.Listener { | |
public void onItemSetChanged(SimpleDispatcher dispatcher) { | |
System.out.println("onItemSetChanged"); | |
} | |
public void onItemDataChanged(SimpleDispatcher dispatcher, int itemId, int changeMask) { | |
if ((changeMask & Item.FIELD_1) != 0) { | |
System.out.println("onItemDataChanged: " + dispatcher.getItemById(itemId)); | |
} | |
} | |
} | |
class SimpleDispatcher { | |
private SparseArray<Item> array = new SparseArray<Item>(); | |
public Item getItemById(int id) { | |
return array.get(id); | |
} | |
public Collection<Item> enumItems() { | |
... | |
} | |
public interface Listener { | |
void onItemSetChanged(SimpleDispatcher dispatcher); | |
void onItemDataChanged(SimpleDispatcher dispatcher, int itemId, int changeMask); | |
} | |
} | |
class Item { | |
public static final int FIELD_1 = 1, FIELD_2 = 2, FIELD_3 = 4; | |
int field1, field2; | |
String field3; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment