@Override protected void addHeaderView(ListView listView) { Intent intent = getIntent(); mForumInfo = intent.getParcelableExtra(AppConstants.PARCELABLE_KEY); mBlockInfo = intent.getParcelableExtra(AppConstants.PARCELABLE_KEY_TWO); if (null == mForumInfo) JumpManager.doJumpBack(mActivity); if (TextUtils.isEmpty(mForumInfo.getSectionname())) mForumInfo.setSectionname( null == mBlockInfo ? getString(R.string.string_history) : mBlockInfo.getSectionname()); ReadHistoryManager.add(mForumInfo); HeaderForumDetailBinding inflate = DataBindingUtil.inflate( LayoutInflater.from(mActivity), R.layout.header_forum_detail, null, false); inflate.setImgInfo( new ImgBinding( mForumInfo.getUserImage(), R.drawable.ic_default_head, R.dimen.dimen_30, 10)); inflate.tvName.setOnClickListener( v -> UserManager.jumpToOtherPeople(mActivity, mForumInfo.getPkUser())); inflate.setInfo(mForumInfo); String images = mForumInfo.getImages(); if (!TextUtils.isEmpty(images)) { String[] split = images.split(","); inflate.llImgContent.removeAllViews(); ArrayList<ImgInfo> imgList = new ArrayList<>(); for (String url : split) { ImgInfo info = new ImgInfo(); info.setPath(url); imgList.add(info); } for (int position = 0; position < imgList.size(); position++) { ItemForumImageBinding imgBinding = DataBindingUtil.inflate( LayoutInflater.from(mActivity), R.layout.item_forum_image, null, false); imgBinding.setImgInfo( new ImgBinding(imgList.get(position).getPath(), R.drawable.ic_default_img)); final int currentPosition = position; imgBinding.ivInfo.setOnClickListener( v -> { Intent photoIntent = new Intent(mActivity, PhotoPreviewActivity.class); photoIntent.putParcelableArrayListExtra(AppConstants.PARCELABLE_KEY, imgList); photoIntent.putExtra(PhotoPreviewActivity.POSITION, currentPosition); photoIntent.putExtra(PhotoPreviewActivity.HIDENDELETE, true); JumpManager.doJumpForward(mActivity, photoIntent); }); inflate.llImgContent.addView(imgBinding.getRoot()); } } inflate.tvForumName.setText( mBlockInfo == null ? mForumInfo.getSectionname() : mBlockInfo.getSectionname()); inflate.tvForumName.setOnClickListener(v -> JumpManager.doJumpBack(mActivity)); inflate.ivShowAction.setOnClickListener(v -> showAction(inflate)); listView.addHeaderView(inflate.getRoot()); }
@Override public void initView(ViewDataBinding viewDataBinding) { super.initView(viewDataBinding); mBinding = (ActivityForumDetailBinding) viewDataBinding; mBinding.titleBar.setLeftText(R.string.back); mBinding.titleBar.setLeftListener(v -> JumpManager.doJumpBack(mActivity)); mBinding.titleBar.setRightText(R.string.title_right_store); mBinding.titleBar.setRightListener(V -> doStore()); mRefreshList.getRefreshableView().setVerticalScrollBarEnabled(false); mBinding.rlContent.setChanged( (w, h, oldw, oldh) -> { maxHeight = Math.max(maxHeight, h); if (maxHeight > h) { mRefreshList .getRefreshableView() .setOnTouchListener( (v, event) -> { hidenReply(); return false; }); } else { mRefreshList.getRefreshableView().setOnTouchListener((v, event) -> false); } }); requestAddReadCount(); }