Selaa lähdekoodia

modify publish topic title

dxh 6 vuotta sitten
vanhempi
commit
89378aed5e

+ 54 - 14
app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java

6
import android.support.v4.view.ViewPager;
6
import android.support.v4.view.ViewPager;
7
import android.text.TextUtils;
7
import android.text.TextUtils;
8
import android.view.LayoutInflater;
8
import android.view.LayoutInflater;
9
import android.view.MotionEvent;
9
import android.view.View;
10
import android.view.View;
10
import android.view.ViewGroup;
11
import android.view.ViewGroup;
11
import android.view.ViewGroup.LayoutParams;
12
import android.view.ViewGroup.LayoutParams;
20
import com.bumptech.glide.request.RequestOptions;
21
import com.bumptech.glide.request.RequestOptions;
21
import com.electric.chargingpile.R;
22
import com.electric.chargingpile.R;
22
import com.electric.chargingpile.activity.PersonalPageActivity;
23
import com.electric.chargingpile.activity.PersonalPageActivity;
24
import com.electric.chargingpile.activity.TopicDetailsActivity;
23
import com.electric.chargingpile.application.MainApplication;
25
import com.electric.chargingpile.application.MainApplication;
24
import com.electric.chargingpile.data.TalkRecommendBean;
26
import com.electric.chargingpile.data.TalkRecommendBean;
25
import com.electric.chargingpile.util.CircleTransform;
27
import com.electric.chargingpile.util.CircleTransform;
26
import com.electric.chargingpile.util.JsonUtils;
28
import com.electric.chargingpile.util.JsonUtils;
27
import com.electric.chargingpile.util.TimeUtil;
28
import com.electric.chargingpile.util.ToastUtil;
29
import com.electric.chargingpile.util.ToastUtil;
29
import com.electric.chargingpile.view.AlertDialog;
30
import com.electric.chargingpile.view.AlertDialog;
30
import com.electric.chargingpile.view.UpVideoView2;
31
import com.electric.chargingpile.view.UpVideoView2;
53
54
54
55
55
    private LinearLayout sv_show_forward, sv_show_comment_count_ll, sv_show_like_ll,
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
    private TextView sv_show_comment_count_tv, sv_show_like_tv, sv_show_tvcon,
58
    private TextView sv_show_comment_count_tv, sv_show_like_tv, sv_show_tvcon,
58
            sv_show_user_name, sv_show_user_time, sv_show_topic_con, vd_title_tv;
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
    private View sv_show_tvcon_more;
62
    private View sv_show_tvcon_more;
62
63
139
        sv_show_tvcon.setText(talkRecommendBean.content);
140
        sv_show_tvcon.setText(talkRecommendBean.content);
140
        sv_show_tvcon.setText(talkRecommendBean.title);
141
        sv_show_tvcon.setText(talkRecommendBean.title);
141
        sv_show_user_name.setText(talkRecommendBean.nickName);
142
        sv_show_user_name.setText(talkRecommendBean.nickName);
142
        String time = ""+talkRecommendBean.addTime;
143
        String time = "" + talkRecommendBean.addTime;
143
        sv_show_user_time.setText(time);
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
        if (TextUtils.isEmpty(talkRecommendBean.headImgUrl)) {
153
        if (TextUtils.isEmpty(talkRecommendBean.headImgUrl)) {
147
            Picasso.with(activity)
154
            Picasso.with(activity)
165
        } else {
172
        } else {
166
            // sv_show_like_img  not like
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
    private void likeRequest(final int likeFlag) {
203
    private void likeRequest(final int likeFlag) {
178
        String url = MainApplication.urlNew + "/article/like";
204
        String url = MainApplication.urlNew + "/article/like";
179
        Map<String, String> map = new HashMap<>();
205
        Map<String, String> map = new HashMap<>();
238
        sv_show_user_name = view.findViewById(R.id.sv_show_user_name);
264
        sv_show_user_name = view.findViewById(R.id.sv_show_user_name);
239
        sv_show_user_time = view.findViewById(R.id.sv_show_user_time);
265
        sv_show_user_time = view.findViewById(R.id.sv_show_user_time);
240
        sv_show_topic_con = view.findViewById(R.id.sv_show_topic_con);
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
        sv_show_tvcon_more.setOnClickListener(this);
269
        sv_show_tvcon_more.setOnClickListener(this);
242
        sv_show_comment_count_ll.setOnClickListener(this);
270
        sv_show_comment_count_ll.setOnClickListener(this);
243
        sv_show_comment_ll.setOnClickListener(this);
271
        sv_show_comment_ll.setOnClickListener(this);
244
        sv_show_forward.setOnClickListener(this);
272
        sv_show_forward.setOnClickListener(this);
245
        sv_show_like_ll.setOnClickListener(this);
273
        sv_show_like_ll.setOnClickListener(this);
246
        sv_show_like_img.setOnClickListener(this);
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
    private void initPlayer(View view) {
279
    private void initPlayer(View view) {
250
        playIcon = view.findViewById(R.id.view_show_icon);
280
        playIcon = view.findViewById(R.id.view_show_icon);
251
        upVideoView2 = view.findViewById(R.id.view_show_video);
281
        upVideoView2 = view.findViewById(R.id.view_show_video);
252
        upVideoView2.setOnClickListener(new View.OnClickListener() {
282
        upVideoView2.setOnTouchListener(new View.OnTouchListener() {
253
            @Override
283
            @Override
254
            public void onClick(View view) {
284
            public boolean onTouch(View view, MotionEvent motionEvent) {
255
                boolean playing = upVideoView2.isPlaying();
285
                boolean playing = upVideoView2.isPlaying();
256
                if (playing) {
286
                if (playing) {
257
                    upVideoView2.pause();
287
                    upVideoView2.pause();
260
                    playIcon.setVisibility(View.GONE);
290
                    playIcon.setVisibility(View.GONE);
261
                    upVideoView2.start();
291
                    upVideoView2.start();
262
                }
292
                }
293
                return false;
263
            }
294
            }
264
        });
295
        });
265
    }
296
    }
398
                intent.putExtra("targetUserId", talkRecommendBean.addUserId);
429
                intent.putExtra("targetUserId", talkRecommendBean.addUserId);
399
                activity.startActivity(intent);
430
                activity.startActivity(intent);
400
                break;
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
            default:
441
            default:
402
                break;
442
                break;
403
        }
443
        }

+ 0 - 2
app/src/main/res/layout/view_show_bottom.xml

123
        android:layout_marginRight="39dp"
123
        android:layout_marginRight="39dp"
124
        android:layout_marginBottom="23dp"
124
        android:layout_marginBottom="23dp"
125
        android:textColor="#E2E2E2"
125
        android:textColor="#E2E2E2"
126
        android:ellipsize="end"
127
        android:maxLines="3"
128
        android:textSize="14sp" />
126
        android:textSize="14sp" />
129
127
130
    <ImageView
128
    <ImageView