/td>
|
|
17
|
|
|
|
18
|
import com.aspsine.irecyclerview.IViewHolder;
|
|
|
19
|
import com.electric.chargingpile.R;
|
|
|
20
|
import com.electric.chargingpile.application.MainApplication;
|
|
|
21
|
import com.electric.chargingpile.data.ChatRecommendBean;
|
|
|
22
|
import com.electric.chargingpile.iview.RecyclerItemTypeClickListener;
|
|
|
23
|
import com.electric.chargingpile.util.CircleTransform;
|
|
|
24
|
import com.electric.chargingpile.util.DensityUtil;
|
|
|
25
|
import com.electric.chargingpile.util.ImageDisplayUtils;
|
|
|
26
|
import com.electric.chargingpile.util.JsonUtils;
|
|
|
27
|
import com.electric.chargingpile.util.ScreenUtils;
|
|
|
28
|
import com.electric.chargingpile.util.ToastUtil;
|
|
|
29
|
import com.squareup.picasso.Picasso;
|
|
|
30
|
import com.zhy.http.okhttp.OkHttpUtils;
|
|
|
31
|
import com.zhy.http.okhttp.callback.StringCallback;
|
|
|
32
|
|
|
|
33
|
import java.util.ArrayList;
|
|
|
34
|
import java.util.HashMap;
|
|
|
35
|
import java.util.Map;
|
|
|
36
|
|
|
|
37
|
import okhttp3.Call;
|
|
|
38
|
|
|
|
39
|
public class ChatRecommendAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
|
40
|
private static final String TAG = "ChatRecommendAdapter";
|
|
|
41
|
private static final int TYPE_HEADER = 1, TYPE_ITEM = 2;
|
|
|
42
|
private Context context;
|
|
|
43
|
private final LayoutInflater layoutInflater;
|
|
|
44
|
private ArrayList<ChatRecommendBean> chatRecommendBeans;
|
|
|
45
|
private ArrayList<ChatRecommendBean> chatHeaderRecommendBeans;
|
|
|
46
|
private final int screenWidth;
|
|
|
47
|
private int talkItemWidth;
|
|
|
48
|
private OnItemClickListener onItemClickListener;
|
|
|
49
|
private RecyclerItemTypeClickListener onRecyclerItemClickListener;
|
|
|
50
|
|
|
|
51
|
public ChatRecommendAdapter(Context context) {
|
|
|
52
|
this.context = context;
|
|
|
53
|
layoutInflater = LayoutInflater.from(context);
|
|
|
54
|
chatRecommendBeans = new ArrayList<>();
|
|
|
55
|
chatHeaderRecommendBeans = new ArrayList<>();
|
|
|
56
|
screenWidth = ScreenUtils.getScreenWidth(context);
|
|
|
57
|
talkItemWidth = (screenWidth - DensityUtil.dip2px(context, 10 * 2)) / 2;
|
|
|
58
|
}
|
|
|
59
|
|
|
|
60
|
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
|
|
|
61
|
this.onItemClickListener = onItemClickListener;
|
|
|
62
|
}
|
|
|
63
|
|
|
|
64
|
public void setData(ArrayList<ChatRecommendBean> data) {
|
|
|
65
|
chatRecommendBeans = data;
|
|
|
66
|
notifyItemRangeInserted(0, chatHeaderRecommendBeans.size() + chatRecommendBeans.size());
|
|
|
67
|
}
|
|
|
68
|
|
|
|
69
|
public void addData(ArrayList<ChatRecommendBean> data) {
|
|
|
70
|
int size = chatRecommendBeans.size();
|
|
|
71
|
chatRecommendBeans.addAll(data);
|
|
|
72
|
notifyItemRangeInserted(size, chatRecommendBeans.size());
|
|
|
73
|
}
|
|
|
74
|
|
|
|
75
|
public ArrayList<ChatRecommendBean> getCurrentData() {
|
|
|
76
|
return chatRecommendBeans;
|
|
|
77
|
}
|
|
|
78
|
|
|
|
79
|
public void setHeaderData(ArrayList<ChatRecommendBean> data) {
|
|
|
80
|
chatRecommendBeans.clear();
|
|
|
81
|
chatHeaderRecommendBeans = data;
|
|
|
82
|
}
|
|
|
83
|
|
|
|
84
|
public void setOnRecyclerItemClickListener(RecyclerItemTypeClickListener onRecyclerItemClickListener) {
|
|
|
85
|
this.onRecyclerItemClickListener = onRecyclerItemClickListener;
|
|
|
86
|
}
|
|
|
87
|
|
|
|
88
|
@Override
|
|
|
89
|
public int getItemViewType(int position) {
|
|
|
90
|
// 位置为0的话类型为头部,其余为内容
|
|
|
91
|
return position = position == 0 ? TYPE_HEADER : TYPE_ITEM;
|
|
|
92
|
}
|
|
|
93
|
|
|
|
94
|
@Override
|
|
|
95
|
public int getItemCount() {
|
|
|
96
|
// 加一是因为添加了头部
|
|
|
97
|
return chatRecommendBeans.size() + 1;
|
|
|
98
|
}
|
|
|
99
|
|
|
|
100
|
@Override
|
|
|
101
|
public IViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
|
102
|
View view = null;
|
|
|
103
|
IViewHolder holer = null;
|
|
|
104
|
switch (viewType) {
|
|
|
105
|
case TYPE_HEADER:
|
|
|
106
|
view = layoutInflater.inflate(R.layout.view_chat_header_recommend, parent, false);
|
|
|
107
|
holer = new SimpleHeaderViewHolder(view);
|
|
|
108
|
break;
|
|
|
109
|
case TYPE_ITEM:
|
|
|
110
|
view = layoutInflater.inflate(R.layout.view_chat_recommend, parent, false);
|
|
|
111
|
holer = new SimpleViewHolder(view);
|
|
|
112
|
break;
|
|
|
113
|
}
|
|
|
114
|
return holer;
|
|
|
115
|
}
|
|
|
116
|
|
|
|
117
|
@Override
|
|
|
118
|
public void onBindViewHolder(IViewHolder holder, int position) {
|
|
|
119
|
switch (holder.getItemViewType()) {
|
|
|
120
|
case TYPE_HEADER: // 话题列表设置
|
|
|
121
|
setHeaderHolder(holder, position);
|
|
|
122
|
break;
|
|
|
123
|
case TYPE_ITEM: // 信息列表设置
|
|
|
124
|
setListHolder(holder, position);
|
|
|
125
|
break;
|
|
|
126
|
}
|
|
|
127
|
}
|
|
|
128
|
|
|
|
129
|
private void setListHolder(IViewHolder holder, final int position) {
|
|
|
130
|
|
|
|
131
|
final ChatRecommendBean chatRecommendBean = chatRecommendBeans.get(position - 1);
|
|
|
132
|
SimpleViewHolder simpleViewHolder = (SimpleViewHolder) holder;
|
|
|
133
|
simpleViewHolder.index = position - 1;
|
|
|
134
|
RelativeLayout.LayoutParams bgParams = (RelativeLayout.LayoutParams) simpleViewHolder.info_bg_icon.getLayoutParams();
|
|
|
135
|
bgParams.width = talkItemWidth;
|
|
|
136
|
if (chatRecommendBean.targetType == ChatRecommendBean.TARGET_TYPE_IMAGE_TOPIC) { // 话题
|
|
|
137
|
bgParams.height = (int) (talkItemWidth * 365f / 480f);
|
|
|
138
|
simpleViewHolder.bottom_view.setVisibility(View.GONE);
|
|
|
139
|
simpleViewHolder.topic_back.setVisibility(View.VISIBLE);
|
|
|
140
|
simpleViewHolder.recycler_view_title.setVisibility(View.GONE);
|
|
|
141
|
simpleViewHolder.topic_title.setVisibility(View.VISIBLE);
|
|
|
142
|
|
|
|
143
|
// 设置话题半透明层
|
|
|
144
|
RelativeLayout.LayoutParams tbParams = (RelativeLayout.LayoutParams) simpleViewHolder.topic_back.getLayoutParams();
|
|
|
145
|
tbParams.height = bgParams.height;
|
|
|
146
|
tbParams.width = bgParams.width;
|
|
|
147
|
simpleViewHolder.topic_back.setLayoutParams(tbParams);
|
|
|
148
|
// 设置话题标题
|
|
|
149
|
simpleViewHolder.topic_title.setText(chatRecommendBean.title);
|
|
|
150
|
|
|
|
151
|
} else {
|
|
|
152
|
if (chatRecommendBean.coverImgW == 0 || chatRecommendBean.coverImgH == 0) {
|
|
|
153
|
bgParams.height = (int) (talkItemWidth * 16f / 9f);
|
|
|
154
|
} else {
|
|
|
155
|
if ((float) chatRecommendBean.coverImgH / chatRecommendBean.coverImgW > 16f / 9f) {
|
|
|
156
|
bgParams.height = (int) (talkItemWidth * 16f / 9f);
|
|
|
157
|
} else {
|
|
|
158
|
bgParams.height = (int) ((float) talkItemWidth * chatRecommendBean.coverImgH / chatRecommendBean.coverImgW);
|
|
|
159
|
}
|
|
|
160
|
|
|
|
161
|
simpleViewHolder.bottom_view.setVisibility(View.VISIBLE);
|
|
|
162
|
simpleViewHolder.topic_back.setVisibility(View.GONE);
|
|
|
163
|
simpleViewHolder.recycler_view_title.setVisibility(View.VISIBLE);
|
|
|
164
|
simpleViewHolder.topic_title.setVisibility(View.GONE);
|
|
|
165
|
// 红心点赞
|
|
|
166
|
if (chatRecommendBean.likeFlg == 0) {
|
|
|
167
|
simpleViewHolder.recycler_view_zan_icon.setBackgroundResource(R.drawable.app_talk_main_list_zan_icon);
|
|
|
168
|
} else {
|
|
|
169
|
simpleViewHolder.recycler_view_zan_icon.setBackgroundResource(R.drawable.app_talk_main_list_zan_red_icon);
|
|
|
170
|
}
|
|
|
171
|
// 标题设置
|
|
|
172
|
if (TextUtils.isEmpty(chatRecommendBean.title)) {
|
|
|
173
|
simpleViewHolder.recycler_view_title.setText("分享内容");
|
|
|
174
|
} else {
|
|
|
175
|
simpleViewHolder.recycler_view_title.setText(position - 1 + ":" + chatRecommendBean.targetId + ":" + chatRecommendBean.title.substring(0, 5));
|
|
|
176
|
}
|
|
|
177
|
|
|
|
178
|
if (chatRecommendBean.likeNums == 0) {
|
|
|
179
|
simpleViewHolder.recycler_view_zan.setVisibility(View.GONE);
|
|
|
180
|
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) simpleViewHolder.recycler_view_zan_icon.getLayoutParams();
|
|
|
181
|
params.rightMargin = DensityUtil.dip2px(context, 10);
|
|
|
182
|
simpleViewHolder.recycler_view_zan_icon.setLayoutParams(params);
|
|
|
183
|
} else if (chatRecommendBean.likeNums > 999) {
|
|
|
184
|
simpleViewHolder.recycler_view_zan.setVisibility(View.VISIBLE);
|
|
|
185
|
simpleViewHolder.recycler_view_zan.setText("999+");
|
|
|
186
|
} else {
|
|
|
187
|
simpleViewHolder.recycler_view_zan.setVisibility(View.VISIBLE);
|
|
|
188
|
simpleViewHolder.recycler_view_zan.setText(chatRecommendBean.likeNums + "");
|
|
|
189
|
}
|
|
|
190
|
|
|
|
191
|
simpleViewHolder.user_avater_name.setText(chatRecommendBean.nickName);
|
|
|
192
|
}
|
|
|
193
|
}
|
|
|
194
|
|
|
|
195
|
if (chatRecommendBean.isTop == 0) {
|
|
|
196
|
simpleViewHolder.is_top_view.setVisibility(View.GONE);
|
|
|
197
|
} else {
|
|
|
198
|
simpleViewHolder.is_top_view.setBackgroundResource(R.drawable.corner_view);
|
|
|
199
|
simpleViewHolder.is_top_view.setVisibility(View.VISIBLE);
|
|
|
200
|
}
|
|
|
201
|
|
|
|
202
|
if (chatRecommendBean.targetType == ChatRecommendBean.TARGET_TYPE_VIDEO) {
|
|
|
203
|
simpleViewHolder.info_id_video_icon.setVisibility(View.VISIBLE);
|
|
|
204
|
} else {
|
|
|
205
|
simpleViewHolder.info_id_video_icon.setVisibility(View.GONE);
|
|
|
206
|
}
|
|
|
207
|
simpleViewHolder.info_bg_icon.setLayoutParams(bgParams);
|
|
|
208
|
|
|
|
209
|
|
|
|
210
|
ImageDisplayUtils.dispalyImg(context, chatRecommendBean.coverImgUrl, simpleViewHolder.info_bg_icon);
|
|
|
211
|
|
|
|
212
|
if (TextUtils.isEmpty(chatRecommendBean.headImgUrl)) {
|
|
|
213
|
Picasso.with(context)
|
|
|
214
|
.load(R.drawable.icon_face2_0)
|
|
|
215
|
.placeholder(R.drawable.icon_face2_0)
|
|
|
216
|
.error(R.drawable.icon_face2_0)
|
|
|
217
|
.transform(new CircleTransform())
|
|
|
218
|
.into(simpleViewHolder.user_avater);
|
|
|
219
|
} else {
|
|
|
220
|
Picasso.with(context)
|
|
|
221
|
.load("http://cdz.evcharge.cc/zhannew/uploadfile/" + chatRecommendBean.headImgUrl)
|
|
|
222
|
.placeholder(R.drawable.icon_face2_0)
|
|
|
223
|
.error(R.drawable.icon_face2_0)
|
|
|
224
|
.transform(new CircleTransform())
|
|
|
225
|
.into(simpleViewHolder.user_avater);
|
|
|
226
|
}
|
|
|
227
|
|
|
|
228
|
}
|
|
|
229
|
|
|
|
230
|
private void setHeaderHolder(IViewHolder holder, int position) {
|
|
|
231
|
// 获取chat_header_linear_layout的布局属性,记住这里
|
|
|
232
|
// 要是布局的最外层的控件的布局属性,如果是里层的会报cast错误
|
|
|
233
|
SimpleHeaderViewHolder simpleHeaderViewHolder = (SimpleHeaderViewHolder) holder;
|
|
|
234
|
StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) simpleHeaderViewHolder.chat_header_linear_layout.getLayoutParams();
|
|
|
235
|
// 最最关键一步,设置当前view占满列数,这样就可以占据两列实现头部了
|
|
|
236
|
params.setFullSpan(true);
|
|
|
237
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
|
|
|
238
|
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
|
|
239
|
simpleHeaderViewHolder.chat_header_recycler_view.setLayoutManager(linearLayoutManager);
|
|
|
240
|
ChatHeaderRecommendAdapter chatHeaderRecommendAdapter = new ChatHeaderRecommendAdapter(context);
|
|
|
241
|
simpleHeaderViewHolder.chat_header_recycler_view.setAdapter(chatHeaderRecommendAdapter);
|
|
|
242
|
chatHeaderRecommendAdapter.setData(chatHeaderRecommendBeans);
|
|
|
243
|
|
|
|
244
|
chatHeaderRecommendAdapter.setOnRecyclerItemClickListener(new RecyclerItemTypeClickListener() {
|
|
|
245
|
@Override
|
|
|
246
|
public void onItemClickListener(int position, int type) {
|
|
|
247
|
String topicId = chatHeaderRecommendBeans.get(position).topicId + "";
|
|
|
248
|
ToastUtil.showToast(context, "position:" + position + ", type:" + type, Toast.LENGTH_SHORT);
|
|
|
249
|
// context.startActivity(new Intent(context,)); // TODO 跳转到顶部话题详情页
|
|
|
250
|
}
|
|
|
251
|
});
|
|
|
252
|
|
|
|
253
|
}
|
|
|
254
|
|
|
|
255
|
|
|
|
256
|
public static interface OnItemClickListener {
|
|
|
257
|
void onItemClick(View view);
|
|
|
258
|
}
|
|
|
259
|
|
|
|
260
|
class SimpleViewHolder extends IViewHolder {
|
|
|
261
|
private int index;
|
|
|
262
|
RelativeLayout card_view;
|
|
|
263
|
TextView recycler_view_title;
|
|
|
264
|
TextView recycler_view_zan;
|
|
|
265
|
TextView user_avater_name;
|
|
|
266
|
TextView is_top_view;
|
|
|
267
|
ImageView user_avater;
|
|
|
268
|
ImageView recycler_view_zan_icon;
|
|
|
269
|
ImageView info_bg_icon;
|
|
|
270
|
ImageView info_id_video_icon;
|
|
|
271
|
RelativeLayout bottom_view;
|
|
|
272
|
ImageView topic_back;
|
|
|
273
|
TextView topic_title;
|
|
|
274
|
|
|
|
275
|
public SimpleViewHolder(View view) {
|
|
|
276
|
super(view);
|
|
|
277
|
card_view = view.findViewById(R.id.card_view);
|
|
|
278
|
recycler_view_title = (TextView) view.findViewById(R.id.recycler_view_title);
|
|
|
279
|
user_avater_name = (TextView) view.findViewById(R.id.user_avater_name);
|
|
|
280
|
is_top_view = (TextView) view.findViewById(R.id.is_top_view);
|
|
|
281
|
recycler_view_zan = (TextView) view.findViewById(R.id.recycler_view_zan);
|
|
|
282
|
user_avater = (ImageView) view.findViewById(R.id.user_avater);
|
|
|
283
|
recycler_view_zan_icon = view.findViewById(R.id.recycler_view_zan_icon);
|
|
|
284
|
info_bg_icon = (ImageView) view.findViewById(R.id.info_bg_icon);
|
|
|
285
|
info_id_video_icon = (ImageView) view.findViewById(R.id.info_id_video_icon);
|
|
|
286
|
bottom_view = view.findViewById(R.id.bottom_view);
|
|
|
287
|
topic_back = view.findViewById(R.id.topic_back);
|
|
|
288
|
topic_title = view.findViewById(R.id.topic_title);
|
|
|
289
|
|
|
|
290
|
itemView.setOnClickListener(new View.OnClickListener() {
|
|
|
291
|
@Override
|
|
|
292
|
public void onClick(View view) {
|
|
|
293
|
if (onRecyclerItemClickListener != null) {
|
|
|
294
|
onRecyclerItemClickListener.onItemClickListener(getLayoutPosition(), 2);
|
|
|
295
|
}
|
|
|
296
|
}
|
|
|
297
|
});
|
|
|
298
|
recycler_view_zan_icon.setOnClickListener(new View.OnClickListener() {
|
|
|
299
|
@Override
|
|
|
300
|
public void onClick(View view) { // 点赞操作
|
|
|
301
|
ChatRecommendBean talkRecommendBean = chatRecommendBeans.get(index);
|
|
|
302
|
String url = MainApplication.urlNew + "/topic/like.do";
|
|
|
303
|
Map<String, String> map = new HashMap<>();
|
|
|
304
|
if (MainApplication.isLogin()) {
|
|
|
305
|
map.put("userId", MainApplication.userId);
|
|
|
306
|
}
|
|
|
307
|
map.put("targetId", talkRecommendBean.targetId + "");
|
|
|
308
|
map.put("targetType", talkRecommendBean.targetType + "");
|
|
|
309
|
map.put("flag", "1");
|
|
|
310
|
map.put("authorId", talkRecommendBean.addUserId + "");
|
|
|
311
|
Log.d(TAG, "onClick: " + map);
|
|
|
312
|
OkHttpUtils.get().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
|
|
|
313
|
@Override
|
|
|
314
|
public void onError(Call call, Exception e) {
|
|
|
315
|
ToastUtil.showToast(context, "点赞失败,请重试", Toast.LENGTH_SHORT);
|
|
|
316
|
}
|
|
|
317
|
|
|
|
318
|
@Override
|
|
|
319
|
public void onResponse(String response) {
|
|
|
320
|
Log.d(TAG, "onResponse: " + response);
|
|
|
321
|
String rtnCode = JsonUtils.getKeyResult(response, "code");
|
|
|
322
|
String desc = JsonUtils.getKeyResult(response, "desc");
|
|
|
323
|
if ("1000".equals(rtnCode)) {
|
|
|
324
|
recycler_view_zan_icon.setBackgroundResource(R.drawable.app_talk_main_list_zan_red_icon);
|
|
|
325
|
} else {
|
|
|
326
|
ToastUtil.showToast(context, desc, Toast.LENGTH_SHORT);
|
|
|
327
|
}
|
|
|
328
|
}
|
|
|
329
|
});
|
|
|
330
|
}
|
|
|
331
|
});
|
|
|
332
|
}
|
|
|
333
|
|
|
|
334
|
|
|
|
335
|
public int getIndex() {
|
|
|
336
|
return index;
|
|
|
337
|
}
|
|
|
338
|
|
|
|
339
|
public void setIndex(int index) {
|
|
|
340
|
this.index = index;
|
|
|
341
|
}
|
|
|
342
|
}
|
|
|
343
|
|
|
|
344
|
class SimpleHeaderViewHolder extends IViewHolder {
|
|
|
345
|
LinearLayout chat_header_linear_layout;
|
|
|
346
|
RecyclerView chat_header_recycler_view;
|
|
|
347
|
|
|
|
348
|
public SimpleHeaderViewHolder(View view) {
|
|
|
349
|
super(view);
|
|
|
350
|
chat_header_linear_layout = view.findViewById(R.id.chat_header_linear_layout);
|
|
|
351
|
chat_header_recycler_view = view.findViewById(R.id.chat_header_recycler_view);
|
|
|
352
|
}
|
|
|
353
|
}
|
|
|
354
|
}
|
|
|
@ -0,0 +1,32 @@
|
|
|
1
|
package com.electric.chargingpile.adapter;
|
|
|
2
|
|
|
|
3
|
import android.graphics.Rect;
|
|
|
4
|
import android.support.v7.widget.RecyclerView;
|
|
|
5
|
import android.support.v7.widget.StaggeredGridLayoutManager;
|
|
|
6
|
import android.util.Log;
|
|
|
7
|
import android.view.View;
|
|
|
8
|
|
|
|
9
|
import com.electric.chargingpile.util.DensityUtil;
|
|
|
10
|
|
|
|
11
|
public class ChatRecommendItemDecoration extends RecyclerView.ItemDecoration {
|
|
|
12
|
private static final String TAG = "ChatRecommendItemDecoration";
|
|
|
13
|
private StaggeredGridLayoutManager.LayoutParams layoutParams;
|
|
|
14
|
|
|
|
15
|
@Override
|
|
|
16
|
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
|
|
17
|
layoutParams = (StaggeredGridLayoutManager.LayoutParams)view.getLayoutParams();
|
|
|
18
|
|
|
|
19
|
int position = parent.getChildAdapterPosition(view);
|
|
|
20
|
Log.d(TAG, "getItemOffsets: " + position + view.getClass() + ":" + parent.getClass());
|
|
|
21
|
if (position > 0) {
|
|
|
22
|
if (layoutParams.getSpanIndex() %2 == 0) {
|
|
|
23
|
outRect.left = DensityUtil.dip2px(view.getContext(), 15);
|
|
|
24
|
outRect.right = DensityUtil.dip2px(view.getContext(), 5);
|
|
|
25
|
} else {
|
|
|
26
|
outRect.right = DensityUtil.dip2px(view.getContext(), 15);
|
|
|
27
|
outRect.left = DensityUtil.dip2px(view.getContext(), 5);
|
|
|
28
|
}
|
|
|
29
|
}
|
|
|
30
|
|
|
|
31
|
}
|
|
|
32
|
}
|
|
|
@ -2,10 +2,12 @@ package com.electric.chargingpile.adapter;
|
|
2
|
2
|
|
|
3
|
3
|
import android.content.Context;
|
|
4
|
4
|
import android.content.Intent;
|
|
|
5
|
import android.graphics.Color;
|
|
5
|
6
|
import android.support.v7.widget.LinearLayoutManager;
|
|
6
|
7
|
import android.support.v7.widget.RecyclerView;
|
|
7
|
8
|
import android.support.v7.widget.StaggeredGridLayoutManager;
|
|
8
|
9
|
import android.text.TextUtils;
|
|
|
10
|
import android.util.Log;
|
|
9
|
11
|
import android.view.LayoutInflater;
|
|
10
|
12
|
import android.view.View;
|
|
11
|
13
|
import android.view.ViewGroup;
|
|
|
@ -13,18 +15,29 @@ import android.widget.ImageView;
|
|
13
|
15
|
import android.widget.LinearLayout;
|
|
14
|
16
|
import android.widget.RelativeLayout;
|
|
15
|
17
|
import android.widget.TextView;
|
|
|
18
|
import android.widget.Toast;
|
|
16
|
19
|
|
|
17
|
20
|
import com.aspsine.irecyclerview.IViewHolder;
|
|
18
|
21
|
import com.electric.chargingpile.R;
|
|
19
|
22
|
import com.electric.chargingpile.activity.TopicDetailsActivity;
|
|
|
23
|
import com.electric.chargingpile.application.MainApplication;
|
|
20
|
24
|
import com.electric.chargingpile.data.TalkRecommendBean;
|
|
21
|
25
|
import com.electric.chargingpile.iview.RecyclerItemTypeClickListener;
|
|
22
|
26
|
import com.electric.chargingpile.util.CircleTransform;
|
|
|
27
|
import com.electric.chargingpile.util.DensityUtil;
|
|
23
|
28
|
import com.electric.chargingpile.util.ImageDisplayUtils;
|
|
|
29
|
import com.electric.chargingpile.util.JsonUtils;
|
|
24
|
30
|
import com.electric.chargingpile.util.ScreenUtils;
|
|
|
31
|
import com.electric.chargingpile.util.ToastUtil;
|
|
25
|
32
|
import com.squareup.picasso.Picasso;
|
|
|
33
|
import com.zhy.http.okhttp.OkHttpUtils;
|
|
|
34
|
import com.zhy.http.okhttp.callback.StringCallback;
|
|
26
|
35
|
|
|
27
|
36
|
import java.util.ArrayList;
|
|
|
37
|
import java.util.HashMap;
|
|
|
38
|
import java.util.Map;
|
|
|
39
|
|
|
|
40
|
import okhttp3.Call;
|
|
28
|
41
|
|
|
29
|
42
|
public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
30
|
43
|
|
|
|
@ -37,6 +50,8 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
37
|
50
|
private RecyclerItemTypeClickListener onRecyclerItemClickListener;
|
|
38
|
51
|
private OnItemClickListener onItemClickListener;
|
|
39
|
52
|
private int screenWidth;
|
|
|
53
|
private int talkItemWidth;
|
|
|
54
|
private int mPosition;
|
|
40
|
55
|
|
|
41
|
56
|
public LayoutAdapter(Context context) {
|
|
42
|
57
|
this.context = context;
|
|
|
@ -44,6 +59,7 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
44
|
59
|
talkRecommendBeans = new ArrayList<>();
|
|
45
|
60
|
talkHeaderRecommendBeans = new ArrayList<>();
|
|
46
|
61
|
screenWidth = ScreenUtils.getScreenWidth(context);
|
|
|
62
|
talkItemWidth = (screenWidth - DensityUtil.dip2px(context, 10 * 2)) / 2;
|
|
47
|
63
|
}
|
|
48
|
64
|
|
|
49
|
65
|
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
|
|
|
@ -91,6 +107,11 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
91
|
107
|
|
|
92
|
108
|
@Override
|
|
93
|
109
|
public IViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
|
110
|
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) parent.getLayoutParams();
|
|
|
111
|
params.leftMargin = DensityUtil.dip2px(context, 10);
|
|
|
112
|
params.rightMargin = DensityUtil.dip2px(context, 10);
|
|
|
113
|
parent.setLayoutParams(params);
|
|
|
114
|
|
|
94
|
115
|
View view = null;
|
|
95
|
116
|
IViewHolder holder = null;
|
|
96
|
117
|
switch (viewType) {
|
|
|
@ -117,53 +138,96 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
117
|
138
|
|
|
118
|
139
|
@Override
|
|
119
|
140
|
public void onBindViewHolder(IViewHolder holder, int position) {
|
|
120
|
|
|
|
|
141
|
mPosition = position;
|
|
121
|
142
|
switch (holder.getItemViewType()) {
|
|
122
|
143
|
case TYPE_HEADER:
|
|
123
|
|
setHeaderHolder(holder, position);
|
|
|
144
|
setHeaderHolder(holder, position); // 话题列表设置
|
|
124
|
145
|
break;
|
|
125
|
146
|
case TYPE_ITEM:
|
|
126
|
|
setListHolder(holder, position);
|
|
|
147
|
setListHolder(holder, position); // 聊聊信息列表设置
|
|
127
|
148
|
break;
|
|
128
|
149
|
}
|
|
129
|
150
|
}
|
|
130
|
151
|
|
|
|
152
|
|
|
131
|
153
|
private void setListHolder(IViewHolder holder, int position) {
|
|
132
|
|
SimpleViewHolder simpleViewHolder = (SimpleViewHolder) holder;
|
|
133
|
154
|
|
|
134
|
|
RelativeLayout.LayoutParams lpImg = (RelativeLayout.LayoutParams) simpleViewHolder.info_bg_icon.getLayoutParams();
|
|
135
|
155
|
|
|
136
|
|
// LinearLayout.LayoutParams linearParams =(LinearLayout.LayoutParams) simpleViewHolder.user_avater.getLayoutParams(); //取控件textView当前的布局参数 linearParams.height = 20;// 控件的高强制设成20
|
|
137
|
|
if (position % 2 == 0) {
|
|
138
|
|
lpImg.width = screenWidth / 2;
|
|
139
|
|
lpImg.height = screenWidth * 2 / 3 - 100;
|
|
140
|
|
simpleViewHolder.info_bg_icon.setLayoutParams(lpImg);
|
|
141
|
|
} else {
|
|
142
|
|
lpImg.width = screenWidth / 2;
|
|
143
|
|
lpImg.height = screenWidth * 2 / 3;
|
|
144
|
|
simpleViewHolder.info_bg_icon.setLayoutParams(lpImg);
|
|
|
156
|
TalkRecommendBean talkRecommendBean = talkRecommendBeans.get(position - 1);
|
|
|
157
|
if (talkRecommendBean.targetId == 317) {
|
|
|
158
|
Log.d("come come come", "title: " + talkRecommendBean.title);
|
|
|
159
|
Log.d("come come come", "targetId: " + talkRecommendBean.targetId);
|
|
|
160
|
Log.d("come come come", "likeFlg: " + talkRecommendBean.likeFlg);
|
|
|
161
|
Log.d("come come come", "likeNums: " + talkRecommendBean.likeNums);
|
|
145
|
162
|
}
|
|
146
|
163
|
|
|
147
|
|
TalkRecommendBean talkRecommendBean = talkRecommendBeans.get(position - 1);
|
|
|
164
|
SimpleViewHolder simpleViewHolder = (SimpleViewHolder) holder;
|
|
|
165
|
// 聊聊信息列表图片背景属性设置
|
|
|
166
|
RelativeLayout.LayoutParams lpImg = (RelativeLayout.LayoutParams) simpleViewHolder.info_bg_icon.getLayoutParams();
|
|
|
167
|
lpImg.width = talkItemWidth;
|
|
|
168
|
if (talkRecommendBean.targetType == 25) { // 话题
|
|
|
169
|
lpImg.height = (int) (talkItemWidth * 365 / 480.0f);
|
|
|
170
|
simpleViewHolder.bottom_view.setVisibility(View.GONE);
|
|
|
171
|
simpleViewHolder.topic_back.setVisibility(View.VISIBLE);
|
|
|
172
|
simpleViewHolder.recycler_view_title.setVisibility(View.GONE);
|
|
|
173
|
simpleViewHolder.topic_title.setVisibility(View.VISIBLE);
|
|
|
174
|
// 设置话题半透明层
|
|
|
175
|
RelativeLayout.LayoutParams tbParams = (RelativeLayout.LayoutParams) simpleViewHolder.topic_back.getLayoutParams();
|
|
|
176
|
tbParams.height = lpImg.height;
|
|
|
177
|
tbParams.width = lpImg.width;
|
|
|
178
|
simpleViewHolder.topic_back.setLayoutParams(tbParams);
|
|
|
179
|
// 设置话题标题
|
|
|
180
|
simpleViewHolder.topic_title.setText(talkRecommendBean.title);
|
|
|
181
|
|
|
|
182
|
} else { // 23:app_talk_video_icon 24:图文
|
|
|
183
|
if (talkRecommendBean.coverImgW == 0 || talkRecommendBean.coverImgH == 0) { // 9:16
|
|
|
184
|
lpImg.height = (int) (talkItemWidth * 16f / 9f);
|
|
|
185
|
} else {
|
|
|
186
|
if ((float) talkRecommendBean.coverImgH / talkRecommendBean.coverImgW > 16f / 9f) {
|
|
|
187
|
lpImg.height = (int) (talkItemWidth * 16f / 9f);
|
|
|
188
|
} else {
|
|
|
189
|
lpImg.height = talkItemWidth * talkRecommendBean.coverImgH / talkRecommendBean.coverImgW;
|
|
|
190
|
}
|
|
|
191
|
}
|
|
|
192
|
simpleViewHolder.bottom_view.setVisibility(View.VISIBLE);
|
|
|
193
|
simpleViewHolder.topic_back.setVisibility(View.GONE);
|
|
|
194
|
simpleViewHolder.recycler_view_title.setVisibility(View.VISIBLE);
|
|
|
195
|
simpleViewHolder.topic_title.setVisibility(View.GONE);
|
|
|
196
|
|
|
|
197
|
if (talkRecommendBean.likeFlg == 0) {
|
|
|
198
|
simpleViewHolder.recycler_view_zan_icon.setBackgroundResource(R.drawable.app_talk_main_list_zan_icon);
|
|
|
199
|
} else {
|
|
|
200
|
simpleViewHolder.recycler_view_zan_icon.setBackgroundResource(R.drawable.app_talk_main_list_zan_red_icon);
|
|
|
201
|
}
|
|
|
202
|
}
|
|
|
203
|
|
|
|
204
|
simpleViewHolder.info_bg_icon.setLayoutParams(lpImg);
|
|
|
205
|
|
|
|
206
|
|
|
148
|
207
|
if (TextUtils.isEmpty(talkRecommendBean.title))
|
|
149
|
208
|
simpleViewHolder.recycler_view_title.setText("分享内容");
|
|
150
|
209
|
else
|
|
151
|
210
|
simpleViewHolder.recycler_view_title.setText(talkRecommendBean.title);
|
|
152
|
211
|
if (talkRecommendBean.likeNums == 0) {
|
|
153
|
212
|
simpleViewHolder.recycler_view_zan.setVisibility(View.GONE);
|
|
154
|
|
}else if(talkRecommendBean.likeNums > 999){
|
|
|
213
|
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) simpleViewHolder.recycler_view_zan_icon.getLayoutParams();
|
|
|
214
|
params.rightMargin = DensityUtil.dip2px(context, 10);
|
|
|
215
|
simpleViewHolder.recycler_view_zan_icon.setLayoutParams(params);
|
|
|
216
|
} else if (talkRecommendBean.likeNums > 999) {
|
|
155
|
217
|
simpleViewHolder.recycler_view_zan.setVisibility(View.VISIBLE);
|
|
156
|
218
|
simpleViewHolder.recycler_view_zan.setText("999+");
|
|
157
|
|
}else {
|
|
|
219
|
} else {
|
|
158
|
220
|
simpleViewHolder.recycler_view_zan.setVisibility(View.VISIBLE);
|
|
159
|
221
|
simpleViewHolder.recycler_view_zan.setText(talkRecommendBean.likeNums + "");
|
|
160
|
222
|
}
|
|
161
|
223
|
|
|
162
|
224
|
simpleViewHolder.user_avater_name.setText(talkRecommendBean.nickName);
|
|
163
|
|
if (talkRecommendBean.isTop == 0)
|
|
|
225
|
if (talkRecommendBean.isTop == 0) {
|
|
164
|
226
|
simpleViewHolder.is_top_view.setVisibility(View.GONE);
|
|
165
|
|
else
|
|
|
227
|
} else {
|
|
|
228
|
simpleViewHolder.is_top_view.setBackgroundResource(R.drawable.corner_view);
|
|
166
|
229
|
simpleViewHolder.is_top_view.setVisibility(View.VISIBLE);
|
|
|
230
|
}
|
|
167
|
231
|
|
|
168
|
232
|
if (talkRecommendBean.targetType == 23)
|
|
169
|
233
|
simpleViewHolder.info_id_video_icon.setVisibility(View.VISIBLE);
|
|
|
@ -175,6 +239,7 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
175
|
239
|
// .asBitmap()//强制Glide返回一个Bitmap对象
|
|
176
|
240
|
// .into(new Tram);
|
|
177
|
241
|
|
|
|
242
|
Log.d("xxxxxxxxx", "setListHolder: " + talkRecommendBean.coverImgUrl + "-》" + talkRecommendBean.coverImgW + "->" + talkRecommendBean.coverImgH);
|
|
178
|
243
|
ImageDisplayUtils.dispalyImg(context, talkRecommendBean.coverImgUrl, simpleViewHolder.info_bg_icon);
|
|
179
|
244
|
|
|
180
|
245
|
// if (!TextUtils.isEmpty(talkRecommendBean.coverImgUrl)){
|
|
|
@ -190,7 +255,7 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
190
|
255
|
.into(simpleViewHolder.user_avater);
|
|
191
|
256
|
} else {
|
|
192
|
257
|
Picasso.with(context)
|
|
193
|
|
.load("http://cdz.evcharge.cc/zhannew/uploadfile/"+talkRecommendBean.headImgUrl)
|
|
|
258
|
.load("http://cdz.evcharge.cc/zhannew/uploadfile/" + talkRecommendBean.headImgUrl)
|
|
194
|
259
|
.placeholder(R.drawable.icon_face2_0)
|
|
195
|
260
|
.error(R.drawable.icon_face2_0)
|
|
196
|
261
|
.transform(new CircleTransform())
|
|
|
@ -215,7 +280,7 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
215
|
280
|
talkRecommendHeaderAdapter.setOnRecyclerItemClickListener(new RecyclerItemTypeClickListener() {
|
|
216
|
281
|
@Override
|
|
217
|
282
|
public void onItemClickListener(int position, int index) {
|
|
218
|
|
String topicId = talkHeaderRecommendBeans.get(position).topicId+"";
|
|
|
283
|
String topicId = talkHeaderRecommendBeans.get(position).topicId + "";
|
|
219
|
284
|
context.startActivity(new Intent(context, TopicDetailsActivity.class).putExtra("topicId", topicId));
|
|
220
|
285
|
}
|
|
221
|
286
|
});
|
|
|
@ -228,9 +293,13 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
228
|
293
|
TextView user_avater_name;
|
|
229
|
294
|
TextView is_top_view;
|
|
230
|
295
|
ImageView user_avater;
|
|
|
296
|
ImageView recycler_view_zan_icon;
|
|
231
|
297
|
ImageView info_bg_icon;
|
|
232
|
298
|
ImageView info_id_video_icon;
|
|
233
|
299
|
LinearLayout cardview;
|
|
|
300
|
RelativeLayout bottom_view;
|
|
|
301
|
ImageView topic_back;
|
|
|
302
|
TextView topic_title;
|
|
234
|
303
|
|
|
235
|
304
|
public SimpleViewHolder(View view) {
|
|
236
|
305
|
super(view);
|
|
|
@ -239,14 +308,18 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
239
|
308
|
is_top_view = (TextView) view.findViewById(R.id.is_top_view);
|
|
240
|
309
|
recycler_view_zan = (TextView) view.findViewById(R.id.recycler_view_zan);
|
|
241
|
310
|
user_avater = (ImageView) view.findViewById(R.id.user_avater);
|
|
|
311
|
recycler_view_zan_icon = view.findViewById(R.id.recycler_view_zan_icon);
|
|
242
|
312
|
info_bg_icon = (ImageView) view.findViewById(R.id.info_bg_icon);
|
|
243
|
313
|
info_id_video_icon = (ImageView) view.findViewById(R.id.info_id_video_icon);
|
|
244
|
314
|
cardview = (LinearLayout) view.findViewById(R.id.cardview);
|
|
|
315
|
bottom_view = view.findViewById(R.id.bottom_view);
|
|
|
316
|
topic_back = view.findViewById(R.id.topic_back);
|
|
|
317
|
topic_title = view.findViewById(R.id.topic_title);
|
|
245
|
318
|
|
|
246
|
|
RelativeLayout.LayoutParams lpImg = (RelativeLayout.LayoutParams) info_bg_icon.getLayoutParams();
|
|
247
|
|
lpImg.width = screenWidth / 2;
|
|
248
|
|
lpImg.height = screenWidth * 2 / 3;
|
|
249
|
|
info_bg_icon.setLayoutParams(lpImg);
|
|
|
319
|
// RelativeLayout.LayoutParams lpImg = (RelativeLayout.LayoutParams) info_bg_icon.getLayoutParams();
|
|
|
320
|
// lpImg.width = screenWidth / 2;
|
|
|
321
|
// lpImg.height = screenWidth * 2 / 3;
|
|
|
322
|
// info_bg_icon.setLayoutParams(lpImg);
|
|
250
|
323
|
|
|
251
|
324
|
itemView.setOnClickListener(new View.OnClickListener() {
|
|
252
|
325
|
@Override
|
|
|
@ -264,6 +337,42 @@ public class LayoutAdapter extends RecyclerView.Adapter<IViewHolder> {
|
|
264
|
337
|
}
|
|
265
|
338
|
}
|
|
266
|
339
|
});
|
|
|
340
|
recycler_view_zan_icon.setOnClickListener(new View.OnClickListener() {
|
|
|
341
|
@Override
|
|
|
342
|
public void onClick(View view) {
|
|
|
343
|
// 点赞操作
|
|
|
344
|
TalkRecommendBean talkRecommendBean = talkRecommendBeans.get(mPosition - 1);
|
|
|
345
|
String url = MainApplication.urlNew + "/topic/like.do";
|
|
|
346
|
Map<String, String> map = new HashMap<>();
|
|
|
347
|
if (MainApplication.isLogin()) {
|
|
|
348
|
map.put("userId", MainApplication.userId);
|
|
|
349
|
}
|
|
|
350
|
map.put("targetId", talkRecommendBean.targetId + "");
|
|
|
351
|
map.put("targetType", talkRecommendBean.targetType + "");
|
|
|
352
|
map.put("flag", "1");
|
|
|
353
|
map.put("authorId", talkRecommendBean.addUserId + "");
|
|
|
354
|
Log.d("come come come", "onClick: " + map);
|
|
|
355
|
OkHttpUtils.get().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
|
|
|
356
|
@Override
|
|
|
357
|
public void onError(Call call, Exception e) {
|
|
|
358
|
ToastUtil.showToast(context, "点赞失败,请重试", Toast.LENGTH_SHORT);
|
|
|
359
|
}
|
|
|
360
|
|
|
|
361
|
@Override
|
|
|
362
|
public void onResponse(String response) {
|
|
|
363
|
Log.d("come come come", "onClick: " + response);
|
|
|
364
|
String rtnCode = JsonUtils.getKeyResult(response, "code");
|
|
|
365
|
String desc = JsonUtils.getKeyResult(response, "desc");
|
|
|
366
|
if ("1000".equals(rtnCode)) {
|
|
|
367
|
recycler_view_zan_icon.setBackgroundResource(R.drawable.app_talk_main_list_zan_red_icon);
|
|
|
368
|
} else {
|
|
|
369
|
ToastUtil.showToast(context, desc, Toast.LENGTH_SHORT);
|
|
|
370
|
}
|
|
|
371
|
}
|
|
|
372
|
});
|
|
|
373
|
}
|
|
|
374
|
});
|
|
|
375
|
|
|
267
|
376
|
}
|
|
268
|
377
|
}
|
|
269
|
378
|
|
|
|
@ -46,9 +46,6 @@ public class TalkRecommendHeaderAdapter extends RecyclerView.Adapter<IViewHolder
|
|
46
|
46
|
// 设置宽高
|
|
47
|
47
|
talkRecommendWidth = (int) ((screenWidth - margin) / 3.5);
|
|
48
|
48
|
talkRecommendHeight = (int) (talkRecommendWidth * height / width);
|
|
49
|
|
Log.d("come on2", "TalkRecommendHeaderAdapter: " + talkRecommendWidth);
|
|
50
|
|
Log.d("come on2", "TalkRecommendHeaderAdapter: " + talkRecommendHeight);
|
|
51
|
|
|
|
52
|
49
|
}
|
|
53
|
50
|
|
|
54
|
51
|
|
|
|
@ -84,6 +81,13 @@ public class TalkRecommendHeaderAdapter extends RecyclerView.Adapter<IViewHolder
|
|
84
|
81
|
|
|
85
|
82
|
@Override
|
|
86
|
83
|
public IViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
|
84
|
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)parent.getLayoutParams();
|
|
|
85
|
params.leftMargin = DensityUtil.dip2px(context, 5);
|
|
|
86
|
params.rightMargin = DensityUtil.dip2px(context, 5);
|
|
|
87
|
// params.width = talkRecommendWidth;
|
|
|
88
|
// params.height = talkRecommendHeight;
|
|
|
89
|
parent.setLayoutParams(params);
|
|
|
90
|
|
|
87
|
91
|
View view = layoutInflater.inflate(R.layout.activity_talkrecommend_header_item, parent, false);
|
|
88
|
92
|
IViewHolder holder = new CollectionCarsHolder(view);
|
|
89
|
93
|
return holder;
|
|
|
@ -115,18 +119,22 @@ public class TalkRecommendHeaderAdapter extends RecyclerView.Adapter<IViewHolder
|
|
115
|
119
|
collectionCarsHolder.header_title_joinin.setText(talkRecommendBean.joinNums + "参与");
|
|
116
|
120
|
}
|
|
117
|
121
|
|
|
118
|
|
int margin = 0;
|
|
|
122
|
int leftMargin = 0;
|
|
119
|
123
|
if (position == 0) {
|
|
120
|
|
margin = DensityUtil.dip2px(context, 15);
|
|
|
124
|
leftMargin = 0;
|
|
121
|
125
|
} else {
|
|
122
|
|
margin = DensityUtil.dip2px(context, 5);
|
|
|
126
|
leftMargin = DensityUtil.dip2px(context, 5);
|
|
123
|
127
|
}
|
|
124
|
128
|
|
|
125
|
|
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)collectionCarsHolder.cardview.getLayoutParams();
|
|
126
|
|
params.leftMargin = margin;
|
|
|
129
|
int rightMargin = 0;
|
|
127
|
130
|
if (lists.size() == position + 1) {
|
|
128
|
|
params.rightMargin = DensityUtil.dip2px(context,15);
|
|
|
131
|
rightMargin = DensityUtil.dip2px(context,5);
|
|
129
|
132
|
}
|
|
|
133
|
|
|
|
134
|
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)collectionCarsHolder.cardview.getLayoutParams();
|
|
|
135
|
params.leftMargin = leftMargin;
|
|
|
136
|
params.rightMargin = rightMargin;
|
|
|
137
|
|
|
130
|
138
|
collectionCarsHolder.cardview.setLayoutParams(params);
|
|
131
|
139
|
|
|
132
|
140
|
if (!TextUtils.isEmpty(talkRecommendBean.coverImgUrl)) {
|
|
|
@ -150,17 +158,8 @@ public class TalkRecommendHeaderAdapter extends RecyclerView.Adapter<IViewHolder
|
|
150
|
158
|
iv_header_bg = (ImageView) itemView.findViewById(R.id.iv_header_bg);
|
|
151
|
159
|
header_title = (TextView) itemView.findViewById(R.id.header_title);
|
|
152
|
160
|
header_title_joinin = (TextView) itemView.findViewById(R.id.header_title_joinin);
|
|
153
|
|
ivHeaderMask = itemView.findViewById(R.id.iv_header_mask);
|
|
154
|
161
|
cardview = (RelativeLayout) itemView.findViewById(R.id.cardview);
|
|
155
|
162
|
|
|
156
|
|
// TODO change by hyg
|
|
157
|
|
// ViewGroup.LayoutParams rl = (ViewGroup.LayoutParams) cardview.getLayoutParams();
|
|
158
|
|
// rl.width = screenWidth / 4 + 50;
|
|
159
|
|
// rl.height = screenWidth / 4 + 10;
|
|
160
|
|
|
|
161
|
|
ivHeaderMask.setAlpha(0.5f);
|
|
162
|
|
// cardview.setLayoutParams(rl);
|
|
163
|
|
|
|
164
|
163
|
itemView.setOnClickListener(new View.OnClickListener() {
|
|
165
|
164
|
@Override
|
|
166
|
165
|
public void onClick(View view) {
|
|
|
@ -74,8 +74,8 @@ public class MainApplication extends MultiDexApplication {
|
|
74
|
74
|
public static Boolean firstSsyd;
|
|
75
|
75
|
public static String password = "";
|
|
76
|
76
|
public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
|
|
77
|
|
public static String urlNew = "http://123.56.67.7:83/api/0200";// 一电测试环境
|
|
78
|
|
// public static String urlNew = "https://api.touchev.com:83/api/0200";// 一电正式环境
|
|
|
77
|
// public static String urlNew = "http://123.56.67.7:83/api/0200";// 一电测试环境
|
|
|
78
|
public static String urlNew = "https://api.touchev.com:83/api/0200";// 一电正式环境
|
|
79
|
79
|
public static String pic_url = "http://cdz.evcharge.cc/zhannew/uploadfile/";
|
|
80
|
80
|
// public static String url = "https://cdz.d1ev.com";
|
|
81
|
81
|
public static String build_flag = "0";
|
|
|
@ -0,0 +1,36 @@
|
|
|
1
|
package com.electric.chargingpile.data;
|
|
|
2
|
|
|
|
3
|
import java.io.Serializable;
|
|
|
4
|
import java.util.List;
|
|
|
5
|
|
|
|
6
|
public class ChatRecommendBean implements Serializable {
|
|
|
7
|
|
|
|
8
|
public static final int TARGET_TYPE_VIDEO = 23;
|
|
|
9
|
public static final int TARGET_TYPE_IMAGE_TEXT = 24;
|
|
|
10
|
public static final int TARGET_TYPE_IMAGE_TOPIC = 25;
|
|
|
11
|
|
|
|
12
|
public long targetId;
|
|
|
13
|
public long addUserId;
|
|
|
14
|
public int targetType; // 23:app_talk_video_icon 24:图文 25:话题
|
|
|
15
|
public String title;
|
|
|
16
|
public String name;
|
|
|
17
|
public long addTime;
|
|
|
18
|
public int topicId;
|
|
|
19
|
public long joinNums;
|
|
|
20
|
public int visitNums;
|
|
|
21
|
public String coverImgUrl;
|
|
|
22
|
public List<String> imgUrls;
|
|
|
23
|
public String headImgUrl;
|
|
|
24
|
public String nickName;
|
|
|
25
|
public String topicName;
|
|
|
26
|
public String content;
|
|
|
27
|
public String shareUrl;
|
|
|
28
|
public int source;
|
|
|
29
|
public String videoUrl;
|
|
|
30
|
public int commentNums;
|
|
|
31
|
public int isTop; // 是否显示置顶
|
|
|
32
|
public int likeFlg; // 0:未点赞 1:已点赞
|
|
|
33
|
public int likeNums; // 点赞总数
|
|
|
34
|
public int coverImgW; // 图片宽度
|
|
|
35
|
public int coverImgH; // 图片高度
|
|
|
36
|
}
|
|
|
@ -4,7 +4,7 @@ import java.io.Serializable;
|
|
4
|
4
|
import java.util.List;
|
|
5
|
5
|
|
|
6
|
6
|
public class TalkRecommendBean implements Serializable {
|
|
7
|
|
// "targetId": 4,
|
|
|
7
|
// "targetId": 4,
|
|
8
|
8
|
// "targetType": 23,
|
|
9
|
9
|
// "title": "这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件这是一个视频文件",
|
|
10
|
10
|
// "topicId": 1,
|
|
|
@ -20,7 +20,7 @@ public class TalkRecommendBean implements Serializable {
|
|
20
|
20
|
// "source": 1
|
|
21
|
21
|
public long targetId;
|
|
22
|
22
|
public long addUserId;
|
|
23
|
|
public int targetType;
|
|
|
23
|
public int targetType; // 23:app_talk_video_icon 24:图文 25:话题
|
|
24
|
24
|
public String title;
|
|
25
|
25
|
public String name;
|
|
26
|
26
|
public long addTime;
|
|
|
@ -34,11 +34,13 @@ public class TalkRecommendBean implements Serializable {
|
|
34
|
34
|
public String topicName;
|
|
35
|
35
|
public String content;
|
|
36
|
36
|
public String shareUrl;
|
|
37
|
|
public int likeNums;
|
|
38
|
37
|
public int source;
|
|
39
|
38
|
public String videoUrl;
|
|
40
|
39
|
public int commentNums;
|
|
41
|
40
|
public int isTop;
|
|
42
|
|
public int likeFlg;
|
|
|
41
|
public int likeFlg; // 0:未点赞 1:已点赞
|
|
|
42
|
public int likeNums; // 点赞总数
|
|
|
43
|
public int coverImgW;
|
|
|
44
|
public int coverImgH;
|
|
43
|
45
|
|
|
44
|
46
|
}
|
|
|
@ -0,0 +1,250 @@
|
|
|
1
|
package com.electric.chargingpile.fragment;
|
|
|
2
|
|
|
|
3
|
import android.os.Bundle;
|
|
|
4
|
import android.support.v4.app.Fragment;
|
|
|
5
|
import android.support.v7.widget.RecyclerView;
|
|
|
6
|
import android.support.v7.widget.StaggeredGridLayoutManager;
|
|
|
7
|
import android.text.TextUtils;
|
|
|
8
|
import android.util.Log;
|
|
|
9
|
import android.view.LayoutInflater;
|
|
|
10
|
import android.view.View;
|
|
|
11
|
import android.view.ViewGroup;
|
|
|
12
|
import android.widget.ImageView;
|
|
|
13
|
import android.widget.LinearLayout;
|
|
|
14
|
import android.widget.Toast;
|
|
|
15
|
|
|
|
16
|
import com.andview.refreshview.XRefreshView;
|
|
|
17
|
import com.electric.chargingpile.R;
|
|
|
18
|
import com.electric.chargingpile.adapter.ChatRecommendAdapter;
|
|
|
19
|
import com.electric.chargingpile.adapter.ChatRecommendItemDecoration;
|
|
|
20
|
import com.electric.chargingpile.application.MainApplication;
|
|
|
21
|
import com.electric.chargingpile.data.ChatRecommendBean;
|
|
|
22
|
import com.electric.chargingpile.iview.RecyclerItemTypeClickListener;
|
|
|
23
|
import com.electric.chargingpile.manager.ProfileManager;
|
|
|
24
|
import com.electric.chargingpile.util.JsonUtils;
|
|
|
25
|
import com.electric.chargingpile.util.NetUtil;
|
|
|
26
|
import com.electric.chargingpile.util.ToastUtil;
|
|
|
27
|
import com.zhy.http.okhttp.OkHttpUtils;
|
|
|
28
|
import com.zhy.http.okhttp.callback.StringCallback;
|
|
|
29
|
|
|
|
30
|
import java.util.ArrayList;
|
|
|
31
|
import java.util.HashMap;
|
|
|
32
|
import java.util.Map;
|
|
|
33
|
|
|
|
34
|
import okhttp3.Call;
|
|
|
35
|
|
|
|
36
|
public class ChatRecommendFragment extends Fragment implements View.OnClickListener {
|
|
|
37
|
private static final String TAG = "ChatRecommendFragment";
|
|
|
38
|
private View view;
|
|
|
39
|
private XRefreshView refreshView;
|
|
|
40
|
private ImageView iv_ask;
|
|
|
41
|
private RecyclerView recyclerView;
|
|
|
42
|
private ChatRecommendAdapter chatRecommendAdapter;
|
|
|
43
|
private StaggeredGridLayoutManager layoutManager;
|
|
|
44
|
private LinearLayout chat_share_info_remind;
|
|
|
45
|
private boolean isFirst = false;
|
|
|
46
|
private int page = 1;
|
|
|
47
|
|
|
|
48
|
@Override
|
|
|
49
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
|
50
|
view = inflater.inflate(R.layout.fragment_chat_recommend, null);
|
|
|
51
|
initViews();
|
|
|
52
|
initListener();
|
|
|
53
|
return view;
|
|
|
54
|
}
|
|
|
55
|
|
|
|
56
|
private void initViews() {
|
|
|
57
|
refreshView = view.findViewById(R.id.chat_x_refresh_view);
|
|
|
58
|
refreshView.setPullLoadEnable(true);
|
|
|
59
|
recyclerView = view.findViewById(R.id.recycler_view_test_rv);
|
|
|
60
|
recyclerView.setHasFixedSize(true);
|
|
|
61
|
|
|
|
62
|
iv_ask = view.findViewById(R.id.iv_ask);
|
|
|
63
|
chat_share_info_remind = view.findViewById(R.id.chat_share_info_remind);
|
|
|
64
|
|
|
|
65
|
String isFirstComeIn = ProfileManager.getInstance().getIsFirstComeIn(getActivity());
|
|
|
66
|
if (TextUtils.isEmpty(isFirstComeIn)) {
|
|
|
67
|
isFirst = true;
|
|
|
68
|
ProfileManager.getInstance().setFirstComeIn(getActivity(), "label");
|
|
|
69
|
chat_share_info_remind.setVisibility(View.VISIBLE);
|
|
|
70
|
} else {
|
|
|
71
|
chat_share_info_remind.setVisibility(View.GONE);
|
|
|
72
|
}
|
|
|
73
|
|
|
|
74
|
chatRecommendAdapter = new ChatRecommendAdapter(getActivity());
|
|
|
75
|
layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
|
|
|
76
|
layoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE);
|
|
|
77
|
recyclerView.setItemAnimator(null);
|
|
|
78
|
recyclerView.setLayoutManager(layoutManager);
|
|
|
79
|
recyclerView.addItemDecoration(new ChatRecommendItemDecoration());
|
|
|
80
|
// 静默加载模式不能设置footerview
|
|
|
81
|
recyclerView.setAdapter(chatRecommendAdapter);
|
|
|
82
|
// refreshView.setPinnedTime(1000);
|
|
|
83
|
// refreshView.setMoveForHorizontal(true);
|
|
|
84
|
|
|
|
85
|
refreshView.setXRefreshViewListener(new XRefreshView.SimpleXRefreshListener() {
|
|
|
86
|
@Override
|
|
|
87
|
public void onRefresh(boolean isPullDown) {
|
|
|
88
|
page = 1;
|
|
|
89
|
requestHeaderData();
|
|
|
90
|
}
|
|
|
91
|
|
|
|
92
|
@Override
|
|
|
93
|
public void onLoadMore(boolean isSilence) {
|
|
|
94
|
page++;
|
|
|
95
|
requestData();
|
|
|
96
|
}
|
|
|
97
|
});
|
|
|
98
|
|
|
|
99
|
refreshView.startRefresh();
|
|
|
100
|
requestHeaderData(); // 该页面数据发起请求起点
|
|
|
101
|
|
|
|
102
|
chatRecommendAdapter.setOnRecyclerItemClickListener(new RecyclerItemTypeClickListener() {
|
|
|
103
|
@Override
|
|
|
104
|
public void onItemClickListener(int position, int type) {
|
|
|
105
|
ToastUtil.showToast(getActivity().getApplicationContext(), "position:" + position + ",type:" + type, Toast.LENGTH_SHORT);
|
|
|
106
|
final int pos = position - 1;
|
|
|
107
|
final ArrayList<ChatRecommendBean> chatRecommendBeans = chatRecommendAdapter.getCurrentData();
|
|
|
108
|
|
|
|
109
|
if (!NetUtil.CheckNetwork(getActivity())) {
|
|
|
110
|
Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_SHORT).show();
|
|
|
111
|
return;
|
|
|
112
|
}
|
|
|
113
|
|
|
|
114
|
if (type == 2) {
|
|
|
115
|
|
|
|
116
|
}
|
|
|
117
|
|
|
|
118
|
Log.d(TAG, "onItemClickListener: position:" + position + ",type:" + type);
|
|
|
119
|
}
|
|
|
120
|
});
|
|
|
121
|
}
|
|
|
122
|
|
|
|
123
|
private void initListener() {
|
|
|
124
|
iv_ask.setOnClickListener(this);
|
|
|
125
|
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
|
|
126
|
@Override
|
|
|
127
|
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
|
|
128
|
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
|
|
129
|
iv_ask.setVisibility(View.VISIBLE);
|
|
|
130
|
if (isFirst) {
|
|
|
131
|
chat_share_info_remind.setVisibility(View.VISIBLE);
|
|
|
132
|
}
|
|
|
133
|
} else if (newState == RecyclerView.SCREEN_STATE_ON) {
|
|
|
134
|
iv_ask.setVisibility(View.GONE);
|
|
|
135
|
if (isFirst) {
|
|
|
136
|
chat_share_info_remind.setVisibility(View.GONE);
|
|
|
137
|
}
|
|
|
138
|
}
|
|
|
139
|
}
|
|
|
140
|
|
|
|
141
|
@Override
|
|
|
142
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
|
|
143
|
super.onScrolled(recyclerView, dx, dy);
|
|
|
144
|
}
|
|
|
145
|
});
|
|
|
146
|
}
|
|
|
147
|
|
|
|
148
|
@Override
|
|
|
149
|
public void onClick(View view) {
|
|
|
150
|
switch (view.getId()) {
|
|
|
151
|
case R.id.iv_ask: // 推荐分享
|
|
|
152
|
// TODO
|
|
|
153
|
break;
|
|
|
154
|
}
|
|
|
155
|
}
|
|
|
156
|
|
|
|
157
|
|
|
|
158
|
public void refreshList() {
|
|
|
159
|
if (view == null)
|
|
|
160
|
return;
|
|
|
161
|
refreshView.startRefresh();
|
|
|
162
|
page = 1;
|
|
|
163
|
requestHeaderData();
|
|
|
164
|
}
|
|
|
165
|
|
|
|
166
|
private void requestHeaderData() {
|
|
|
167
|
String url = MainApplication.urlNew + "/topic/list.do";
|
|
|
168
|
Map<String, String> map = new HashMap<>();
|
|
|
169
|
map.put("selected", "1");
|
|
|
170
|
if (MainApplication.isLogin()) {
|
|
|
171
|
map.put("user_id", MainApplication.userId);
|
|
|
172
|
}
|
|
|
173
|
OkHttpUtils.get().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
|
|
|
174
|
@Override
|
|
|
175
|
public void onError(Call call, Exception e) {
|
|
|
176
|
if (page == 1) {
|
|
|
177
|
refreshView.stopRefresh();
|
|
|
178
|
} else {
|
|
|
179
|
refreshView.stopLoadMore();
|
|
|
180
|
}
|
|
|
181
|
if (getActivity() != null) {
|
|
|
182
|
ToastUtil.showToast(getActivity().getApplicationContext(), "加载失败,请重试", Toast.LENGTH_SHORT);
|
|
|
183
|
}
|
|
|
184
|
}
|
|
|
185
|
|
|
|
186
|
@Override
|
|
|
187
|
public void onResponse(String response) {
|
|
|
188
|
String rtnCode = JsonUtils.getKeyResult(response, "code");
|
|
|
189
|
String rtnDesc = JsonUtils.getKeyResult(response, "desc");
|
|
|
190
|
if ("1000".equals(rtnCode)) {
|
|
|
191
|
String rtnData = JsonUtils.getKeyResult(response, "data");
|
|
|
192
|
ArrayList<ChatRecommendBean> topicData = (ArrayList<ChatRecommendBean>) JsonUtils.parseToObjectList(rtnData, ChatRecommendBean.class);
|
|
|
193
|
chatRecommendAdapter.setHeaderData(topicData);
|
|
|
194
|
requestData();
|
|
|
195
|
} else {
|
|
|
196
|
ToastUtil.showToast(getActivity().getApplicationContext(), rtnDesc, Toast.LENGTH_SHORT);
|
|
|
197
|
}
|
|
|
198
|
}
|
|
|
199
|
});
|
|
|
200
|
}
|
|
|
201
|
|
|
|
202
|
private void requestData() {
|
|
|
203
|
String url = MainApplication.urlNew + "/topic/info/list.do";
|
|
|
204
|
Map<String, String> map = new HashMap<>();
|
|
|
205
|
map.put("page", page + "");
|
|
|
206
|
map.put("limit", "20");
|
|
|
207
|
|
|
|
208
|
if (MainApplication.isLogin()) {
|
|
|
209
|
map.put("user_id", MainApplication.userId);
|
|
|
210
|
}
|
|
|
211
|
OkHttpUtils.get().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
|
|
|
212
|
@Override
|
|
|
213
|
public void onError(Call call, Exception e) {
|
|
|
214
|
if (page == 1) {
|
|
|
215
|
refreshView.stopRefresh();
|
|
|
216
|
} else {
|
|
|
217
|
refreshView.stopLoadMore();
|
|
|
218
|
}
|
|
|
219
|
ToastUtil.showToast(getActivity().getApplicationContext(), "加载失败,请重试:" + e.getMessage(), Toast.LENGTH_SHORT);
|
|
|
220
|
}
|
|
|
221
|
|
|
|
222
|
@Override
|
|
|
223
|
public void onResponse(String response) {
|
|
|
224
|
if (page == 1) {
|
|
|
225
|
refreshView.stopRefresh();
|
|
|
226
|
} else {
|
|
|
227
|
refreshView.stopLoadMore();
|
|
|
228
|
}
|
|
|
229
|
String rtnCode = JsonUtils.getKeyResult(response, "code");
|
|
|
230
|
String rtnDesc = JsonUtils.getKeyResult(response, "desc");
|
|
|
231
|
if ("1000".equals(rtnCode)) {
|
|
|
232
|
String rtnData = JsonUtils.getKeyResult(response, "data");
|
|
|
233
|
ArrayList<ChatRecommendBean> chatRecommendBeans = (ArrayList<ChatRecommendBean>) JsonUtils.parseToObjectList(rtnData, ChatRecommendBean.class);
|
|
|
234
|
if (page == 1) {
|
|
|
235
|
refreshView.setLoadComplete(false);
|
|
|
236
|
chatRecommendAdapter.setData(chatRecommendBeans);
|
|
|
237
|
} else {
|
|
|
238
|
chatRecommendAdapter.addData(chatRecommendBeans);
|
|
|
239
|
}
|
|
|
240
|
|
|
|
241
|
if (chatRecommendBeans.size() == 0) {
|
|
|
242
|
refreshView.setLoadComplete(true);
|
|
|
243
|
}
|
|
|
244
|
} else {
|
|
|
245
|
ToastUtil.showToast(getActivity().getApplicationContext(), rtnDesc, Toast.LENGTH_SHORT);
|
|
|
246
|
}
|
|
|
247
|
}
|
|
|
248
|
});
|
|
|
249
|
}
|
|
|
250
|
}
|
|
|
@ -16,6 +16,7 @@ import android.widget.ListView;
|
|
16
|
16
|
import android.widget.Toast;
|
|
17
|
17
|
|
|
18
|
18
|
import com.electric.chargingpile.R;
|
|
|
19
|
import com.electric.chargingpile.activity.ChatActivity;
|
|
19
|
20
|
import com.electric.chargingpile.activity.EditQuestionOneActivity;
|
|
20
|
21
|
import com.electric.chargingpile.activity.LoginActivity;
|
|
21
|
22
|
import com.electric.chargingpile.activity.TalkActivity;
|
|
|
@ -44,7 +45,7 @@ import pub.devrel.easypermissions.EasyPermissions;
|
|
44
|
45
|
/**
|
|
45
|
46
|
* @author dxh
|
|
46
|
47
|
* @date 2019/3/12
|
|
47
|
|
* @deprecated 互动
|
|
|
48
|
* 互动
|
|
48
|
49
|
*/
|
|
49
|
50
|
public class QaActivityFragment extends Fragment implements View.OnClickListener, EasyPermissions.PermissionCallbacks {
|
|
50
|
51
|
private static final String TAG = "QaActivity";
|
|
|
@ -58,19 +59,19 @@ public class QaActivityFragment extends Fragment implements View.OnClickListener
|
|
58
|
59
|
private long exitTime = 0;
|
|
59
|
60
|
private static final int RC_CAMERA_PERM = 123;
|
|
60
|
61
|
private View view;
|
|
61
|
|
private TalkActivity talkActivity;
|
|
|
62
|
private ChatActivity chatActivity;
|
|
62
|
63
|
|
|
63
|
64
|
@Override
|
|
64
|
65
|
public void onAttach(Context context) {
|
|
65
|
66
|
super.onAttach(context);
|
|
66
|
|
talkActivity = (TalkActivity) context;
|
|
|
67
|
chatActivity = (ChatActivity) context;
|
|
67
|
68
|
}
|
|
68
|
69
|
|
|
69
|
70
|
@Override
|
|
70
|
71
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
71
|
72
|
Bundle savedInstanceState) {
|
|
72
|
73
|
view = inflater.inflate(R.layout.activity_fram_qa, null);
|
|
73
|
|
BarColorUtil.initStatusBarColor(talkActivity);
|
|
|
74
|
BarColorUtil.initStatusBarColor(chatActivity);
|
|
74
|
75
|
initViews();
|
|
75
|
76
|
initListener();
|
|
76
|
77
|
isRefresh = true;
|
|
|
@ -179,7 +180,7 @@ public class QaActivityFragment extends Fragment implements View.OnClickListener
|
|
179
|
180
|
datas.add(qadata.get(i));
|
|
180
|
181
|
}
|
|
181
|
182
|
if (isFirst) {
|
|
182
|
|
adapter = new QADataFramAdapter(datas, talkActivity);
|
|
|
183
|
adapter = new QADataFramAdapter(datas, chatActivity);
|
|
183
|
184
|
lv_info.setAdapter(adapter);
|
|
184
|
185
|
isFirst = false;
|
|
185
|
186
|
} else {
|
|
|
@ -140,7 +140,7 @@ public class TalkRecommendFragment extends Fragment implements View.OnClickListe
|
|
140
|
140
|
// // 刷新完成必须调用此方法停止加载
|
|
141
|
141
|
// xRefreshView.stopLoadMore();
|
|
142
|
142
|
// }
|
|
143
|
|
// }
|
|
|
143
|
// }œ
|
|
144
|
144
|
// }, 1000);
|
|
145
|
145
|
}
|
|
146
|
146
|
});
|
|
|
@ -300,7 +300,6 @@ public class TalkRecommendFragment extends Fragment implements View.OnClickListe
|
|
300
|
300
|
|
|
301
|
301
|
private void requestData() {
|
|
302
|
302
|
String url = MainApplication.urlNew + "/topic/info/list.do";
|
|
303
|
|
// Log.e(TAG, "getQAData: "+url );
|
|
304
|
303
|
Map<String, String> map = new HashMap<>();
|
|
305
|
304
|
map.put("page", page + "");
|
|
306
|
305
|
if (MainApplication.isLogin()) {
|
|
|
@ -318,12 +317,12 @@ public class TalkRecommendFragment extends Fragment implements View.OnClickListe
|
|
318
|
317
|
|
|
319
|
318
|
@Override
|
|
320
|
319
|
public void onResponse(String response) {
|
|
321
|
|
if (page == 1)
|
|
|
320
|
if (page == 1) {
|
|
322
|
321
|
xRefreshView.stopRefresh();
|
|
323
|
|
else
|
|
|
322
|
} else {
|
|
324
|
323
|
xRefreshView.setLoadComplete(true);
|
|
|
324
|
}
|
|
325
|
325
|
|
|
326
|
|
Log.e(TAG, "onResponse: " + response);
|
|
327
|
326
|
String rtnCode = JsonUtils.getKeyResult(response, "code");
|
|
328
|
327
|
if ("1000".equals(rtnCode)) {
|
|
329
|
328
|
String rtnMsg = JsonUtils.getKeyResult(response, "data");
|
|
|
@ -332,8 +331,8 @@ public class TalkRecommendFragment extends Fragment implements View.OnClickListe
|
|
332
|
331
|
layoutAdapter.setData(qadata);
|
|
333
|
332
|
else
|
|
334
|
333
|
layoutAdapter.addData(qadata);
|
|
335
|
|
Log.e(TAG, "onResponse: qadata" + qadata.size());
|
|
336
|
|
// Log.e(TAG, "onResponse01: "+datas.size() );
|
|
|
334
|
Log.d(TAG, "onResponsexxx:" + response);
|
|
|
335
|
Log.e(TAG, "onResponsexxx: qadata.size = " + qadata.size());
|
|
337
|
336
|
} else if ("02".equals(rtnCode)) {
|
|
338
|
337
|
ToastUtil.showToast(getActivity().getApplicationContext(), "已经全部加载完毕", Toast.LENGTH_SHORT);
|
|
339
|
338
|
}
|
|
|
@ -0,0 +1,41 @@
|
|
|
1
|
package com.electric.chargingpile.view;
|
|
|
2
|
|
|
|
3
|
import android.content.Context;
|
|
|
4
|
import android.support.annotation.Nullable;
|
|
|
5
|
import android.support.v4.view.ViewPager;
|
|
|
6
|
import android.support.v7.widget.RecyclerView;
|
|
|
7
|
import android.util.AttributeSet;
|
|
|
8
|
import android.util.Log;
|
|
|
9
|
import android.view.MotionEvent;
|
|
|
10
|
import android.view.ViewParent;
|
|
|
11
|
|
|
|
12
|
public class ViewChatHeaderRecyclerView extends RecyclerView {
|
|
|
13
|
private static final String TAG = "ViewChatHeaderRecyclerV";
|
|
|
14
|
private boolean interceptTouch = true;
|
|
|
15
|
|
|
|
16
|
public ViewChatHeaderRecyclerView(Context context) {
|
|
|
17
|
super(context);
|
|
|
18
|
}
|
|
|
19
|
|
|
|
20
|
public ViewChatHeaderRecyclerView(Context context, @Nullable AttributeSet attrs) {
|
|
|
21
|
super(context, attrs);
|
|
|
22
|
}
|
|
|
23
|
|
|
|
24
|
public ViewChatHeaderRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
|
|
|
25
|
super(context, attrs, defStyle);
|
|
|
26
|
}
|
|
|
27
|
|
|
|
28
|
@Override
|
|
|
29
|
public boolean dispatchTouchEvent(MotionEvent ev) {
|
|
|
30
|
// interceptTouch 是自定义属性控制是否拦截事件
|
|
|
31
|
if (interceptTouch) { // 禁止ViewPager的滑动事件
|
|
|
32
|
ViewParent parent = this;
|
|
|
33
|
while (!((parent = parent.getParent()) instanceof ViewPager)) {
|
|
|
34
|
// nop
|
|
|
35
|
}
|
|
|
36
|
parent.requestDisallowInterceptTouchEvent(true);
|
|
|
37
|
}
|
|
|
38
|
|
|
|
39
|
return super.dispatchTouchEvent(ev);
|
|
|
40
|
}
|
|
|
41
|
}
|
|
|
@ -0,0 +1,10 @@
|
|
|
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
2
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
|
3
|
<solid android:color="#ffffff"></solid>
|
|
|
4
|
<corners android:radius="4dp" />
|
|
|
5
|
<padding
|
|
|
6
|
android:bottom="1dp"
|
|
|
7
|
android:left="3dp"
|
|
|
8
|
android:right="3dp"
|
|
|
9
|
android:top="1dp" />
|
|
|
10
|
</shape>
|
|
|
@ -3,8 +3,8 @@
|
|
3
|
3
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
4
|
4
|
<item>
|
|
5
|
5
|
<shape>
|
|
6
|
|
<stroke android:width="0.6dp" android:color="#000000" /><!--边框颜色-->
|
|
7
|
|
<solid android:color="#000000" /><!--填充色-->
|
|
|
6
|
<stroke android:width="0.6dp" android:color="#00000000" /><!--边框颜色-->
|
|
|
7
|
<solid android:color="#80000000" /><!--填充色-->
|
|
8
|
8
|
<corners android:radius="10dp" />
|
|
9
|
9
|
|
|
10
|
10
|
</shape>
|
|
|
@ -0,0 +1,264 @@
|
|
|
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
2
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
3
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
|
4
|
xmlns:tools="http://schemas.android.com/tools"
|
|
|
5
|
android:layout_width="match_parent"
|
|
|
6
|
android:layout_height="match_parent"
|
|
|
7
|
tools:context=".activity.ChatActivity">
|
|
|
8
|
|
|
|
9
|
<RelativeLayout
|
|
|
10
|
android:id="@+id/act_bar"
|
|
|
11
|
android:layout_width="match_parent"
|
|
|
12
|
android:layout_height="44dp"
|
|
|
13
|
android:background="@color/white">
|
|
|
14
|
|
|
|
15
|
<LinearLayout
|
|
|
16
|
android:layout_width="match_parent"
|
|
|
17
|
android:layout_height="match_parent"
|
|
|
18
|
android:layout_centerInParent="true"
|
|
|
19
|
android:gravity="center"
|
|
|
20
|
android:minWidth="100dp"
|
|
|
21
|
android:orientation="horizontal">
|
|
|
22
|
|
|
|
23
|
<TextView
|
|
|
24
|
android:id="@+id/act_bar_title_recommend"
|
|
|
25
|
android:layout_width="wrap_content"
|
|
|
26
|
android:layout_height="match_parent"
|
|
|
27
|
android:layout_centerInParent="true"
|
|
|
28
|
android:gravity="center"
|
|
|
29
|
android:paddingLeft="5dp"
|
|
|
30
|
android:paddingRight="5dp"
|
|
|
31
|
android:text="推荐"
|
|
|
32
|
android:textColor="@color/ui_62"
|
|
|
33
|
android:textSize="18sp" />
|
|
|
34
|
|
|
|
35
|
<View
|
|
|
36
|
android:layout_width="1dp"
|
|
|
37
|
android:layout_height="15dp"
|
|
|
38
|
android:background="@color/ui_6d" />
|
|
|
39
|
|
|
|
40
|
<TextView
|
|
|
41
|
android:id="@+id/act_bar_title_help"
|
|
|
42
|
android:layout_width="wrap_content"
|
|
|
43
|
android:layout_height="match_parent"
|
|
|
44
|
android:gravity="center"
|
|
|
45
|
android:paddingLeft="5dp"
|
|
|
46
|
android:paddingRight="5dp"
|
|
|
47
|
android:text="互助"
|
|
|
48
|
android:textColor="@color/ui_68"
|
|
|
49
|
android:textSize="18sp" />
|
|
|
50
|
|
|
|
51
|
</LinearLayout>
|
|
|
52
|
|
|
|
53
|
<TextView
|
|
|
54
|
android:id="@+id/act_bar_help_question"
|
|
|
55
|
android:layout_width="wrap_content"
|
|
|
56
|
android:layout_height="match_parent"
|
|
|
57
|
android:layout_alignParentRight="true"
|
|
|
58
|
android:gravity="center"
|
|
|
59
|
android:paddingLeft="15dp"
|
|
|
60
|
android:paddingRight="15dp"
|
|
|
61
|
android:text="待回答问题"
|
|
|
62
|
android:textColor="@color/lvse"
|
|
|
63
|
android:textSize="16sp" />
|
|
|
64
|
|
|
|
65
|
<ImageView
|
|
|
66
|
android:id="@+id/act_bar_help_search"
|
|
|
67
|
android:layout_width="wrap_content"
|
|
|
68
|
android:layout_height="wrap_content"
|
|
|
69
|
android:layout_alignParentLeft="true"
|
|
|
70
|
android:padding="15dp"
|
|
|
71
|
android:src="@drawable/icon_qa_search" />
|
|
|
72
|
|
|
|
73
|
<View
|
|
|
74
|
android:id="@+id/act_bar_bottom_line"
|
|
|
75
|
android:layout_width="match_parent"
|
|
|
76
|
android:layout_height="0.5dp"
|
|
|
77
|
android:layout_alignParentBottom="true"
|
|
|
78
|
android:background="@color/ui_6d" />
|
|
|
79
|
</RelativeLayout>
|
|
|
80
|
|
|
|
81
|
<android.support.v4.view.ViewPager
|
|
|
82
|
android:id="@+id/chat_view_pager"
|
|
|
83
|
android:layout_width="match_parent"
|
|
|
84
|
android:layout_height="match_parent"
|
|
|
85
|
android:layout_above="@+id/ll_tab"
|
|
|
86
|
android:layout_below="@+id/act_bar"
|
|
|
87
|
android:background="@color/ui_f4" />
|
|
|
88
|
|
|
|
89
|
<!-- 底部导航 -->
|
|
|
90
|
<LinearLayout
|
|
|
91
|
android:id="@+id/ll_tab"
|
|
|
92
|
android:layout_width="match_parent"
|
|
|
93
|
android:layout_height="49dp"
|
|
|
94
|
android:layout_alignParentBottom="true"
|
|
|
95
|
android:background="@color/white"
|
|
|
96
|
android:orientation="horizontal"
|
|
|
97
|
android:visibility="visible">
|
|
|
98
|
|
|
|
99
|
|
|
|
100
|
<LinearLayout
|
|
|
101
|
android:id="@+id/tab_main"
|
|
|
102
|
android:layout_width="0dp"
|
|
|
103
|
android:layout_height="match_parent"
|
|
|
104
|
android:layout_weight="1"
|
|
|
105
|
android:orientation="vertical">
|
|
|
106
|
|
|
|
107
|
<ImageView
|
|
|
108
|
android:id="@+id/iv_main"
|
|
|
109
|
android:layout_width="wrap_content"
|
|
|
110
|
android:layout_height="wrap_content"
|
|
|
111
|
android:layout_gravity="center_horizontal"
|
|
|
112
|
android:layout_marginTop="8dp"
|
|
|
113
|
android:src="@drawable/icon_main_index" />
|
|
|
114
|
|
|
|
115
|
<TextView
|
|
|
116
|
android:id="@+id/tv_main"
|
|
|
117
|
android:layout_width="wrap_content"
|
|
|
118
|
android:layout_height="wrap_content"
|
|
|
119
|
android:layout_gravity="center_horizontal"
|
|
|
120
|
android:layout_marginTop="2dp"
|
|
|
121
|
android:text="首页"
|
|
|
122
|
android:textColor="@color/ui_64"
|
|
|
123
|
android:textSize="10sp" />
|
|
|
124
|
|
|
|
125
|
</LinearLayout>
|
|
|
126
|
|
|
|
127
|
<LinearLayout
|
|
|
128
|
android:id="@+id/tab_qa"
|
|
|
129
|
android:layout_width="0dp"
|
|
|
130
|
android:layout_height="match_parent"
|
|
|
131
|
android:layout_weight="1"
|
|
|
132
|
android:orientation="vertical">
|
|
|
133
|
|
|
|
134
|
<ImageView
|
|
|
135
|
android:layout_width="wrap_content"
|
|
|
136
|
android:layout_height="wrap_content"
|
|
|
137
|
android:layout_gravity="center_horizontal"
|
|
|
138
|
android:layout_marginTop="8dp"
|
|
|
139
|
android:src="@drawable/app_tab_chat_icon1" />
|
|
|
140
|
<!--android:src="@drawable/icon_main_qa_selected" />-->
|
|
|
141
|
|
|
|
142
|
<TextView
|
|
|
143
|
android:layout_width="wrap_content"
|
|
|
144
|
android:layout_height="wrap_content"
|
|
|
145
|
android:layout_gravity="center_horizontal"
|
|
|
146
|
android:layout_marginTop="2dp"
|
|
|
147
|
android:text="@string/string_tab_qa"
|
|
|
148
|
android:textColor="@color/ui_64"
|
|
|
149
|
android:textSize="10sp" />
|
|
|
150
|
|
|
|
151
|
</LinearLayout>
|
|
|
152
|
|
|
|
153
|
<LinearLayout
|
|
|
154
|
android:id="@+id/tab_screening"
|
|
|
155
|
android:layout_width="0dp"
|
|
|
156
|
android:layout_height="match_parent"
|
|
|
157
|
android:layout_weight="1"
|
|
|
158
|
android:orientation="vertical">
|
|
|
159
|
|
|
|
160
|
<ImageView
|
|
|
161
|
android:layout_width="wrap_content"
|
|
|
162
|
android:layout_height="wrap_content"
|
|
|
163
|
android:layout_gravity="center_horizontal"
|
|
|
164
|
android:layout_marginTop="8dp"
|
|
|
165
|
android:src="@drawable/icon_main_scan" />
|
|
|
166
|
|
|
|
167
|
<TextView
|
|
|
168
|
android:layout_width="wrap_content"
|
|
|
169
|
android:layout_height="wrap_content"
|
|
|
170
|
android:layout_gravity="center_horizontal"
|
|
|
171
|
android:layout_marginTop="2dp"
|
|
|
172
|
android:text="充电"
|
|
|
173
|
android:textColor="@color/ui_64"
|
|
|
174
|
android:textSize="10sp" />
|
|
|
175
|
|
|
|
176
|
</LinearLayout>
|
|
|
177
|
|
|
|
178
|
<RelativeLayout
|
|
|
179
|
android:id="@+id/ll_tab_find"
|
|
|
180
|
android:layout_width="0px"
|
|
|
181
|
android:layout_height="match_parent"
|
|
|
182
|
android:layout_weight="1">
|
|
|
183
|
|
|
|
184
|
<ImageView
|
|
|
185
|
android:id="@+id/iv_find"
|
|
|
186
|
android:layout_width="wrap_content"
|
|
|
187
|
android:layout_height="wrap_content"
|
|
|
188
|
android:layout_centerHorizontal="true"
|
|
|
189
|
android:layout_marginTop="8dp"
|
|
|
190
|
android:src="@drawable/icon_main_find" />
|
|
|
191
|
|
|
|
192
|
<ImageView
|
|
|
193
|
android:id="@+id/iv_point"
|
|
|
194
|
android:layout_width="wrap_content"
|
|
|
195
|
android:layout_height="wrap_content"
|
|
|
196
|
android:layout_alignTop="@+id/iv_find"
|
|
|
197
|
android:layout_marginLeft="3dp"
|
|
|
198
|
android:layout_toRightOf="@+id/iv_find"
|
|
|
199
|
android:src="@drawable/icon_havemessage1201"
|
|
|
200
|
android:visibility="gone" />
|
|
|
201
|
|
|
|
202
|
|
|
|
203
|
<TextView
|
|
|
204
|
android:id="@+id/tv_find"
|
|
|
205
|
android:layout_width="wrap_content"
|
|
|
206
|
android:layout_height="wrap_content"
|
|
|
207
|
android:layout_below="@+id/iv_find"
|
|
|
208
|
android:layout_centerHorizontal="true"
|
|
|
209
|
android:layout_gravity="center_horizontal"
|
|
|
210
|
android:layout_marginTop="2dp"
|
|
|
211
|
android:text="发现"
|
|
|
212
|
android:textColor="@color/ui_64"
|
|
|
213
|
android:textSize="10sp" />
|
|
|
214
|
|
|
|
215
|
</RelativeLayout>
|
|
|
216
|
|
|
|
217
|
<LinearLayout
|
|
|
218
|
android:id="@+id/tab_me"
|
|
|
219
|
android:layout_width="0dp"
|
|
|
220
|
android:layout_height="match_parent"
|
|
|
221
|
android:layout_weight="1"
|
|
|
222
|
android:orientation="vertical">
|
|
|
223
|
|
|
|
224
|
<RelativeLayout
|
|
|
225
|
android:id="@+id/rl_our_f"
|
|
|
226
|
android:layout_width="wrap_content"
|
|
|
227
|
android:layout_height="wrap_content"
|
|
|
228
|
android:layout_gravity="center_horizontal"
|
|
|
229
|
android:layout_marginTop="8dp">
|
|
|
230
|
|
|
|
231
|
<ImageView
|
|
|
232
|
android:id="@+id/iv_our"
|
|
|
233
|
android:layout_width="wrap_content"
|
|
|
234
|
android:layout_height="wrap_content"
|
|
|
235
|
android:layout_centerInParent="true"
|
|
|
236
|
android:scaleType="centerInside"
|
|
|
237
|
android:src="@drawable/icon_tab_main_me" />
|
|
|
238
|
|
|
|
239
|
<TextView
|
|
|
240
|
android:id="@+id/tv_msg_num"
|
|
|
241
|
android:layout_width="wrap_content"
|
|
|
242
|
android:layout_height="wrap_content"
|
|
|
243
|
android:layout_toRightOf="@+id/iv_our"
|
|
|
244
|
android:background="@drawable/bg_smallred"
|
|
|
245
|
android:gravity="center"
|
|
|
246
|
android:text="13"
|
|
|
247
|
android:textColor="@color/white"
|
|
|
248
|
android:textSize="9sp"
|
|
|
249
|
android:visibility="gone" />
|
|
|
250
|
</RelativeLayout>
|
|
|
251
|
|
|
|
252
|
<TextView
|
|
|
253
|
android:layout_width="wrap_content"
|
|
|
254
|
android:layout_height="wrap_content"
|
|
|
255
|
android:layout_gravity="center_horizontal"
|
|
|
256
|
android:layout_marginTop="2dp"
|
|
|
257
|
android:text="我的"
|
|
|
258
|
android:textColor="@color/ui_64"
|
|
|
259
|
android:textSize="10sp" />
|
|
|
260
|
</LinearLayout>
|
|
|
261
|
|
|
|
262
|
</LinearLayout>
|
|
|
263
|
|
|
|
264
|
</RelativeLayout>
|
|
|
@ -82,6 +82,7 @@
|
|
82
|
82
|
android:layout_width="match_parent"
|
|
83
|
83
|
android:layout_height="match_parent"
|
|
84
|
84
|
android:layout_below="@+id/rl_title"
|
|
|
85
|
android:background="#f4f4f4"
|
|
85
|
86
|
android:layout_above="@+id/ll_tab"/>
|
|
86
|
87
|
|
|
87
|
88
|
<LinearLayout
|
|
|
@ -7,7 +7,7 @@
|
|
7
|
7
|
android:id="@+id/xrefreshview"
|
|
8
|
8
|
android:layout_width="match_parent"
|
|
9
|
9
|
android:layout_height="match_parent"
|
|
10
|
|
android:background="#fff">
|
|
|
10
|
android:background="@color/ui_f4">
|
|
11
|
11
|
|
|
12
|
12
|
<android.support.v7.widget.RecyclerView
|
|
13
|
13
|
android:id="@+id/recycler_view_test_rv"
|
|
|
@ -17,9 +17,9 @@
|
|
17
|
17
|
android:scaleType="centerCrop" />
|
|
18
|
18
|
|
|
19
|
19
|
<ImageView
|
|
20
|
|
android:id="@+id/iv_header_mask"
|
|
21
|
20
|
android:layout_width="match_parent"
|
|
22
|
21
|
android:layout_height="match_parent"
|
|
|
22
|
android:alpha="0.5"
|
|
23
|
23
|
android:background="#000000" />
|
|
24
|
24
|
|
|
25
|
25
|
<TextView
|
|
|
@ -4,9 +4,10 @@
|
|
4
|
4
|
android:id="@+id/card_view"
|
|
5
|
5
|
android:layout_width="match_parent"
|
|
6
|
6
|
android:layout_height="wrap_content"
|
|
7
|
|
android:layout_margin="5dp"
|
|
8
|
|
android:background="?android:attr/selectableItemBackground"
|
|
9
|
|
android:minHeight="100dp"
|
|
|
7
|
android:layout_marginLeft="5dp"
|
|
|
8
|
android:layout_marginTop="10dp"
|
|
|
9
|
android:layout_marginRight="5dp"
|
|
|
10
|
android:background="#ffffff"
|
|
10
|
11
|
android:paddingBottom="5dp">
|
|
11
|
12
|
|
|
12
|
13
|
<RelativeLayout
|
|
|
@ -19,8 +20,7 @@
|
|
19
|
20
|
android:id="@+id/info_bg_icon"
|
|
20
|
21
|
android:layout_width="wrap_content"
|
|
21
|
22
|
android:layout_height="wrap_content"
|
|
22
|
|
android:minWidth="200dp"
|
|
23
|
|
android:minHeight="160dp" />
|
|
|
23
|
android:scaleType="fitXY" />
|
|
24
|
24
|
|
|
25
|
25
|
<ImageView
|
|
26
|
26
|
android:id="@+id/info_id_video_icon"
|
|
|
@ -28,6 +28,21 @@
|
|
28
|
28
|
android:layout_height="wrap_content"
|
|
29
|
29
|
android:layout_centerInParent="true"
|
|
30
|
30
|
android:src="@drawable/app_talk_video_icon" />
|
|
|
31
|
|
|
|
32
|
<ImageView
|
|
|
33
|
android:id="@+id/topic_back"
|
|
|
34
|
android:layout_width="match_parent"
|
|
|
35
|
android:layout_height="match_parent"
|
|
|
36
|
android:alpha="0.5"
|
|
|
37
|
android:background="@color/black" />
|
|
|
38
|
|
|
|
39
|
<TextView
|
|
|
40
|
android:id="@+id/topic_title"
|
|
|
41
|
android:layout_width="wrap_content"
|
|
|
42
|
android:layout_height="wrap_content"
|
|
|
43
|
android:layout_centerInParent="true"
|
|
|
44
|
android:textColor="@color/white"
|
|
|
45
|
android:textSize="14sp" />
|
|
31
|
46
|
</RelativeLayout>
|
|
32
|
47
|
|
|
33
|
48
|
<TextView
|
|
|
@ -35,16 +50,12 @@
|
|
35
|
50
|
android:layout_width="wrap_content"
|
|
36
|
51
|
android:layout_height="wrap_content"
|
|
37
|
52
|
android:layout_alignRight="@+id/info_bg_icon_bg"
|
|
38
|
|
android:layout_marginRight="10dp"
|
|
39
|
53
|
android:layout_marginTop="10dp"
|
|
40
|
|
android:paddingTop="1dp"
|
|
41
|
|
android:paddingBottom="1dp"
|
|
42
|
|
android:paddingLeft="2dp"
|
|
43
|
|
android:paddingRight="2dp"
|
|
|
54
|
android:layout_marginRight="10dp"
|
|
|
55
|
android:background="@color/white"
|
|
44
|
56
|
android:text="置顶"
|
|
45
|
|
android:textSize="14sp"
|
|
46
|
57
|
android:textColor="@color/color_fb9349"
|
|
47
|
|
android:background="@color/white"/>
|
|
|
58
|
android:textSize="14sp" />
|
|
48
|
59
|
|
|
49
|
60
|
<TextView
|
|
50
|
61
|
android:id="@+id/recycler_view_title"
|
|
|
@ -54,11 +65,11 @@
|
|
54
|
65
|
android:layout_alignLeft="@+id/info_bg_icon_bg"
|
|
55
|
66
|
android:layout_alignRight="@+id/info_bg_icon_bg"
|
|
56
|
67
|
android:layout_marginBottom="16dp"
|
|
57
|
|
android:paddingTop="11dp"
|
|
58
|
|
android:paddingLeft="10dp"
|
|
59
|
|
android:paddingRight="10dp"
|
|
60
|
68
|
android:ellipsize="end"
|
|
61
|
69
|
android:maxLines="3"
|
|
|
70
|
android:paddingLeft="10dp"
|
|
|
71
|
android:paddingTop="11dp"
|
|
|
72
|
android:paddingRight="10dp"
|
|
62
|
73
|
android:text="123"
|
|
63
|
74
|
android:textColor="@color/color_222222"
|
|
64
|
75
|
android:textSize="15sp" />
|
|
|
@ -82,18 +93,19 @@
|
|
82
|
93
|
|
|
83
|
94
|
<ImageView
|
|
84
|
95
|
android:id="@+id/recycler_view_zan_icon"
|
|
85
|
|
android:layout_width="15dp"
|
|
86
|
|
android:layout_height="13dp"
|
|
|
96
|
android:layout_width="16dp"
|
|
|
97
|
android:layout_height="16dp"
|
|
87
|
98
|
android:layout_centerVertical="true"
|
|
88
|
99
|
android:layout_marginRight="5dp"
|
|
89
|
100
|
android:layout_toLeftOf="@+id/recycler_view_zan"
|
|
90
|
101
|
android:background="@drawable/app_talk_main_list_zan_icon" />
|
|
|
102
|
|
|
91
|
103
|
<TextView
|
|
92
|
104
|
android:id="@+id/recycler_view_zan"
|
|
93
|
105
|
android:layout_width="wrap_content"
|
|
94
|
106
|
android:layout_height="wrap_content"
|
|
95
|
107
|
android:layout_centerVertical="true"
|
|
96
|
|
android:paddingRight="15dp"
|
|
|
108
|
android:layout_marginRight="10dp"
|
|
97
|
109
|
android:text="456"
|
|
98
|
110
|
android:textColor="@color/color_888888"
|
|
99
|
111
|
android:textSize="13sp" />
|
|
|
@ -104,18 +116,19 @@
|
|
104
|
116
|
android:id="@+id/user_avater"
|
|
105
|
117
|
android:layout_width="20dp"
|
|
106
|
118
|
android:layout_height="20dp"
|
|
107
|
|
android:layout_centerVertical="true"/>
|
|
|
119
|
android:layout_centerVertical="true"
|
|
|
120
|
android:layout_marginLeft="10dp" />
|
|
108
|
121
|
|
|
109
|
122
|
<TextView
|
|
110
|
123
|
android:id="@+id/user_avater_name"
|
|
111
|
124
|
android:layout_width="match_parent"
|
|
112
|
125
|
android:layout_height="wrap_content"
|
|
113
|
126
|
android:layout_centerVertical="true"
|
|
114
|
|
android:singleLine="true"
|
|
115
|
|
android:ellipsize="end"
|
|
116
|
127
|
android:layout_toLeftOf="@+id/recycler_view_zan_icon_view"
|
|
117
|
128
|
android:layout_toRightOf="@+id/user_avater"
|
|
|
129
|
android:ellipsize="end"
|
|
118
|
130
|
android:paddingLeft="5dp"
|
|
|
131
|
android:singleLine="true"
|
|
119
|
132
|
android:text="456"
|
|
120
|
133
|
android:textColor="@color/color_888888"
|
|
121
|
134
|
android:textSize="13sp" />
|
|
|
@ -0,0 +1,62 @@
|
|
|
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
2
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
3
|
xmlns:tools="http://schemas.android.com/tools"
|
|
|
4
|
android:layout_width="match_parent"
|
|
|
5
|
android:layout_height="match_parent">
|
|
|
6
|
<com.andview.refreshview.XRefreshView
|
|
|
7
|
android:id="@+id/chat_x_refresh_view"
|
|
|
8
|
android:layout_width="match_parent"
|
|
|
9
|
android:layout_height="match_parent">
|
|
|
10
|
<android.support.v7.widget.RecyclerView
|
|
|
11
|
android:id="@+id/recycler_view_test_rv"
|
|
|
12
|
android:layout_width="match_parent"
|
|
|
13
|
android:layout_height="match_parent"
|
|
|
14
|
android:scrollbars="vertical" />
|
|
|
15
|
</com.andview.refreshview.XRefreshView>
|
|
|
16
|
|
|
|
17
|
<ImageView
|
|
|
18
|
android:id="@+id/iv_ask"
|
|
|
19
|
android:layout_width="wrap_content"
|
|
|
20
|
android:layout_height="wrap_content"
|
|
|
21
|
android:layout_alignParentRight="true"
|
|
|
22
|
android:layout_alignParentBottom="true"
|
|
|
23
|
android:layout_marginRight="15dp"
|
|
|
24
|
android:layout_marginBottom="22dp"
|
|
|
25
|
android:src="@drawable/app_share_talk_icon" />
|
|
|
26
|
|
|
|
27
|
<LinearLayout
|
|
|
28
|
android:id="@+id/chat_share_info_remind"
|
|
|
29
|
android:layout_width="wrap_content"
|
|
|
30
|
android:layout_height="40dp"
|
|
|
31
|
android:layout_alignParentBottom="true"
|
|
|
32
|
android:layout_marginBottom="24dp"
|
|
|
33
|
android:layout_toLeftOf="@+id/iv_ask"
|
|
|
34
|
android:gravity="center_vertical"
|
|
|
35
|
android:orientation="horizontal"
|
|
|
36
|
android:visibility="visible">
|
|
|
37
|
|
|
|
38
|
<RelativeLayout
|
|
|
39
|
android:layout_width="wrap_content"
|
|
|
40
|
android:layout_height="match_parent"
|
|
|
41
|
android:background="@drawable/bg_yuan_black">
|
|
|
42
|
|
|
|
43
|
<TextView
|
|
|
44
|
android:id="@+id/chat_share_info"
|
|
|
45
|
android:layout_width="wrap_content"
|
|
|
46
|
android:layout_height="match_parent"
|
|
|
47
|
android:gravity="center"
|
|
|
48
|
android:paddingLeft="10dp"
|
|
|
49
|
android:paddingRight="10dp"
|
|
|
50
|
android:text="分享内容获电币"
|
|
|
51
|
android:textColor="@color/white" />
|
|
|
52
|
</RelativeLayout>
|
|
|
53
|
|
|
|
54
|
|
|
|
55
|
<ImageView
|
|
|
56
|
android:layout_width="15dp"
|
|
|
57
|
android:layout_height="15dp"
|
|
|
58
|
android:layout_marginLeft="-5dp"
|
|
|
59
|
android:alpha="0.5"
|
|
|
60
|
android:src="@drawable/app_sanjiao_right" />
|
|
|
61
|
</LinearLayout>
|
|
|
62
|
</RelativeLayout>
|
|
|
@ -0,0 +1,12 @@
|
|
|
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
2
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
3
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
|
4
|
android:id="@+id/chat_header_linear_layout"
|
|
|
5
|
android:layout_width="wrap_content"
|
|
|
6
|
android:layout_height="wrap_content">
|
|
|
7
|
<com.electric.chargingpile.view.ViewChatHeaderRecyclerView
|
|
|
8
|
android:id="@+id/chat_header_recycler_view"
|
|
|
9
|
android:layout_width="wrap_content"
|
|
|
10
|
android:layout_height="wrap_content" />
|
|
|
11
|
|
|
|
12
|
</LinearLayout>
|
|
|
@ -0,0 +1,51 @@
|
|
|
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
2
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
3
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
|
4
|
android:id="@+id/card_view"
|
|
|
5
|
android:layout_width="94dp"
|
|
|
6
|
android:layout_height="85dp"
|
|
|
7
|
android:layout_marginTop="15dp"
|
|
|
8
|
android:layout_marginBottom="15dp">
|
|
|
9
|
|
|
|
10
|
<ImageView
|
|
|
11
|
android:id="@+id/iv_header_bg"
|
|
|
12
|
android:layout_width="match_parent"
|
|
|
13
|
android:layout_height="match_parent"
|
|
|
14
|
android:background="#44000000"
|
|
|
15
|
android:minWidth="94dp"
|
|
|
16
|
android:minHeight="85dp"
|
|
|
17
|
android:scaleType="centerCrop" />
|
|
|
18
|
|
|
|
19
|
<ImageView
|
|
|
20
|
android:layout_width="match_parent"
|
|
|
21
|
android:layout_height="match_parent"
|
|
|
22
|
android:alpha="0.5"
|
|
|
23
|
android:background="#000000" />
|
|
|
24
|
|
|
|
25
|
<TextView
|
|
|
26
|
android:id="@+id/header_title"
|
|
|
27
|
android:layout_width="wrap_content"
|
|
|
28
|
android:layout_height="wrap_content"
|
|
|
29
|
android:ellipsize="end"
|
|
|
30
|
android:maxLines="2"
|
|
|
31
|
android:paddingLeft="5dp"
|
|
|
32
|
android:paddingTop="5dp"
|
|
|
33
|
android:paddingRight="5dp"
|
|
|
34
|
android:text="1111"
|
|
|
35
|
android:textColor="@color/white"
|
|
|
36
|
android:textSize="12sp" />
|
|
|
37
|
|
|
|
38
|
<TextView
|
|
|
39
|
android:id="@+id/header_title_joinin"
|
|
|
40
|
android:layout_width="wrap_content"
|
|
|
41
|
android:layout_height="wrap_content"
|
|
|
42
|
android:layout_alignBottom="@+id/iv_header_bg"
|
|
|
43
|
android:layout_marginBottom="2dp"
|
|
|
44
|
android:ellipsize="end"
|
|
|
45
|
android:padding="5dp"
|
|
|
46
|
android:singleLine="true"
|
|
|
47
|
android:text="1111"
|
|
|
48
|
android:textColor="@color/white"
|
|
|
49
|
android:textSize="9sp" />
|
|
|
50
|
|
|
|
51
|
</RelativeLayout>
|
|
|
@ -0,0 +1,136 @@
|
|
|
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
2
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
|
3
|
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
|
|
4
|
android:id="@+id/card_view"
|
|
|
5
|
android:layout_width="match_parent"
|
|
|
6
|
android:layout_height="wrap_content"
|
|
|
7
|
android:layout_marginBottom="10dp"
|
|
|
8
|
android:background="#ffffff"
|
|
|
9
|
android:paddingBottom="5dp">
|
|
|
10
|
|
|
|
11
|
<RelativeLayout
|
|
|
12
|
android:id="@+id/info_bg_icon_bg"
|
|
|
13
|
android:layout_width="wrap_content"
|
|
|
14
|
android:layout_height="wrap_content"
|
|
|
15
|
android:gravity="center">
|
|
|
16
|
|
|
|
17
|
<ImageView
|
|
|
18
|
android:id="@+id/info_bg_icon"
|
|
|
19
|
android:layout_width="wrap_content"
|
|
|
20
|
android:layout_height="wrap_content"
|
|
|
21
|
android:scaleType="fitXY" />
|
|
|
22
|
|
|
|
23
|
<ImageView
|
|
|
24
|
android:id="@+id/info_id_video_icon"
|
|
|
25
|
android:layout_width="wrap_content"
|
|
|
26
|
android:layout_height="wrap_content"
|
|
|
27
|
android:layout_centerInParent="true"
|
|
|
28
|
android:src="@drawable/app_talk_video_icon" />
|
|
|
29
|
|
|
|
30
|
<ImageView
|
|
|
31
|
android:id="@+id/topic_back"
|
|
|
32
|
android:layout_width="match_parent"
|
|
|
33
|
android:layout_height="match_parent"
|
|
|
34
|
android:alpha="0.5"
|
|
|
35
|
android:background="@color/black" />
|
|
|
36
|
|
|
|
37
|
<TextView
|
|
|
38
|
android:id="@+id/topic_title"
|
|
|
39
|
android:layout_width="wrap_content"
|
|
|
40
|
android:layout_height="wrap_content"
|
|
|
41
|
android:layout_centerInParent="true"
|
|
|
42
|
android:textColor="@color/white"
|
|
|
43
|
android:textSize="14sp" />
|
|
|
44
|
</RelativeLayout>
|
|
|
45
|
|
|
|
46
|
<TextView
|
|
|
47
|
android:id="@+id/is_top_view"
|
|
|
48
|
android:layout_width="wrap_content"
|
|
|
49
|
android:layout_height="wrap_content"
|
|
|
50
|
android:layout_alignRight="@+id/info_bg_icon_bg"
|
|
|
51
|
android:layout_marginTop="10dp"
|
|
|
52
|
android:layout_marginRight="10dp"
|
|
|
53
|
android:background="@color/white"
|
|
|
54
|
android:text="置顶"
|
|
|
55
|
android:textColor="@color/color_fb9349"
|
|
|
56
|
android:textSize="14sp" />
|
|
|
57
|
|
|
|
58
|
<TextView
|
|
|
59
|
android:id="@+id/recycler_view_title"
|
|
|
60
|
android:layout_width="wrap_content"
|
|
|
61
|
android:layout_height="wrap_content"
|
|
|
62
|
android:layout_below="@+id/info_bg_icon_bg"
|
|
|
63
|
android:layout_alignLeft="@+id/info_bg_icon_bg"
|
|
|
64
|
android:layout_alignRight="@+id/info_bg_icon_bg"
|
|
|
65
|
android:layout_marginBottom="16dp"
|
|
|
66
|
android:ellipsize="end"
|
|
|
67
|
android:maxLines="3"
|
|
|
68
|
android:paddingLeft="10dp"
|
|
|
69
|
android:paddingTop="11dp"
|
|
|
70
|
android:paddingRight="10dp"
|
|
|
71
|
android:text="123"
|
|
|
72
|
android:textColor="@color/ui_62"
|
|
|
73
|
android:textSize="15sp" />
|
|
|
74
|
|
|
|
75
|
<RelativeLayout
|
|
|
76
|
android:id="@+id/bottom_view"
|
|
|
77
|
android:layout_width="wrap_content"
|
|
|
78
|
android:layout_height="wrap_content"
|
|
|
79
|
android:layout_below="@+id/recycler_view_title"
|
|
|
80
|
android:layout_alignLeft="@+id/info_bg_icon_bg"
|
|
|
81
|
android:layout_alignRight="@+id/info_bg_icon_bg">
|
|
|
82
|
|
|
|
83
|
<LinearLayout
|
|
|
84
|
android:id="@+id/recycler_view_zan_icon_view"
|
|
|
85
|
android:layout_width="wrap_content"
|
|
|
86
|
android:layout_height="wrap_content"
|
|
|
87
|
android:layout_alignParentRight="true"
|
|
|
88
|
android:layout_centerVertical="true"
|
|
|
89
|
android:gravity="center_vertical"
|
|
|
90
|
android:orientation="horizontal">
|
|
|
91
|
|
|
|
92
|
<ImageView
|
|
|
93
|
android:id="@+id/recycler_view_zan_icon"
|
|
|
94
|
android:layout_width="16dp"
|
|
|
95
|
android:layout_height="16dp"
|
|
|
96
|
android:layout_centerVertical="true"
|
|
|
97
|
android:layout_marginRight="5dp"
|
|
|
98
|
android:layout_toLeftOf="@+id/recycler_view_zan"
|
|
|
99
|
android:background="@drawable/app_talk_main_list_zan_icon" />
|
|
|
100
|
|
|
|
101
|
<TextView
|
|
|
102
|
android:id="@+id/recycler_view_zan"
|
|
|
103
|
android:layout_width="wrap_content"
|
|
|
104
|
android:layout_height="wrap_content"
|
|
|
105
|
android:layout_centerVertical="true"
|
|
|
106
|
android:layout_marginRight="10dp"
|
|
|
107
|
android:text="456"
|
|
|
108
|
android:textColor="@color/ui_68"
|
|
|
109
|
android:textSize="13sp" />
|
|
|
110
|
|
|
|
111
|
</LinearLayout>
|
|
|
112
|
|
|
|
113
|
<ImageView
|
|
|
114
|
android:id="@+id/user_avater"
|
|
|
115
|
android:layout_width="20dp"
|
|
|
116
|
android:layout_height="20dp"
|
|
|
117
|
android:layout_centerVertical="true"
|
|
|
118
|
android:layout_marginLeft="10dp" />
|
|
|
119
|
|
|
|
120
|
<TextView
|
|
|
121
|
android:id="@+id/user_avater_name"
|
|
|
122
|
android:layout_width="match_parent"
|
|
|
123
|
android:layout_height="wrap_content"
|
|
|
124
|
android:layout_centerVertical="true"
|
|
|
125
|
android:layout_toLeftOf="@+id/recycler_view_zan_icon_view"
|
|
|
126
|
android:layout_toRightOf="@+id/user_avater"
|
|
|
127
|
android:ellipsize="end"
|
|
|
128
|
android:paddingLeft="5dp"
|
|
|
129
|
android:singleLine="true"
|
|
|
130
|
android:text="456"
|
|
|
131
|
android:textColor="@color/ui_68"
|
|
|
132
|
android:textSize="13sp" />
|
|
|
133
|
|
|
|
134
|
</RelativeLayout>
|
|
|
135
|
|
|
|
136
|
</RelativeLayout>
|
|
|
@ -21,7 +21,8 @@ android {
|
|
21
|
21
|
dependencies {
|
|
22
|
22
|
compile 'com.android.support:appcompat-v7:26.1.0'
|
|
23
|
23
|
compile 'com.android.support:recyclerview-v7:26.1.0'
|
|
24
|
|
compile 'com.github.bumptech.glide:glide:4.1.1'
|
|
|
24
|
// compile 'com.github.bumptech.glide:glide:4.1.1'
|
|
|
25
|
compile 'com.github.bumptech.glide:glide:4.2.0'
|
|
25
|
26
|
compile 'com.github.chrisbanes:PhotoView:1.3.0'
|
|
26
|
27
|
compile 'io.reactivex.rxjava2:rxjava:2.0.5'
|
|
27
|
28
|
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
|