當前位置: 首頁>>代碼示例>>Java>>正文


Java ObservableList.OnListChangedCallback方法代碼示例

本文整理匯總了Java中android.databinding.ObservableList.OnListChangedCallback方法的典型用法代碼示例。如果您正苦於以下問題:Java ObservableList.OnListChangedCallback方法的具體用法?Java ObservableList.OnListChangedCallback怎麽用?Java ObservableList.OnListChangedCallback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.databinding.ObservableList的用法示例。


在下文中一共展示了ObservableList.OnListChangedCallback方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: FileAdapter

import android.databinding.ObservableList; //導入方法依賴的package包/類
public FileAdapter() {
    mOnListChangedCallback = new ObservableList
            .OnListChangedCallback<ObservableList<Layer>>() {
        @Override
        public void onChanged(ObservableList<Layer> layers) {

        }

        @Override
        public void onItemRangeChanged(ObservableList<Layer> layers, int i, int i1) {

        }

        @Override
        public void onItemRangeInserted(ObservableList<Layer> layers, int start, int
                count) {
            notifyItemRangeInserted(start, count);
        }

        @Override
        public void onItemRangeMoved(ObservableList<Layer> sender, int fromPosition, int
                toPosition, int itemCount) {

        }

        @Override
        public void onItemRangeRemoved(ObservableList<Layer> sender, int positionStart,
                                       int itemCount) {

        }
    };
}
 
開發者ID:google,項目名稱:spline,代碼行數:33,代碼來源:ListFragment.java

示例2: createRef

import android.databinding.ObservableList; //導入方法依賴的package包/類
static <T, A extends MvvmAdapter<T>> AdapterWRef<T, A> createRef(A adapter, ObservableList<T> items, ObservableList.OnListChangedCallback<ObservableList<T>> callback) {
    if (thread == null || !thread.isAlive()) {
        thread = new PollReferenceThread();
        thread.start();
    }
    return new AdapterWRef<>(adapter, items, callback);
}
 
開發者ID:zxmmmmmm,項目名稱:Mvvm,代碼行數:8,代碼來源:MvvmAdapter.java

示例3: Listener

import android.databinding.ObservableList; //導入方法依賴的package包/類
Listener(final ObservableArrayList<T> observableArrayList,
    final Observer<? super ObservableArrayListItemRangeChangeEvent<T>> observer) {
  this.observableArrayList = observableArrayList;
  this.onListChangedCallback =
      new ObservableList.OnListChangedCallback<ObservableArrayList<T>>() {
        @Override public void onChanged(ObservableArrayList<T> observableArrayList) {
        }

        @Override
        public void onItemRangeChanged(ObservableArrayList<T> observableArrayList,
            int positionStart, int itemCount) {
          observer.onNext(
              ObservableArrayListItemRangeChangeEvent.create(observableArrayList, positionStart,
                  itemCount));
        }

        @Override
        public void onItemRangeInserted(ObservableArrayList<T> observableArrayList,
            int positionStart, int itemCount) {
        }

        @Override
        public void onItemRangeMoved(ObservableArrayList<T> observableArrayList,
            int positionStart, int positionEnd, int itemCount) {
        }

        @Override
        public void onItemRangeRemoved(ObservableArrayList<T> observableArrayList,
            int positionStart, int itemCount) {
        }
      };
}
 
開發者ID:oldergod,項目名稱:RxDataBinding,代碼行數:33,代碼來源:ObservableArrayListItemRangeChangeEventObservable.java

示例4: Listener

import android.databinding.ObservableList; //導入方法依賴的package包/類
Listener(final ObservableArrayList<T> observableArrayList,
    final Observer<? super ObservableArrayListItemRangeInsertionEvent<T>> observer) {
  this.observableArrayList = observableArrayList;
  this.onListChangedCallback =
      new ObservableList.OnListChangedCallback<ObservableArrayList<T>>() {
        @Override public void onChanged(ObservableArrayList<T> observableArrayList) {
        }

        @Override
        public void onItemRangeChanged(ObservableArrayList<T> observableArrayList,
            int positionStart, int itemCount) {
        }

        @Override
        public void onItemRangeInserted(ObservableArrayList<T> observableArrayList,
            int positionStart, int itemCount) {
          observer.onNext(ObservableArrayListItemRangeInsertionEvent.create(observableArrayList,
              positionStart, itemCount));
        }

        @Override
        public void onItemRangeMoved(ObservableArrayList<T> observableArrayList,
            int positionStart, int positionEnd, int itemCount) {
        }

        @Override
        public void onItemRangeRemoved(ObservableArrayList<T> observableArrayList,
            int positionStart, int itemCount) {
        }
      };
}
 
開發者ID:oldergod,項目名稱:RxDataBinding,代碼行數:32,代碼來源:ObservableArrayListItemRangeInsertionEventObservable.java

示例5: Listener

