Java 类android.databinding.ObservableMap 实例源码

项目:RxDataBinding    文件:ObservableArrayMapObservable.java   
Listener(final ObservableArrayMap<K, V> observableArrayMap,
    final Observer<? super ObservableArrayMapOnMapChangeEvent<K, V>> observer) {
  this.observableArrayMap = observableArrayMap;
  this.onMapChangedCallback =
      new ObservableMap.OnMapChangedCallback<ObservableArrayMap<K, V>, K, V>() {
        @Override public void onMapChanged(ObservableArrayMap<K, V> observableArrayMap, K key) {
          observer.onNext(ObservableArrayMapOnMapChangeEvent.create(observableArrayMap, key));
        }
      };
}
项目:grooo    文件:ShopViewModel.java   
@BindingAdapter("entries_orders")
public static void entriesBasket(RecyclerView recyclerView, ObservableMap<Food, Integer> orders) {
    if (recyclerView.getAdapter() == null)
        recyclerView.setAdapter(new PayListAdapter(orders));
    else {
        Logs.d("entries_orders调用");
        PayListAdapter adapter = (PayListAdapter) recyclerView.getAdapter();
        adapter.setBasket(orders);
    }
}
项目:grooo    文件:PayListAdapter.java   
public void setBasket(ObservableMap<Food, Integer> orders) {
    foods = new Food[orders.size()];
    numbs = new Integer[orders.size()];
    orders.keySet().toArray(foods);
    orders.values().toArray(numbs);
    notifyDataSetChanged();
}
项目:Cinder    文件:Cinder.java   
private static <K, V> void handleMapChange(ObservableMap<K, V> map, K key, Class c, String field, ArrayMap<K, CinderPair> cinderPairs, CinderObservable observation) {
    if (cinderPairs.get(key) == null) {
        observeMapFieldForClass(c, field, key, map.get(key), cinderPairs, observation);
    } else {
        CinderPair cinderPair = cinderPairs.get(key);
        cinderPair.getObservable().removeOnPropertyChangedCallback(cinderPair.getCallback());
        cinderPairs.remove(key);
        if (map.get(key) != null){
            observeMapFieldForClass(c, field, key, map.get(key), cinderPairs, observation);
        }
    }
}
项目:grooo    文件:PayListAdapter.java   
public PayListAdapter(ObservableMap<Food, Integer> orders) {
    foods = new Food[orders.size()];
    numbs = new Integer[orders.size()];
    orders.keySet().toArray(foods);
    orders.values().toArray(numbs);
}
项目:Cinder    文件:Cinder.java   
public static CinderComputable observable(ObservableMap map){
    CinderComputable computable = new CinderComputable();
    computable.setBehaviour(Cinder.observe(computable::notifyChange, map));
    return computable;
}
项目:Cinder    文件:Cinder.java   
public static CinderComputable observable(ObservableMap map, Class c, String... fields){
    CinderComputable computable = new CinderComputable();
    computable.setBehaviour(Cinder.observe(computable::notifyChange, map, c, fields));
    return computable;
}
项目:Cinder    文件:Cinder.java   
public static <K, V> CinderObservable observe(OnChangeCallback onChangeCallback, ObservableMap<K, V> map) {
    return Cinder.observe(onChangeCallback, map, null);
}
项目:Cinder    文件:CinderMapPair.java   
CinderMapPair(ObservableMap<K,V> observableMap){
    this.observableMap = observableMap;
}
项目:Cinder    文件:CinderMapPair.java   
public void setCallback(ObservableMap.OnMapChangedCallback callback){
    this.callback = callback;
}