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


Java DiffUtil.DiffResult方法代碼示例

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


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

示例1: updateData

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
public SlimAdapter updateData(List<?> data) {
    if (moreLoader != null) {
        moreLoader.reset();
    }
    if (diffCallback == null || getItemCount() == 0 || data == null || data.size() == 0) {
        this.data = data;
        if (Looper.myLooper() == Looper.getMainLooper()) {
            notifyDataSetChanged();
        } else {
            uiHandler.removeMessages(WHAT_NOTIFY_DATA_SET_CHANGED);
            uiHandler.sendEmptyMessage(WHAT_NOTIFY_DATA_SET_CHANGED);
        }
    } else {
        DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new SlimDiffUtil(this.data, data, diffCallback));
        this.data = data;
        if (Looper.myLooper() == Looper.getMainLooper()) {
            diffResult.dispatchUpdatesTo(this);
        } else {
            uiHandler.removeMessages(WHAT_NOTIFY_DATA_SET_CHANGED);
            uiHandler.sendEmptyMessage(WHAT_NOTIFY_DATA_SET_CHANGED);
        }
    }
    return this;
}
 
開發者ID:MEiDIK,項目名稱:SlimAdapter,代碼行數:25,代碼來源:SlimAdapter.java

示例2: onDataLoaded

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
@Override
public void onDataLoaded(List<User> users) {
    // 無論怎麽操作,數據變更,最終都會通知到這裏來
    final ContactContract.View view = getView();
    if (view == null)
        return;

    RecyclerAdapter<User> adapter = view.getRecyclerAdapter();
    List<User> old = adapter.getItems();

    // 進行數據對比
    DiffUtil.Callback callback = new DiffUiDataCallback<>(old, users);
    DiffUtil.DiffResult result = DiffUtil.calculateDiff(callback);

    // 調用基類方法進行界麵刷新
    refreshData(result, users);
}
 
開發者ID:FZZFVII,項目名稱:pipe,代碼行數:18,代碼來源:ContactPresenter.java

示例3: addDailyDate

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
public void addDailyDate(DailyListBean info) {
        currentTitle = "今日熱聞";
        DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new ZhihuDiffCallback(mList, info.getStories()), true);
        mList = info.getStories();
        mTopList = info.getTop_stories();
        isBefore = false;
        diffResult.dispatchUpdatesTo(this);
//        notifyDataSetChanged();
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:DailyAdapter.java

示例4: run

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
/** {@inheritDoc} */
@WorkerThread
@Override
public void run() {
    final DiffUtil.DiffResult diffResult
            = DiffUtil.calculateDiff(new GmlrvaDiffCallback(this.mOldDataSet, this.mNewDataSet));
    if (mContext != null) {
        ((Activity) mContext).runOnUiThread(new UpdateUiDiffUtilResult(this.mNewDataSet, diffResult, mAdapter));
    }
}
 
開發者ID:Simdea,項目名稱:gmlrva,代碼行數:11,代碼來源:BackgroundDiffUtilWorker.java

示例5: addItems

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
public void addItems(List<Recipe> recipeList) {

        List<Recipe> newRecipeList = new ArrayList<>();
        newRecipeList.addAll(this.recipeList);
        newRecipeList.addAll(recipeList);

        DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new RecipeDiffUtilCallback(this.recipeList, newRecipeList));
        this.recipeList.addAll(recipeList);
        diffResult.dispatchUpdatesTo(this);
    }
 
開發者ID:vicky7230,項目名稱:Paprika,代碼行數:11,代碼來源:RecipesAdapter.java

示例6: showTasks

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
public void showTasks(Pair<DiffUtil.DiffResult, List<Task>> pairOfDiffResultAndTasks, TasksFilterType filterType) {
    if(tasksAdapter != null) {
        DiffUtil.DiffResult diffResult = pairOfDiffResultAndTasks.getValue0();
        List<Task> tasks = pairOfDiffResultAndTasks.getValue1();
        tasksAdapter.setData(tasks);
        diffResult.dispatchUpdatesTo(tasksAdapter);
        if(tasks.isEmpty()) {
            filterType.showEmptyViews(this);
        } else {
            hideEmptyViews();
        }
    }
}
 
開發者ID:Zhuinden,項目名稱:simple-stack,代碼行數:14,代碼來源:TasksFragment.java

