本文整理汇总了Java中android.support.v7.util.ListUpdateCallback.onInserted方法的典型用法代码示例。如果您正苦于以下问题:Java ListUpdateCallback.onInserted方法的具体用法?Java ListUpdateCallback.onInserted怎么用?Java ListUpdateCallback.onInserted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.util.ListUpdateCallback
的用法示例。
在下文中一共展示了ListUpdateCallback.onInserted方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyPresenter1FromAToBChanges
import android.support.v7.util.ListUpdateCallback; //导入方法依赖的package包/类
private static void applyPresenter1FromAToBChanges(@NonNull final ListUpdateCallback callback) {
// From count 1 to count 3:
// [X] -> [Y, X]
callback.onInserted(0, 1);
// [Y, X] -> [Y, X']
callback.onChanged(1, 1, PAYLOAD_PRESENTER_1_VALUE_A_TO_B);
// [Y, X] -> [Y, X', Z]
callback.onInserted(2, 1);
}
示例2: applyPresenter1FromBToAChanges
import android.support.v7.util.ListUpdateCallback; //导入方法依赖的package包/类
private static void applyPresenter1FromBToAChanges(@NonNull final ListUpdateCallback callback) {
// From count 3 to count 1:
// [Y, X', Z] -> [Y, Z]
callback.onRemoved(1, 1);
// [Y, Z] -> []
callback.onRemoved(0, 2);
// [] -> [X]
callback.onInserted(0, 1);
}
示例3: applyPresenter2FromAToBChanges
import android.support.v7.util.ListUpdateCallback; //导入方法依赖的package包/类
private static void applyPresenter2FromAToBChanges(
final int offset, @NonNull final ListUpdateCallback callback) {
// From count 4 to count 5:
// [M, N, O, P] -> [P, M, N, O]
callback.onMoved(3 + offset, offset);
// [P, M, N, O] -> [P, M]
callback.onRemoved(2 + offset, 2);
// [P, M] -> [P, X, Y, Z, M]
callback.onInserted(1 + offset, 3);
}
示例4: applyPresenter2FromBToAChanges
import android.support.v7.util.ListUpdateCallback; //导入方法依赖的package包/类
private static void applyPresenter2FromBToAChanges(
final int offset, @NonNull final ListUpdateCallback callback) {
// From count 5 to count 4:
// [P, X, Y, Z, M] -> [M, P, X, Y, Z]
callback.onMoved(4 + offset, offset);
// [M, P, X, Y, Z] -> [M, P]
callback.onRemoved(2 + offset, 3);
// [M, P] -> [M, N, O, P]
callback.onInserted(1 + offset, 2);
}