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

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

java 1次浏览

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

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

示例1: onCreate

点赞 2

import com.yanzhenjie.recyclerview.swipe.touch.OnItemMoveListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_share_app_manager);
    StatusBarCompat.setupStatusBarView(this, (ViewGroup) getWindow().getDecorView(), true, R.color.primary_dark);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mRV = (SwipeMenuRecyclerView) findViewById(R.id.rv);
    mRV.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
    Adapter.AppInfoAdapter appsAdapter = new Adapter.AppInfoAdapter(mResultAppInfo);
    mRV.setAdapter(appsAdapter);
    new LoadAppInfoClass().execute();
    mRV.setHasFixedSize(true);// 如果Item够简单,高度是确定的,打开FixSize将提高性能。
    mRV.setItemAnimator(new DefaultItemAnimator());// 设置Item默认动画,加也行,不加也行。
    mRV.setLongPressDragEnabled(true);// 开启拖拽,就这么简单一句话。
    mRV.setOnItemMoveListener(new OnItemMoveListener() {
        @Override
        public boolean onItemMove(int fromPosition, int toPosition) {
            // 当Item被拖拽的时候。
            Collections.swap(mResultAppInfo, fromPosition, toPosition);
            if (resolveInfoWraps != null) {
                Collections.swap(resolveInfoWraps, fromPosition, toPosition);
            }
            appsAdapter.notifyItemMoved(fromPosition, toPosition);


            return true;// 返回true表示处理了,返回false表示你没有处理。
        }

        @Override
        public void onItemDismiss(int position) {

        }
    });
}
 

开发者ID:l465659833,
项目名称:Bigbang,
代码行数:37,
代码来源:ShareAppManagerActivity.java

示例2: showAppList4OneStep

点赞 2

import com.yanzhenjie.recyclerview.swipe.touch.OnItemMoveListener; //导入依赖的package包/类
private void showAppList4OneStep() {
    mAppsRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id.app_list);
    mAppsRecyclerViewLL = findViewById(R.id.app_list_ll);
    if (SPHelper.getBoolean(ConstantUtil.IS_STICK_SHAREBAR, true)) {
        mAppsRecyclerViewLL.setVisibility(View.VISIBLE);
        mAppsRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        List<ResolveInfoWrap> addedItems = SharedIntentHelper.listFilterIntents(this);
        mAppsRecyclerView.setHasFixedSize(true);// 如果Item够简单,高度是确定的,打开FixSize将提高性能。
        mAppsRecyclerView.setItemAnimator(new DefaultItemAnimator());// 设置Item默认动画,加也行,不加也行。
        AppsAdapter appsAdapter = new AppsAdapter(this);
        appsAdapter.setItems(addedItems);
        appsAdapter.setOnItemClickListener(new AppsAdapter.OnItemClickListener() {
            @Override
            public void onItemClicked(ResolveInfoWrap item) {
                if (!TextUtils.isEmpty(mSelectText)) {
                    try {
                        SharedIntentHelper.share(BigBangActivity.this, item, mSelectText);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    ToastUtil.show("请选择文字");
                }

            }
        });
        mAppsRecyclerView.setLongPressDragEnabled(true);// 开启拖拽,就这么简单一句话。
        mAppsRecyclerView.setOnItemMoveListener(new OnItemMoveListener() {
            @Override
            public boolean onItemMove(int fromPosition, int toPosition) {
                // 当Item被拖拽的时候。
                Collections.swap(addedItems, fromPosition, toPosition);
                appsAdapter.notifyItemMoved(fromPosition,toPosition);
                SharedIntentHelper.saveShareAppIndexs2Sp(addedItems,BigBangActivity.this);

                return true;// 返回true表示处理了,返回false表示你没有处理。
            }

            @Override
            public void onItemDismiss(int position) {

            }
        });
        mAppsRecyclerView.setAdapter(appsAdapter);

    } else {
        mAppsRecyclerViewLL.setVisibility(View.GONE);
    }

}
 

开发者ID:l465659833,
项目名称:Bigbang,
代码行数:51,
代码来源:BigBangActivity.java

示例3: getItemMoveListener

点赞 2

import com.yanzhenjie.recyclerview.swipe.touch.OnItemMoveListener; //导入依赖的package包/类
@Override
protected OnItemMoveListener getItemMoveListener() {
    return onItemMoveListener;
}
 

开发者ID:yanzhenjie,
项目名称:SwipeRecyclerView,
代码行数:5,
代码来源:DragTouchListActivity.java

示例4: setOnItemMoveListener

点赞 1

import com.yanzhenjie.recyclerview.swipe.touch.OnItemMoveListener; //导入依赖的package包/类
/**
 * Set OnItemMoveListener.
 *
 * @param onItemMoveListener {@link OnItemMoveListener}.
 */
public void setOnItemMoveListener(OnItemMoveListener onItemMoveListener) {
    initializeItemTouchHelper();
    this.mDefaultItemTouchHelper.setOnItemMoveListener(onItemMoveListener);
}
 

开发者ID:yanzhenjie,
项目名称:SwipeRecyclerView,
代码行数:10,
代码来源:SwipeMenuRecyclerView.java

示例5: getItemMoveListener

点赞 1

import com.yanzhenjie.recyclerview.swipe.touch.OnItemMoveListener; //导入依赖的package包/类
protected abstract OnItemMoveListener getItemMoveListener(); 

开发者ID:yanzhenjie,
项目名称:SwipeRecyclerView,
代码行数:2,
代码来源:BaseDragActivity.java


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