import android.databinding.ObservableList; //導入方法依賴的package包/類
Listener(final ObservableArrayList<T> observableArrayList,
    final Observer<? super ObservableArrayListItemRangeRemovalEvent<T>> observer) {
  this.observableArrayList = observableArrayList;
  this.onListChangedCallback =
      new ObservableList.OnListChangedCallback<ObservableArrayList<T>>() {
        @Override public void onChanged(ObservableArrayList<T> observableArrayList) {
        }

        @Override
        public void onItemRangeChanged(ObservableArrayList<T> observableArrayList,
            int positionStart, int itemCount) {
        }

        @Override
        public void onItemRangeInserted(ObservableArrayList<T> observableArrayList,
            int positionStart, int itemCount) {
        }

        @Override
        public void onItemRangeMoved(ObservableArrayList<T> observableArrayList,
            int positionStart, int positionEnd, int itemCount) {
        }

        @Override
        public void onItemRangeRemoved(ObservableArrayList<T> observableArrayList,
            int positionStart, int itemCount) {
          observer.onNext(ObservableArrayListItemRangeRemovalEvent.create(observableArrayList,
              positionStart, itemCount));
        }
      };
}
 
開發者ID:oldergod,項目名稱:RxDataBinding,代碼行數:32,代碼來源:ObservableArrayListItemRangeRemovalEventObservable.java

示例6: onAttachedToRecyclerView

import android.databinding.ObservableList; //導入方法依賴的package包/類
@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
    super.onAttachedToRecyclerView(recyclerView);
    callback = new ObservableList.OnListChangedCallback<ObservableList<I>>() {
        @Override
        public void onChanged(ObservableList<I> sender) {
            notifyDataSetChanged();
        }

        @Override
        public void onItemRangeChanged(ObservableList<I> sender, int positionStart, int itemCount) {
            notifyItemRangeChanged(positionStart, itemCount);
        }

        @Override
        public void onItemRangeInserted(ObservableList<I> sender, int positionStart, int itemCount) {
            notifyItemRangeInserted(positionStart, itemCount);
        }

        @Override
        public void onItemRangeMoved(ObservableList<I> sender, int fromPosition, int toPosition, int itemCount) {
            notifyItemMoved(fromPosition, toPosition);
        }

        @Override
        public void onItemRangeRemoved(ObservableList<I> sender, int positionStart, int itemCount) {
            notifyItemRangeRemoved(positionStart, itemCount);
        }
    };
    observableList.addOnListChangedCallback(callback);
}
 
開發者ID:chuross,項目名稱:recyclerview-adapters,代碼行數:32,代碼來源:BindingItemAdapter.java

示例7: ObservableAdapter

import android.databinding.ObservableList; //導入方法依賴的package包/類
public ObservableAdapter() {
    super();

    //this.setHasStableIds(true);

    this.selectionCallback = new ObservableList.OnListChangedCallback<ObservableList>(){
        @Override
        public void onChanged(ObservableList sender) {
            notifySelectedItems();
        }

        @Override
        public void onItemRangeChanged(ObservableList sender, int positionStart, int itemCount) {
            notifySelectedItems();
        }

        @Override
        public void onItemRangeInserted(ObservableList sender, int positionStart, int itemCount) {
            notifySelectedItems();
        }

        @Override
        public void onItemRangeMoved(ObservableList sender, int fromPosition, int toPosition, int itemCount) {
            notifySelectedItems();
        }

        @Override
        public void onItemRangeRemoved(ObservableList sender, int positionStart, int itemCount) {
            notifySelectedItems();
        }
    };

    this.callback = new ObservableList.OnListChangedCallback<ObservableList>() {
        @Override
        public void onChanged(ObservableList ts) {
            notifyDataSetChanged();
        }

        @Override
        public void onItemRangeChanged(ObservableList ts, int i, int i1) {
            notifyItemRangeChanged(i,i1);
        }

        @Override
        public void onItemRangeInserted(ObservableList ts, int i, int i1) {
            notifyItemRangeInserted(i,i1);
        }

        @Override
        public void onItemRangeMoved(ObservableList ts, int i, int i1, int i2) {
            notifyDataSetChanged();
        }

        @Override
        public void onItemRangeRemoved(ObservableList ts, int i, int i1) {
            //notifyItemRangeRemoved(i,i1);
            notifyDataSetChanged();
        }
    };

    if(selectedItems!=null){
        setupSelectionCallback();
    }
}
 
開發者ID:neurospeech,項目名稱:ui-atoms-android,代碼行數:65,代碼來源:AtomListView.java

示例8: init

