|
@ -6,6 +6,7 @@ import android.support.v4.view.PagerAdapter;
|
6
|
6
|
import android.support.v4.view.ViewPager;
|
7
|
7
|
import android.text.TextUtils;
|
8
|
8
|
import android.view.LayoutInflater;
|
|
9
|
import android.view.MotionEvent;
|
9
|
10
|
import android.view.View;
|
10
|
11
|
import android.view.ViewGroup;
|
11
|
12
|
import android.view.ViewGroup.LayoutParams;
|
|
@ -20,11 +21,11 @@ import com.bumptech.glide.Glide;
|
20
|
21
|
import com.bumptech.glide.request.RequestOptions;
|
21
|
22
|
import com.electric.chargingpile.R;
|
22
|
23
|
import com.electric.chargingpile.activity.PersonalPageActivity;
|
|
24
|
import com.electric.chargingpile.activity.TopicDetailsActivity;
|
23
|
25
|
import com.electric.chargingpile.application.MainApplication;
|
24
|
26
|
import com.electric.chargingpile.data.TalkRecommendBean;
|
25
|
27
|
import com.electric.chargingpile.util.CircleTransform;
|
26
|
28
|
import com.electric.chargingpile.util.JsonUtils;
|
27
|
|
import com.electric.chargingpile.util.TimeUtil;
|
28
|
29
|
import com.electric.chargingpile.util.ToastUtil;
|
29
|
30
|
import com.electric.chargingpile.view.AlertDialog;
|
30
|
31
|
import com.electric.chargingpile.view.UpVideoView2;
|
|
@ -53,10 +54,10 @@ public class SvVideoShowView implements View.OnClickListener {
|
53
|
54
|
|
54
|
55
|
|
55
|
56
|
private LinearLayout sv_show_forward, sv_show_comment_count_ll, sv_show_like_ll,
|
56
|
|
sv_show_comment_ll;
|
|
57
|
sv_show_comment_ll, sv_show_topic;
|
57
|
58
|
private TextView sv_show_comment_count_tv, sv_show_like_tv, sv_show_tvcon,
|
58
|
59
|
sv_show_user_name, sv_show_user_time, sv_show_topic_con, vd_title_tv;
|
59
|
|
private ImageView sv_show_like_img, sv_show_user_avatar,playIcon;
|
|
60
|
private ImageView sv_show_like_img, sv_show_user_avatar, playIcon;
|
60
|
61
|
|
61
|
62
|
private View sv_show_tvcon_more;
|
62
|
63
|
|
|
@ -139,9 +140,15 @@ public class SvVideoShowView implements View.OnClickListener {
|
139
|
140
|
sv_show_tvcon.setText(talkRecommendBean.content);
|
140
|
141
|
sv_show_tvcon.setText(talkRecommendBean.title);
|
141
|
142
|
sv_show_user_name.setText(talkRecommendBean.nickName);
|
142
|
|
String time = ""+talkRecommendBean.addTime;
|
|
143
|
String time = "" + talkRecommendBean.addTime;
|
143
|
144
|
sv_show_user_time.setText(time);
|
144
|
|
sv_show_topic_con.setText(talkRecommendBean.topicName);
|
|
145
|
String topicName = talkRecommendBean.topicName;
|
|
146
|
if (TextUtils.isEmpty(topicName)) {
|
|
147
|
sv_show_topic.setVisibility(View.GONE);
|
|
148
|
} else {
|
|
149
|
sv_show_topic.setVisibility(View.VISIBLE);
|
|
150
|
sv_show_topic_con.setText(topicName);
|
|
151
|
}
|
145
|
152
|
|
146
|
153
|
if (TextUtils.isEmpty(talkRecommendBean.headImgUrl)) {
|
147
|
154
|
Picasso.with(activity)
|
|
@ -165,15 +172,34 @@ public class SvVideoShowView implements View.OnClickListener {
|
165
|
172
|
} else {
|
166
|
173
|
// sv_show_like_img not like
|
167
|
174
|
}
|
168
|
|
|
169
|
|
if (sv_show_tvcon.getLineCount() > 3) {
|
170
|
|
sv_show_tvcon_more.setVisibility(View.VISIBLE);
|
171
|
|
} else {
|
172
|
|
sv_show_tvcon_more.setVisibility(View.GONE);
|
173
|
|
}
|
174
|
|
|
|
175
|
sv_show_tvcon.post(
|
|
176
|
new Runnable() {
|
|
177
|
@Override
|
|
178
|
public void run() {
|
|
179
|
int lineCount = sv_show_tvcon.getLineCount();
|
|
180
|
if (lineCount > 3) {
|
|
181
|
isMaxline = true;
|
|
182
|
sv_show_tvcon.setMaxLines(3);
|
|
183
|
sv_show_tvcon.setEllipsize(TextUtils.TruncateAt.END);
|
|
184
|
sv_show_tvcon_more.setVisibility(View.VISIBLE);
|
|
185
|
} else {
|
|
186
|
if (!isMaxline) {
|
|
187
|
sv_show_tvcon.setMaxLines(lineCount);
|
|
188
|
sv_show_tvcon_more.setVisibility(View.GONE);
|
|
189
|
}
|
|
190
|
}
|
|
191
|
}
|
|
192
|
}
|
|
193
|
);
|
|
194
|
// if (sv_show_tvcon.getLineCount() > 3) {
|
|
195
|
// sv_show_tvcon_more.setVisibility(View.VISIBLE);
|
|
196
|
// } else {
|
|
197
|
// sv_show_tvcon_more.setVisibility(View.GONE);
|
|
198
|
// }
|
175
|
199
|
}
|
176
|
200
|
|
|
201
|
boolean isMaxline = false;
|
|
202
|
|
177
|
203
|
private void likeRequest(final int likeFlag) {
|
178
|
204
|
String url = MainApplication.urlNew + "/article/like";
|
179
|
205
|
Map<String, String> map = new HashMap<>();
|
|
@ -238,20 +264,24 @@ public class SvVideoShowView implements View.OnClickListener {
|
238
|
264
|
sv_show_user_name = view.findViewById(R.id.sv_show_user_name);
|
239
|
265
|
sv_show_user_time = view.findViewById(R.id.sv_show_user_time);
|
240
|
266
|
sv_show_topic_con = view.findViewById(R.id.sv_show_topic_con);
|
|
267
|
sv_show_topic = view.findViewById(R.id.sv_show_topic);
|
|
268
|
sv_show_topic.setOnClickListener(this);
|
241
|
269
|
sv_show_tvcon_more.setOnClickListener(this);
|
242
|
270
|
sv_show_comment_count_ll.setOnClickListener(this);
|
243
|
271
|
sv_show_comment_ll.setOnClickListener(this);
|
244
|
272
|
sv_show_forward.setOnClickListener(this);
|
245
|
273
|
sv_show_like_ll.setOnClickListener(this);
|
246
|
274
|
sv_show_like_img.setOnClickListener(this);
|
|
275
|
sv_show_user_name.setOnClickListener(this);
|
|
276
|
sv_show_user_avatar.setOnClickListener(this);
|
247
|
277
|
}
|
248
|
278
|
|
249
|
279
|
private void initPlayer(View view) {
|
250
|
280
|
playIcon = view.findViewById(R.id.view_show_icon);
|
251
|
281
|
upVideoView2 = view.findViewById(R.id.view_show_video);
|
252
|
|
upVideoView2.setOnClickListener(new View.OnClickListener() {
|
|
282
|
upVideoView2.setOnTouchListener(new View.OnTouchListener() {
|
253
|
283
|
@Override
|
254
|
|
public void onClick(View view) {
|
|
284
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
255
|
285
|
boolean playing = upVideoView2.isPlaying();
|
256
|
286
|
if (playing) {
|
257
|
287
|
upVideoView2.pause();
|
|
@ -260,6 +290,7 @@ public class SvVideoShowView implements View.OnClickListener {
|
260
|
290
|
playIcon.setVisibility(View.GONE);
|
261
|
291
|
upVideoView2.start();
|
262
|
292
|
}
|
|
293
|
return false;
|
263
|
294
|
}
|
264
|
295
|
});
|
265
|
296
|
}
|
|
@ -398,6 +429,15 @@ public class SvVideoShowView implements View.OnClickListener {
|
398
|
429
|
intent.putExtra("targetUserId", talkRecommendBean.addUserId);
|
399
|
430
|
activity.startActivity(intent);
|
400
|
431
|
break;
|
|
432
|
case R.id.sv_show_topic:
|
|
433
|
activity.startActivity(new Intent(activity, TopicDetailsActivity.class)
|
|
434
|
.putExtra("topicId", talkRecommendBean.topicId + ""));
|
|
435
|
break;
|
|
436
|
case R.id.sv_show_user_name:
|
|
437
|
case R.id.sv_show_user_avatar:
|
|
438
|
activity.startActivity(new Intent(activity, PersonalPageActivity.class)
|
|
439
|
.putExtra("targetUserId", talkRecommendBean.addUserId + ""));
|
|
440
|
break;
|
401
|
441
|
default:
|
402
|
442
|
break;
|
403
|
443
|
}
|