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();
}
}
}
});
}
}
Aggregations