> } 68 60
@ -97,23 +89,15 @@ public class UserPageAdapter extends RecyclerView.Adapter<IViewHolder> {
97 89
98 90
    @Override
99 91
    public int getItemViewType(int position) {
100
        if (position == getItemCount()) {
101
            return TOPIC_DETAIL_FOOTER;
102
        }  else {
103
            return TOPIC_DETAIL_CONTENT;
104
        }
92
        return position == beanLab.beans().size() ? TOPIC_DETAIL_FOOTER : TOPIC_DETAIL_CONTENT;
105 93
    }
106 94
107 95
    @Override
108 96
    public int getItemCount() {
109
        return beanLab.beans().size() + 1;
97
        return beanLab.beans().size() + 1 ;
110 98
    }
111 99
112
113 100
    private void bindContentViewHolder(IViewHolder viewHolder, final int position) {
114
        if (beanLab.beans().size() == 0 || position >= beanLab.beans().size()) {
115
            return;
116
        }
117 101
118 102
        final ChatRecommendBean bean = beanLab.beans().get(position);
119 103
        TopicDetailAdapter.ContentViewHolder contentViewHolder = (TopicDetailAdapter.ContentViewHolder) viewHolder;
@ -180,26 +164,17 @@ public class UserPageAdapter extends RecyclerView.Adapter<IViewHolder> {
180 164
        TopicDetailAdapter.FooterViewHolder footerViewHolder = (TopicDetailAdapter.FooterViewHolder) viewHolder;
181 165
        StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) footerViewHolder.footerContainer.getLayoutParams();
182 166
        layoutParams.setFullSpan(true);
183
184 167
        footerViewHolder.footerContainer.setVisibility(showFooter ? View.VISIBLE : View.GONE);
185 168
186
        ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) footerViewHolder.footerView.getLayoutParams();
187
        if (TopicDetailBeanLab.get(context).beans().size() == 0) {
188
            footerViewHolder.footTextView.setText("还没有任何内容哦,快来抢沙发~");
189
            params.height = DensityUtil.dip2px(context, (screenHeight - headerHeight - statusHeight) / 4);
190
            params.bottomMargin = 0;
191
        } else {
169
        ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams)footerViewHolder.footerView.getLayoutParams();
170
        if (showFooter) {
192 171
            footerViewHolder.footTextView.setText("已经全部加载完毕");
193 172
            params.height = DensityUtil.dip2px(context, 20);
194
            params.bottomMargin = DensityUtil.dip2px(context, 10);
195
        }
196
197
        if (showFooter == false) {
198
            params.height = 0;
199
            params.bottomMargin = DensityUtil.dip2px(context, 10);
173
        } else {
174
            footerViewHolder.footTextView.setText("");
175
            params.height = 1;
200 176
        }
201
202
        footerViewHolder.footTextView.setLayoutParams(params);
177
        footerViewHolder.footerView.setLayoutParams(params);
203 178
    }
204 179
205 180
    /**
@ -208,7 +183,7 @@ public class UserPageAdapter extends RecyclerView.Adapter<IViewHolder> {
208 183
     * @param position
209 184
     */
210 185
    private void doLike(final int position) {
211
        final ChatRecommendBean bean = TopicDetailBeanLab.get(context).beans().get(position);
186
        final ChatRecommendBean bean = UserPageBeanLab.get(context).beans().get(position);
212 187
        String url = MainApplication.urlNew + "/topic/like.do";
213 188
        Map<String, String> map = new HashMap<>();
214 189
        map.put("targetId", bean.targetId + "");
@ -252,6 +227,6 @@ public class UserPageAdapter extends RecyclerView.Adapter<IViewHolder> {
252 227
253 228
    public void setFooterData(Boolean showFooter) {
254 229
        this.showFooter = showFooter;
255
        notifyItemRangeChanged(getItemCount(), 1);
230
        notifyItemRangeChanged(beanLab.beans().size(), 1);
256 231
    }
257 232
}

+ 1 - 0
app/src/main/res/layout/activity_user_page.xml

@ -158,6 +158,7 @@
158 158
                    app:layout_constraintTop_toTopOf="parent" />
159 159
160 160
                <TextView
161
                    android:id="@+id/topicNum"
161 162
                    android:layout_width="wrap_content"
162 163
                    android:layout_height="wrap_content"
163 164
                    android:paddingLeft="5dp"

Fred Reiter - Gogs: Go Git Service
crypto-games-casino7795 (Fred Reiter)

abonnés