Search in sources :

Example 26 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project BaseRecyclerViewAdapterHelper by CymChad.

the class SimpleClickListener method onInterceptTouchEvent.

@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
    if (recyclerView == null) {
        this.recyclerView = rv;
        this.baseQuickAdapter = (BaseQuickAdapter) recyclerView.getAdapter();
        mGestureDetector = new GestureDetectorCompat(recyclerView.getContext(), new ItemTouchHelperGestureListener(recyclerView));
    } else if (recyclerView != rv) {
        this.recyclerView = rv;
        this.baseQuickAdapter = (BaseQuickAdapter) recyclerView.getAdapter();
        mGestureDetector = new GestureDetectorCompat(recyclerView.getContext(), new ItemTouchHelperGestureListener(recyclerView));
    }
    if (!mGestureDetector.onTouchEvent(e) && e.getActionMasked() == MotionEvent.ACTION_UP && mIsShowPress) {
        if (mPressedView != null) {
            BaseViewHolder vh = (BaseViewHolder) recyclerView.getChildViewHolder(mPressedView);
            if (vh == null || !isHeaderOrFooterView(vh.getItemViewType())) {
                mPressedView.setPressed(false);
            }
        }
        mIsShowPress = false;
        mIsPrepressed = false;
    }
    return false;
}
Also used : BaseViewHolder(com.chad.library.adapter.base.BaseViewHolder) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat)

Example 27 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project Ency by xiarunhao123.

the class EyepetizerHotActivity method initialize.

@Override
protected void initialize() {
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    setTitle("热门排行");
    Intent intent = getIntent();
    Bundle bundle = intent.getExtras();
    VideoBean hotVideoBean = (VideoBean) bundle.getSerializable("data");
    hotAdapter = new EyepetizerAdapter();
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    recyclerView.setAdapter(hotAdapter);
    hotAdapter.setNewData(hotVideoBean.getItemList());
    hotAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            VideoBean.ItemListBean bean = (VideoBean.ItemListBean) adapter.getData().get(position);
            VideoBean.ItemListBean.DataBeanX beanX = bean.getData();
            Intent intent = new Intent(mContext, EyepetizerDetailActivity.class);
            intent.putExtra("data", beanX);
            mContext.startActivity(intent);
        }
    });
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) BindView(butterknife.BindView) VideoBean(com.xxx.ency.model.bean.VideoBean) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) EyepetizerAdapter(com.xxx.ency.view.eyepetizer.adapter.EyepetizerAdapter)

Example 28 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project Ency by xiarunhao123.

the class GankFragment method initialize.

@Override
protected void initialize() {
    Bundle args = getArguments();
    if (args != null) {
        type = args.getString("type");
    }
    swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
    swipeRefreshLayout.setRefreshing(true);
    swipeRefreshLayout.setOnRefreshListener(this);
    mPresenter.getGankData(type, PAGE_SIZE, page);
    mPresenter.getPTP();
    gankAdapter = new GankAdapter(resultsBeans);
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    recyclerView.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL));
    recyclerView.setAdapter(gankAdapter);
    gankAdapter.setPTP(sharePrefManager.getProvincialTrafficPattern());
    gankAdapter.setOnLoadMoreListener(this, recyclerView);
    gankAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            GankBean.ResultsBean bean = (GankBean.ResultsBean) adapter.getData().get(position);
            WebActivity.open(new WebActivity.Builder().setGuid(// 微信Item没有id,使用url作为guid
            bean.get_id()).setImgUrl("").setType(Constants.TYPE_GANK).setUrl(bean.getUrl()).setTitle(bean.getDesc()).setShowLikeIcon(true).setContext(mContext));
        }
    });
}
Also used : Bundle(android.os.Bundle) WebActivity(com.xxx.ency.view.web.WebActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) GankBean(com.xxx.ency.model.bean.GankBean) GankAdapter(com.xxx.ency.view.gank.adapter.GankAdapter) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter)

Example 29 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project Ency by xiarunhao123.

the class LikeFragment method initialize.

