• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Swappable类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.nhaarman.listviewanimations.util.Swappable的典型用法代码示例。如果您正苦于以下问题:Java Swappable类的具体用法?Java Swappable怎么用?Java Swappable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

Swappable类属于com.nhaarman.listviewanimations.util包,在下文中一共展示了Swappable类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setAdapterInternal

点赞 3

import com.nhaarman.listviewanimations.util.Swappable; //导入依赖的package包/类
/**
 * @throws java.lang.IllegalStateException    if the adapter does not have stable ids.
 * @throws java.lang.IllegalArgumentException if the adapter does not implement {@link com.nhaarman.listviewanimations.util.Swappable}.
 */
private void setAdapterInternal(@NonNull final ListAdapter adapter) {
    ListAdapter actualAdapter = adapter;
    if (actualAdapter instanceof WrapperListAdapter) {
        actualAdapter = ((WrapperListAdapter) actualAdapter).getWrappedAdapter();
    }

    if (!actualAdapter.hasStableIds()) {
        throw new IllegalStateException("Adapter doesn't have stable ids! Make sure your adapter has stable ids, and override hasStableIds() to return true.");
    }

    if (!(actualAdapter instanceof Swappable)) {
        throw new IllegalArgumentException("Adapter should implement Swappable!");
    }

    mAdapter = actualAdapter;
}
 

开发者ID:sathishmscict,
项目名称:ListViewAnimations,
代码行数:21,
代码来源:DragAndDropHandler.java

示例2: swapItems

点赞 2

import com.nhaarman.listviewanimations.util.Swappable; //导入依赖的package包/类
@Override
public void swapItems(final int positionOne, final int positionTwo) {
    if (mDecoratedBaseAdapter instanceof Swappable) {
        ((Swappable) mDecoratedBaseAdapter).swapItems(positionOne, positionTwo);
    } else {
        Log.w("ListViewAnimations", "Warning: swapItems called on an adapter that does not implement Swappable!");
    }
}
 

开发者ID:sathishmscict,
项目名称:ListViewAnimations,
代码行数:9,
代码来源:BaseAdapterDecorator.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)