Search in sources :

Example 1 with BaseQuickAdapter

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

the class ItemClickActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setBackBtn();
    setTitle("ItemClickActivity Activity");
    setContentView(R.layout.activity_item_click);
    mRecyclerView = (RecyclerView) findViewById(R.id.list);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    initAdapter();
    mRecyclerView.addOnItemTouchListener(new OnItemClickListener() {

        /**
             * Callback method to be invoked when an item in this AdapterView has
             * been clicked.
             *
             * @param view     The view within the AdapterView that was clicked (this
             *                 will be a view provided by the adapter)
             * @param position The position of the view in the adapter.
             */
        @Override
        public void onSimpleItemClick(final BaseQuickAdapter adapter, final View view, final int position) {
            Log.d(TAG, "SimpleOnItemClick: ");
            Toast.makeText(ItemClickActivity.this, "onSimpleItemClick" + position, Toast.LENGTH_SHORT).show();
        }

        /**
             * callback method to be invoked when an chidview in this view has been
             * click and held
             *
             * @param view     The view whihin the AbsListView that was clicked
             * @param position The position of the view int the adapter
             * @return true if the callback consumed the long click ,false otherwise
             */
        @Override
        public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
            Logger.d("onItemChildClick " + position + " be click");
            Toast.makeText(ItemClickActivity.this, "onItemChildClick" + position, Toast.LENGTH_SHORT).show();
        }

        /**
             * Callback method to be invoked when an item in this view has been clicked and held.
             * @param adapter
             * @param view
             * @param position
             */
        @Override
        public void onItemLongClick(final BaseQuickAdapter adapter, final View view, final int position) {
            Toast.makeText(ItemClickActivity.this, "onItemLongClick" + position, Toast.LENGTH_SHORT).show();
        }

        /**
             * Callback method to be invoked when an itemchild in this view has been clicked and held.
             * @param adapter
             * @param view
             * @param position
             */
        @Override
        public void onItemChildLongClick(final BaseQuickAdapter adapter, final View view, final int position) {
            Toast.makeText(ItemClickActivity.this, "onItemChildLongClick" + position, Toast.LENGTH_SHORT).show();
        }
    });
}
Also used : OnItemClickListener(com.chad.library.adapter.base.listener.OnItemClickListener) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 2 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project PracticeFilmApplication by FOnlyJack.

the class VideoPlayActivity method initListener.

private void initListener() {
    filmVideoAdapter.setOnLoadMoreListener(this, rvVideoList);
    rvVideoList.addOnItemTouchListener(new OnItemClickListener() {

        @Override
        public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) {
            FilmVideoBean.VideoListBean msBean = (FilmVideoBean.VideoListBean) adapter.getData().get(position);
            String hightUrl = msBean.getHightUrl();
            String title = msBean.getTitle();
            String image = msBean.getImage();
            if (jcVideo.currentState == JCVideoPlayer.CURRENT_STATE_PLAYING) {
                JCVideoPlayer.releaseAllVideos();
            }
            presenter.unSubscribe();
            jcVideo.setUp(hightUrl, JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL, title);
            Glide.with(VideoPlayActivity.this).load(image).into(jcVideo.thumbImageView);
        }
    });
}
Also used : OnItemClickListener(com.chad.library.adapter.base.listener.OnItemClickListener) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) FilmVideoBean(com.example.changemax.sqhappy.model.network.entity.FilmVideoBean) BindView(butterknife.BindView) JCVAutoFullVideoView(com.example.changemax.sqhappy.ui.view.JCVAutoFullVideoView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Example 3 with BaseQuickAdapter

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

the class WeiXinFragment method initialize.

@Override
protected void initialize() {
    swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
    swipeRefreshLayout.setRefreshing(true);
    swipeRefreshLayout.setOnRefreshListener(this);
    mPresenter.getWeiXinData(PAGE_SIZE, page);
    mPresenter.getPTP();
    weiXinAdapter = new WeiXinAdapter();
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    recyclerView.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL));
    recyclerView.setAdapter(weiXinAdapter);
    weiXinAdapter.setPTP(sharePrefManager.getProvincialTrafficPattern());
    weiXinAdapter.setOnLoadMoreListener(this, recyclerView);
    weiXinAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            WeiXinBean.NewslistBean bean = (WeiXinBean.NewslistBean) adapter.getData().get(position);
            WebActivity.open(new WebActivity.Builder().setGuid(// 微信Item没有id,使用url作为guid
            bean.getUrl()).setImgUrl(bean.getPicUrl()).setType(Constants.TYPE_WEIXIN).setUrl(bean.getUrl()).setTitle(bean.getTitle()).setShowLikeIcon(true).setContext(mContext));
        }
    });
}
Also used : BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) WebActivity(com.xxx.ency.view.web.WebActivity) WeiXinAdapter(com.xxx.ency.view.weixin.adapter.WeiXinAdapter) 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) WeiXinBean(com.xxx.ency.model.bean.WeiXinBean)