@Override
protected void initialize() {
    daoManager = EncyApplication.getAppComponent().getGreenDaoManager();
    likeAdapter = new LikeAdapter();
    likeAdapter.setNewData(daoManager.queryAll());
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    recyclerView.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL));
    recyclerView.setAdapter(likeAdapter);
    likeAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            LikeBean bean = (LikeBean) adapter.getData().get(position);
            if (bean.getType() == Constants.TYPE_VIDEO) {
                JZVideoPlayer.FULLSCREEN_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
                JZVideoPlayer.NORMAL_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
                JZVideoPlayerStandard.startFullscreen(mContext, JZVideoPlayerStandard.class, bean.getUrl(), bean.getTitle());
            } else {
                WebActivity.open(new WebActivity.Builder().setGuid(bean.getUrl()).setImgUrl(bean.getImageUrl()).setType(bean.getType()).setUrl(bean.getUrl()).setTitle(bean.getTitle()).setShowLikeIcon(true).setContext(mContext));
            }
        }
    });
    likeAdapter.setOnItemLongClickListener(new BaseQuickAdapter.OnItemLongClickListener() {

        @SuppressLint("ResourceAsColor")
        @Override
        public boolean onItemLongClick(BaseQuickAdapter adapter, View view, final int position) {
            final LikeBean bean = (LikeBean) adapter.getData().get(position);
            new MaterialDialog.Builder(mContext).content("确认要删除该收藏吗?").negativeText("取消").negativeColorRes(R.color.colorNegative).positiveText("确定").positiveColorRes(R.color.colorPositive).onPositive(new MaterialDialog.SingleButtonCallback() {

                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    daoManager.delete(bean);
                    likeAdapter.remove(position);
                }
            }).show();
            return true;
        }
    });
    likeAdapter.setEmptyView(R.layout.view_empty, recyclerView);
}
Also used : LikeAdapter(com.xxx.ency.view.like.adapter.LikeAdapter) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) JZVideoPlayerStandard(cn.jzvd.JZVideoPlayerStandard) WebActivity(com.xxx.ency.view.web.WebActivity) LikeBean(com.xxx.ency.model.bean.LikeBean) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) SuppressLint(android.annotation.SuppressLint) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) DialogAction(com.afollestad.materialdialogs.DialogAction) SuppressLint(android.annotation.SuppressLint)

Example 30 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project BaseProject by feer921.

the class SimpleClickListener method onInterceptTouchEvent.

@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
    if (recyclerView == null) {
        this.recyclerView = rv;
        this.baseQuickAdapter = (BaseQuickAdapter) recyclerView.getAdapter();
        mGestureDetector = new GestureDetectorCompat(recyclerView.getContext(), new ItemTouchHelperGestureListener(recyclerView));
    } else if (recyclerView != rv) {
        this.recyclerView = rv;
        this.baseQuickAdapter = (BaseQuickAdapter) recyclerView.getAdapter();
        mGestureDetector = new GestureDetectorCompat(recyclerView.getContext(), new ItemTouchHelperGestureListener(recyclerView));
    }
    if (!mGestureDetector.onTouchEvent(e) && e.getActionMasked() == MotionEvent.ACTION_UP && mIsShowPress) {
        if (mPressedView != null) {
            BaseViewHolder vh = (BaseViewHolder) recyclerView.getChildViewHolder(mPressedView);
            if (vh == null || !isHeaderOrFooterView(vh.getItemViewType())) {
                mPressedView.setPressed(false);
            }
        }
        mIsShowPress = false;
        mIsPrepressed = false;
    }
    return false;
}
Also used : BaseViewHolder(com.chad.library.adapter.base.BaseViewHolder) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) GestureDetectorCompat(android.support.v4.view.GestureDetectorCompat)

Aggregations

BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)49 View (android.view.View)47 RecyclerView (android.support.v7.widget.RecyclerView)38 BindView (butterknife.BindView)27 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)26 OnItemClickListener (com.chad.library.adapter.base.listener.OnItemClickListener)15 Intent (android.content.Intent)12 UnLimit91PornItem (com.dante.data.model.UnLimit91PornItem)8 RecyclerView (androidx.recyclerview.widget.RecyclerView)7 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)6 ImageView (android.widget.ImageView)6 OnItemChildClickListener (com.chad.library.adapter.base.listener.OnItemChildClickListener)6 OnLoadViewListener (com.helper.loadviewhelper.help.OnLoadViewListener)6 LoadViewHelper (com.helper.loadviewhelper.load.LoadViewHelper)6 ArrayList (java.util.ArrayList)6 TextView (android.widget.TextView)4 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)3 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)3 BaseViewHolder (com.chad.library.adapter.base.BaseViewHolder)3 DialogInterface (android.content.DialogInterface)2