private void requestAddReadCount() { PostbrowseAddReadsRequest request = new PostbrowseAddReadsRequest(); request.setPkPosts(mForumInfo.getPkPosts()); Observable<DefaultResponse> ob = RetrofitFactory.getRetorfit(ForumImp.class).postbrowseAddReadsRequest(request); RetrofitUtils.request(mActivity, ob); }
private void requestData() { PostsDetailPostsRequest request = new PostsDetailPostsRequest(); request.setPkPosts(mForumInfo.getPkPosts()); request.setPage(String.valueOf(mPageNum)); Observable<PostsDetailPostsResponse> ob = RetrofitFactory.getRetorfit(ForumImp.class).postsDetailPostsRequest(request); RetrofitUtils.request( mActivity, ob, new RetrofitUtils.ResponseListener<PostsDetailPostsResponse>() { @Override public void beforRequest() {} @Override public void onSuccess(PostsDetailPostsResponse response) { fillData(response); } @Override public void onError(Throwable e) { if (mPageNum == AppConstants.FIRST_NUM) fillEmptyData(); } @Override public void onFinish(boolean isSuccess) { pullDownComplete(); } }); }
private void doStore() { LoginResponse loginInfo = UserManager.getLoginInfo(mActivity); if (null == loginInfo) return; PostFavoritesFavoriteRequest request = new PostFavoritesFavoriteRequest(); request.setPkPosts(mForumInfo.getPkPosts()); request.setFlag(PostFavoritesFavoriteRequest.ADD); request.setPkUser(loginInfo.getDatas().getPkUser()); Observable<DefaultResponse> ob = RetrofitFactory.getRetorfit(ForumImp.class).postFavoritesFavoriteRequest(request); RetrofitUtils.request( mActivity, ob, mBinding.titleBar.getRightView(), new RetrofitUtils.ResponseListener<DefaultResponse>() { @Override public void beforRequest() { showProgressDialog(); } @Override public void onSuccess(DefaultResponse response) { AppToast.show(mActivity, R.string.toast_store_success); } @Override public void onError(Throwable e) {} @Override public void onFinish(boolean isSuccess) { hidenProgressDialog(); } }); }
/** 显示选择列表 */ private void showAction(HeaderForumDetailBinding floor) { ((ForumDetailActivity) mActivity).hidenReply(); PopuFloorHostBinding inflate = DataBindingUtil.inflate( LayoutInflater.from(mActivity), R.layout.popu_floor_host, null, false); View rootView = inflate.getRoot(); ImageView parentView = floor.ivShowAction; AppPopupWindow popupWindow = new AppPopupWindow(mActivity, parentView); inflate.btnReply.setVisibility(View.GONE); inflate.btnComment.setOnClickListener( v -> { popupWindow.dismiss(); Intent intent = new Intent(mActivity, ReplyCommentActivity.class); intent.putExtra(AppConstants.EXTRA_STRING, mForumInfo.getPkPosts()); JumpManager.doJumpForwardWithResult(mActivity, intent, 1002); }); inflate.btnReport.setOnClickListener( v -> { popupWindow.dismiss(); Intent intent = new Intent(mActivity, ReprotActivity.class); intent.putExtra(ReprotActivity.PK_POSTS, mForumInfo.getPkPosts()); intent.putExtra(ReprotActivity.PK_USER, mForumInfo.getPkUser()); intent.putExtra(ReprotActivity.CONTENT, mForumInfo.getContent()); JumpManager.doJumpForward(mActivity, intent); }); popupWindow.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT); popupWindow.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT); popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.setOutsideTouchable(true); popupWindow.setFocusable(true); popupWindow.setContentView(rootView); int[] location = new int[2]; parentView.getLocationOnScreen(location); int x = location[0]; int y = location[1]; rootView.measure(0, 0); popupWindow.showAtLocation( parentView, Gravity.NO_GRAVITY, x + parentView.getWidth() - rootView.getMeasuredWidth(), y + parentView.getHeight() / 2 - rootView.getMeasuredHeight() / 2); }
@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()); }