Search in sources :

Example 1 with BlogTypeAdapter

use of com.qyh.myblog_android.ui.adapter.BlogTypeAdapter in project Qblog_Android by qiaoyhh.

the class BlogTypePop method initView.

private void initView() {
    if (popupWindow == null) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.view_common, null);
        popupWindow = new PopupWindow(view, ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.WRAP_CONTENT);
        popupWindow.setOutsideTouchable(true);
        popupWindow.setFocusable(true);
        RecyclerView rv_view_main = (RecyclerView) view.findViewById(R.id.view_main);
        mAdapter = new BlogTypeAdapter(R.layout.item_blogtype_view, null);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext);
        rv_view_main.setLayoutManager(linearLayoutManager);
        rv_view_main.setHasFixedSize(true);
        rv_view_main.addItemDecoration(new RecyclerViewDecoration(mContext, LinearLayoutManager.HORIZONTAL, R.drawable.divider_mileage));
        rv_view_main.setAdapter(mAdapter);
        mAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

            @Override
            public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int position) {
                if (mListener != null) {
                    if (currentPositon != position) {
                        currentPositon = position;
                        mListener.BlogType(position);
                        closePopWindow();
                    }
                }
            }
        });
    }
}
Also used : BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) PopupWindow(android.widget.PopupWindow) RecyclerView(android.support.v7.widget.RecyclerView) BlogTypeAdapter(com.qyh.myblog_android.ui.adapter.BlogTypeAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 PopupWindow (android.widget.PopupWindow)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 BlogTypeAdapter (com.qyh.myblog_android.ui.adapter.BlogTypeAdapter)1