fix: 修复楼中楼无法显示更多
This commit is contained in:
parent
566e776825
commit
6d864de253
|
|
@ -79,6 +79,7 @@ public class RecyclerThreadAdapter extends MultiBaseAdapter<ThreadContentBean.Po
|
||||||
public static final int TYPE_THREAD = 1001;
|
public static final int TYPE_THREAD = 1001;
|
||||||
private static final int TEXT_VIEW_TYPE_CONTENT = 0;
|
private static final int TEXT_VIEW_TYPE_CONTENT = 0;
|
||||||
private static final int TEXT_VIEW_TYPE_FLOOR = 1;
|
private static final int TEXT_VIEW_TYPE_FLOOR = 1;
|
||||||
|
public static final int MAX_SUB_POST_SHOW = 3;
|
||||||
private Map<String, ThreadContentBean.UserInfoBean> userInfoBeanMap;
|
private Map<String, ThreadContentBean.UserInfoBean> userInfoBeanMap;
|
||||||
private NavigationHelper navigationHelper;
|
private NavigationHelper navigationHelper;
|
||||||
private LinearLayout.LayoutParams defaultLayoutParams;
|
private LinearLayout.LayoutParams defaultLayoutParams;
|
||||||
|
|
@ -344,14 +345,15 @@ public class RecyclerThreadAdapter extends MultiBaseAdapter<ThreadContentBean.Po
|
||||||
TextView more = holder.getView(R.id.thread_list_item_content_floor_more);
|
TextView more = holder.getView(R.id.thread_list_item_content_floor_more);
|
||||||
MyLinearLayout myLinearLayout = holder.getView(R.id.thread_list_item_content_floor);
|
MyLinearLayout myLinearLayout = holder.getView(R.id.thread_list_item_content_floor);
|
||||||
myLinearLayout.removeAllViews();
|
myLinearLayout.removeAllViews();
|
||||||
if (bean.getSubPostList().getSubPostList() != null && bean.getSubPostList().getSubPostList().size() > 0) {
|
if (bean.getSubPostNumber() != null && bean.getSubPostList() != null && bean.getSubPostList().getSubPostList() != null && bean.getSubPostList().getSubPostList().size() > 0) {
|
||||||
holder.setVisibility(R.id.thread_list_item_content_floor_card, View.VISIBLE);
|
holder.setVisibility(R.id.thread_list_item_content_floor_card, View.VISIBLE);
|
||||||
int count = Integer.valueOf(bean.getSubPostNumber());
|
int count = Integer.parseInt(bean.getSubPostNumber());
|
||||||
List<ThreadContentBean.PostListItemBean> postListItemBeans = bean.getSubPostList().getSubPostList();
|
List<ThreadContentBean.PostListItemBean> subPostList = bean.getSubPostList().getSubPostList();
|
||||||
List<ThreadContentBean.PostListItemBean> subPostList = postListItemBeans;
|
|
||||||
List<View> views = new ArrayList<>();
|
List<View> views = new ArrayList<>();
|
||||||
if (postListItemBeans.size() > 3) {
|
if (subPostList.size() > MAX_SUB_POST_SHOW) {
|
||||||
subPostList = subPostList.subList(0, 3);
|
subPostList = subPostList.subList(0, MAX_SUB_POST_SHOW);
|
||||||
|
holder.setVisibility(R.id.thread_list_item_content_floor_more, View.VISIBLE);
|
||||||
|
} else if (subPostList.size() < count) {
|
||||||
holder.setVisibility(R.id.thread_list_item_content_floor_more, View.VISIBLE);
|
holder.setVisibility(R.id.thread_list_item_content_floor_more, View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
holder.setVisibility(R.id.thread_list_item_content_floor_more, View.GONE);
|
holder.setVisibility(R.id.thread_list_item_content_floor_more, View.GONE);
|
||||||
|
|
@ -360,14 +362,16 @@ public class RecyclerThreadAdapter extends MultiBaseAdapter<ThreadContentBean.Po
|
||||||
for (ThreadContentBean.PostListItemBean postListItemBean : subPostList) {
|
for (ThreadContentBean.PostListItemBean postListItemBean : subPostList) {
|
||||||
views.add(getContentView(postListItemBean, bean));
|
views.add(getContentView(postListItemBean, bean));
|
||||||
}
|
}
|
||||||
|
myLinearLayout.addViews(views);
|
||||||
more.setOnClickListener(view -> {
|
more.setOnClickListener(view -> {
|
||||||
try {
|
try {
|
||||||
if (postListItemBeans.size() < Integer.parseInt(bean.getSubPostNumber())) {
|
if (bean.getSubPostList().getSubPostList().size() < count) {
|
||||||
FloorFragment.newInstance(threadBean.getId(), bean.getSubPostList().getPid(), "", true).show(((BaseActivity) mContext).getSupportFragmentManager(), threadBean.getId() + "_Floor");
|
FloorFragment.newInstance(threadBean.getId(), bean.getSubPostList().getPid(), null, true)
|
||||||
|
.show(((BaseActivity) mContext).getSupportFragmentManager(), threadBean.getId() + "_Floor");
|
||||||
} else {
|
} else {
|
||||||
myLinearLayout.removeAllViews();
|
myLinearLayout.removeAllViews();
|
||||||
List<View> newViews = new ArrayList<>();
|
List<View> newViews = new ArrayList<>();
|
||||||
for (ThreadContentBean.PostListItemBean postListItemBean : postListItemBeans) {
|
for (ThreadContentBean.PostListItemBean postListItemBean : bean.getSubPostList().getSubPostList()) {
|
||||||
newViews.add(getContentView(postListItemBean, bean));
|
newViews.add(getContentView(postListItemBean, bean));
|
||||||
}
|
}
|
||||||
myLinearLayout.addViews(newViews);
|
myLinearLayout.addViews(newViews);
|
||||||
|
|
@ -377,7 +381,6 @@ public class RecyclerThreadAdapter extends MultiBaseAdapter<ThreadContentBean.Po
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
myLinearLayout.addViews(views);
|
|
||||||
} else {
|
} else {
|
||||||
holder.setVisibility(R.id.thread_list_item_content_floor_card, View.GONE);
|
holder.setVisibility(R.id.thread_list_item_content_floor_card, View.GONE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,12 +206,12 @@ class FloorFragment : BaseBottomSheetDialogFragment() {
|
||||||
const val PARAM_JUMP = "jump"
|
const val PARAM_JUMP = "jump"
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
fun newInstance(tid: String?, pid: String?, spid: String? = "", jump: Boolean = false): FloorFragment {
|
fun newInstance(tid: String?, pid: String?, spid: String? = null, jump: Boolean = false): FloorFragment {
|
||||||
val fragment = FloorFragment()
|
val fragment = FloorFragment()
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putString(PARAM_TID, tid)
|
bundle.putString(PARAM_TID, tid)
|
||||||
bundle.putString(PARAM_PID, pid)
|
bundle.putString(PARAM_PID, pid)
|
||||||
bundle.putString(PARAM_SUB_POST_ID, spid)
|
bundle.putString(PARAM_SUB_POST_ID, spid ?: "")
|
||||||
bundle.putBoolean(PARAM_JUMP, jump)
|
bundle.putBoolean(PARAM_JUMP, jump)
|
||||||
fragment.arguments = bundle
|
fragment.arguments = bundle
|
||||||
return fragment
|
return fragment
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
versionCode=38202
|
versionCode=38300
|
||||||
versionName=3.8.3
|
versionName=3.8.3
|
||||||
isPerRelease=true
|
isPerRelease=false
|
||||||
preReleaseName=beta
|
preReleaseName=beta
|
||||||
preReleaseVer=2
|
preReleaseVer=2
|
||||||
Loading…
Reference in New Issue