Example 4 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project 91Pop by DanteAndroid.

the class VideoListFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    unbinder = ButterKnife.bind(this, view);
    // Setup contentView == SwipeRefreshView
    contentView.setOnRefreshListener(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(mUnLimit91Adapter);
    mUnLimit91Adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            UnLimit91PornItem unLimit91PornItems = (UnLimit91PornItem) adapter.getItem(position);
            goToPlayVideo(unLimit91PornItems);
        }
    });
    // 使用缓存的FragmentPagerAdapter之后会导致新方法的加载更多失效,暂时切换回过时api,可正常运行
    mUnLimit91Adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {

        @Override
        public void onLoadMoreRequested() {
            presenter.loadVideoListData(false, false, category.getCategoryValue(), 0);
        }
    });
    helper = new LoadViewHelper(recyclerView);
    helper.setListener(new OnLoadViewListener() {

        @Override
        public void onRetryClick() {
            loadData(false, true, 0);
        }
    });
    // loadData(false);
    AppUtils.setColorSchemeColors(context, contentView);
    handlerSkipPage();
}
Also used : BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnLoadViewListener(com.helper.loadviewhelper.help.OnLoadViewListener) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) LoadViewHelper(com.helper.loadviewhelper.load.LoadViewHelper) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) UnLimit91PornItem(com.dante.data.model.UnLimit91PornItem)

Example 5 with BaseQuickAdapter

use of com.chad.library.adapter.base.BaseQuickAdapter in project 91Pop by DanteAndroid.

the class ProxySettingActivity method init.

private void init() {
    testAlertDialog = DialogUtils.initLodingDialog(this, "测试中,请稍候...");
    String proxyHost = dataManager.getProxyIpAddress();
    int port = dataManager.getProxyPort();
    etDialogProxySettingIpAddress.setIpAddressStr(proxyHost);
    etDialogProxySettingPort.setText(port == 0 ? "" : String.valueOf(port));
    List<ProxyModel> data = new ArrayList<>();
    proxyAdapter = new ProxyAdapter(R.layout.item_proxy, data);
    recyclerViewProxySetting.setLayoutManager(new LinearLayoutManager(this));
    recyclerViewProxySetting.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
    View view = getLayoutInflater().inflate(R.layout.item_proxy, recyclerViewProxySetting, false);
    proxyAdapter.setHeaderView(view);
    proxyAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {

        @Override
        public void onLoadMoreRequested() {
            presenter.parseXiCiDaiLi(false);
        }
    }, recyclerViewProxySetting);
    proxyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            ProxyModel proxyModel = (ProxyModel) adapter.getItem(position);
            if (proxyModel == null) {
                showMessage("数据出错了", TastyToast.WARNING);
                return;
            }
            proxyAdapter.setClickPosition(position);
            if (proxyModel.getType() != ProxyModel.TYPE_SOCKS) {
                etDialogProxySettingIpAddress.setIpAddressStr(proxyModel.getProxyIp());
                etDialogProxySettingPort.setText(proxyModel.getProxyPort());
            } else {
                showMessage("暂不支持socket代理", TastyToast.INFO);
            }
        }
    });
    recyclerViewProxySetting.setAdapter(proxyAdapter);
    helper = new LoadViewHelper(recyclerViewProxySetting);
    helper.setListener(new OnLoadViewListener() {

        @Override
        public void onRetryClick() {
            presenter.parseXiCiDaiLi(false);
        }
    });
    presenter.parseXiCiDaiLi(false);
}
Also used : ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnLoadViewListener(com.helper.loadviewhelper.help.OnLoadViewListener) ProxyAdapter(com.dante.adapter.ProxyAdapter) LoadViewHelper(com.helper.loadviewhelper.load.LoadViewHelper) ProxyModel(com.dante.data.model.ProxyModel)

Aggregations

BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)48 View (android.view.View)46 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 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)6 ImageView (android.widget.ImageView)6 RecyclerView (androidx.recyclerview.widget.RecyclerView)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