import android.databinding.ObservableList; //導入方法依賴的package包/類
public void init(Context context) {
    DisplayMetrics metrics = context.getResources().getDisplayMetrics();
    mDensity = metrics.density;

    ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mLongPressTimeout = vc.getLongPressTimeout();

    mScroller = new OverScroller(context);

    mTouchRadius = TOUCH_RADIUS_DP * mDensity;
    mEditCtrlStrokeWidth = EDIT_CTRL_STROKE_DP * mDensity;
    mEditColor = getResources().getColor(R.color.colorAccent, context.getTheme());

    mOnListChangedCallback = new ObservableList
            .OnListChangedCallback<ObservableList<Layer>>() {
        @Override
        public void onChanged(ObservableList<Layer> layers) {
            invalidate();
        }

        @Override
        public void onItemRangeChanged(ObservableList<Layer> layers, int i, int i1) {
            invalidate();
        }

        @Override
        public void onItemRangeInserted(ObservableList<Layer> layers, int start, int count) {
            invalidate();
            addPropertyChangedCallbacks(layers, start, start + count);
        }

        @Override
        public void onItemRangeMoved(ObservableList<Layer> layers, int i, int i1, int i2) {
            invalidate();
        }

        @Override
        public void onItemRangeRemoved(ObservableList<Layer> layers, int i, int i1) {
            invalidate();
        }
    };

    mOnPropertyChangedCallback = new Observable.OnPropertyChangedCallback() {
        @Override
        public void onPropertyChanged(Observable observable, int i) {
            invalidate();
        }
    };
}
 
開發者ID:google,項目名稱:spline,代碼行數:51,代碼來源:DocumentView.java

示例9: LayerListAdapter

import android.databinding.ObservableList; //導入方法依賴的package包/類
public LayerListAdapter() {

        mOnListChangedCallback = new ObservableList
                .OnListChangedCallback<ObservableList<Layer>>() {
            @Override
            public void onChanged(ObservableList<Layer> layers) {

            }

            @Override
            public void onItemRangeChanged(ObservableList<Layer> layers, int i, int i1) {

            }

            @Override
            public void onItemRangeInserted(ObservableList<Layer> layers, int start, int count) {
                addListChangedCallbacks(layers, start, start + count);

                for (int i = start; i < start + count; i++) {
                    addLayer(layers.get(i));
                }
            }

            @Override
            public void onItemRangeMoved(ObservableList<Layer> layers, int i, int i1, int i2) {

            }

            @Override
            public void onItemRangeRemoved(ObservableList<Layer> layers, int start, int count) {
                // Because we don't know which item(s) were removed, we have to
                // reconstruct it ourselves
                Set<Layer> currentTwirled = new HashSet<Layer>(getTwirledDownLayersForGroup(mRoot));
                Set<Layer> oldTwirled = new HashSet<Layer>(mTwirledDownLayers);
                oldTwirled.removeAll(currentTwirled);
                for (Layer l : oldTwirled) {
                    removeLayer(l);
                }
            }
        };
    }
 
開發者ID:google,項目名稱:spline,代碼行數:42,代碼來源:LayerListAdapter.java

示例10: AdapterWRef

import android.databinding.ObservableList; //導入方法依賴的package包/類
AdapterWRef(A referent, ObservableList<T> items, ObservableList.OnListChangedCallback<ObservableList<T>> callback) {
    super(referent, QUEUE);
    this.items = items;
    this.callback = callback;
}
 
開發者ID:zxmmmmmm,項目名稱:Mvvm,代碼行數:6,代碼來源:MvvmAdapter.java

示例11: setCallback

import android.databinding.ObservableList; //導入方法依賴的package包/類
public void setCallback(ObservableList.OnListChangedCallback callback){
    this.callback = callback;
}
 
開發者ID:akiraspeirs,項目名稱:Cinder,代碼行數:4,代碼來源:CinderListPair.java

示例12: getCallback

import android.databinding.ObservableList; //導入方法依賴的package包/類
public ObservableList.OnListChangedCallback<ObservableList<ObservableItem>> getCallback() {
    return listChangedCallback;
}
 
開發者ID:k-kagurazaka,項目名稱:filtered-observable-collection,代碼行數:4,代碼來源:ObservableItemListSource.java

示例13: getCallback

import android.databinding.ObservableList; //導入方法依賴的package包/類
public ObservableList.OnListChangedCallback<ObservableList<String>> getCallback() {
    return listChangedCallback;
}
 
開發者ID:k-kagurazaka,項目名稱:filtered-observable-collection,代碼行數:4,代碼來源:NonObservableItemListSource.java

示例14: addOnListChangedCallback

import android.databinding.ObservableList; //導入方法依賴的package包/類
/**
 * Allows for listening to changes on the array.
 *
 * @param callback The callback to be executed on list changes.
 */
public final void addOnListChangedCallback(ObservableList.OnListChangedCallback callback) {
    mItems.addOnListChangedCallback(callback);
}
 
開發者ID:SeptimusX75,項目名稱:Android-Data-Binding-Recycler,代碼行數:9,代碼來源:BindingRecyclerAdapterObservable.java

示例15: removeOnListChangedCallback

import android.databinding.ObservableList; //導入方法依賴的package包/類
/**
 * Removes the specified callback from the array.
 *
 * @param callback The callback to remove.
 */
public final void removeOnListChangedCallback(ObservableList.OnListChangedCallback callback) {
    mItems.removeOnListChangedCallback(callback);
}
 
開發者ID:SeptimusX75,項目名稱:Android-Data-Binding-Recycler,代碼行數:9,代碼來源:BindingRecyclerAdapterObservable.java


注:本文中的android.databinding.ObservableList.OnListChangedCallback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。