示例7: run

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
@Override
public void run() {
    List<T> newData = mHandleBase.getNewData();
    T newHeader = mHandleBase.getNewHeader();
    T newFooter = mHandleBase.getNewFooter();
    int refreshType = mHandleBase.getRefreshType();
    int type = mHandleBase.getType();
    DiffUtil.DiffResult result = handleRefresh(newData, newHeader, newFooter, type, refreshType);
    Message message = mHandler.obtainMessage(HANDLE_DATA_UPDATE);
    message.obj = result;
    message.sendToTarget();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:AsynAdapterHelper.java

示例8: onNewData

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
public void onNewData(ArrayList<User> users) {
    UserCallback callback = new UserCallback(users, this.users);
    DiffUtil.DiffResult result = DiffUtil.calculateDiff(callback, true);

    this.users.clear();
    this.users.addAll(users);

    result.dispatchUpdatesTo(this);
}
 
開發者ID:WGPlaner,項目名稱:wg_planer,代碼行數:10,代碼來源:GroupMemberAdapter.java

示例9: updateEmployeeListItems

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
public void updateEmployeeListItems(List<Employee> employees) {
    final EmployeeDiffCallback diffCallback = new EmployeeDiffCallback(this.mEmployees, employees);
    final DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(diffCallback);

    this.mEmployees.clear();
    this.mEmployees.addAll(employees);
    diffResult.dispatchUpdatesTo(this);
}
 
開發者ID:AnkitSinhal,項目名稱:DiffUtilExample,代碼行數:9,代碼來源:EmployeeRecyclerViewAdapter.java

示例10: onNewData

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
public void onNewData(ArrayList<CategoryHolder> items) {
    final CategoryDiffCallback callback = new CategoryDiffCallback(items, this.items);
    final DiffUtil.DiffResult result = DiffUtil.calculateDiff(callback, true);

    this.items.clear();
    this.items.addAll(items);

    result.dispatchUpdatesTo(this);
}
 
開發者ID:WGPlaner,項目名稱:wg_planer,代碼行數:10,代碼來源:ShoppingListCategoryAdapter.java

示例11: dispatchUpdatesTo

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
public void dispatchUpdatesTo(DiffUtil.DiffResult p_jResults) {
    for (int i = 0; i < m_jAdapterList.size(); i++) {
        RecyclerView.Adapter cellRowAdapter = m_jAdapterList.get(i);
        p_jResults.dispatchUpdatesTo(cellRowAdapter);
    }

    p_jResults.dispatchUpdatesTo(this);

}
 
開發者ID:evrencoskun,項目名稱:TableView,代碼行數:10,代碼來源:CellRecyclerViewAdapter.java

示例12: setData

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
/**
 * Sets the data set to the adapter and automatically dispatches an update
 * via DiffUtil.DiffResult
 * @param data new data set
 */
public void setData(List<T> data) {
    final DiffUtil.DiffResult diffResult = calculateDiff(this.data, data, valueHashCache);
    this.data = data;
    this.valueHashCache = createValueHashList();
    notifyDiffSubject.onNext(diffResult);
    dataChangeSubject.onNext(data);
}
 
開發者ID:Team-SOFTsk,項目名稱:ObservableAdapter,代碼行數:13,代碼來源:AdapterSource.java

示例13: addItems

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
public void addItems(List<LikedRecipe> likedRecipeList) {

        List<LikedRecipe> newLikedRecipeList = new ArrayList<>();
        newLikedRecipeList.addAll(this.likedRecipeList);
        newLikedRecipeList.addAll(likedRecipeList);

        DiffUtil.DiffResult diffResult = DiffUtil.calculateDiff(new LikedRecipeDiffUtilCallback(this.likedRecipeList, newLikedRecipeList));
        this.likedRecipeList.addAll(likedRecipeList);
        diffResult.dispatchUpdatesTo(this);
    }
 
開發者ID:vicky7230,項目名稱:Paprika,代碼行數:11,代碼來源:LikesAdapter.java

示例14: DownloadInfoUpdate

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
public DownloadInfoUpdate(List<DownloadInfo> downloadInfos, DiffUtil.DiffResult diffResult) {
    this.downloadInfos = downloadInfos;
    this.diffResult = diffResult;
    type=TYPE_PROGRESS;
}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:6,代碼來源:DownloadInfoUpdate.java

示例15: onForeground

import android.support.v7.util.DiffUtil; //導入方法依賴的package包/類
@Override
public void onForeground(final Pair<List<DisplayItem>, DiffUtil.DiffResult> value) {
    ClaimItemAdapter.this.items = value.first;
    value.second.dispatchUpdatesTo(ClaimItemAdapter.this);
}
 
開發者ID:PacktPublishing,項目名稱:Hands-On-Android-UI-Development,代碼行數:6,代碼來源:ClaimItemAdapter.java


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