huyuguo 5 gadi atpakaļ
vecāks
revīzija
ce51d81194

+ 121 - 164
app/src/main/java/com/electric/chargingpile/activity/ChatContentListActivity.java

@ -1,8 +1,6 @@
1 1
package com.electric.chargingpile.activity;
2 2
3 3
import android.content.Intent;
4
import android.graphics.Color;
5
import android.graphics.drawable.ColorDrawable;
6 4
import android.support.annotation.Nullable;
7 5
import android.support.constraint.ConstraintLayout;
8 6
import android.support.v4.app.Fragment;
@ -13,12 +11,9 @@ import android.support.v7.app.AppCompatActivity;
13 11
import android.os.Bundle;
14 12
import android.text.TextUtils;
15 13
import android.text.method.ScrollingMovementMethod;
16
import android.util.Log;
17 14
import android.view.LayoutInflater;
18 15
import android.view.View;
19 16
import android.view.ViewGroup;
20
import android.view.ViewTreeObserver;
21
import android.widget.Button;
22 17
import android.widget.ImageView;
23 18
import android.widget.ProgressBar;
24 19
import android.widget.TextView;
@ -29,7 +24,6 @@ import com.electric.chargingpile.R;
29 24
import com.electric.chargingpile.application.MainApplication;
30 25
import com.electric.chargingpile.data.ChatBeanLab;
31 26
import com.electric.chargingpile.data.ChatRecommendBean;
32
import com.electric.chargingpile.manager.PreferenceManager;
33 27
import com.electric.chargingpile.manager.ProfileManager;
34 28
import com.electric.chargingpile.util.CircleTransform;
35 29
import com.electric.chargingpile.util.CommonParams;
@ -63,13 +57,10 @@ public class ChatContentListActivity extends AppCompatActivity {
63 57
    public static final String FROM_CHAT_HOME = "from_chat_home";
64 58
    public String from;
65 59
    private int index; // 当前显示cell的索引
66
    private static final float MIN_SCALE = 0.75f;
67
    private static final float MIN_ALPHA = 0.75f;
68 60
    private static int screenWidth;
69 61
    private static int screenHeight;
70 62
    private static int statusBarHeight;
71 63
    public static boolean isFirstPlay;
72
    private boolean makeSureNetworkForVideo = false;
73 64
    private ChatContentAdapter chatContentAdapter;
74 65
    private boolean isFirstShowNetworkDialog = true;
75 66
@ -88,6 +79,13 @@ public class ChatContentListActivity extends AppCompatActivity {
88 79
    }
89 80
90 81
    @Override
82
    protected void onPause() {
83
        super.onPause();
84
        GSYVideoADManager.onPause();
85
        GSYVideoManager.onPause();
86
    }
87
88
    @Override
91 89
    protected void onStop() {
92 90
        super.onStop();
93 91
        Util.setFullScreen(this, false);
@ -201,7 +199,7 @@ public class ChatContentListActivity extends AppCompatActivity {
201 199
    }
202 200
203 201
204
    public static class ChatContentFragment extends Fragment {
202
    public static class ChatContentFragment extends Fragment implements View.OnClickListener {
205 203
        private static final String ARG_INDEX = "index";
206 204
        private static final String ARG_FROM = "from";
207 205
        private VideoPlayer videoPlayer;
@ -222,6 +220,7 @@ public class ChatContentListActivity extends AppCompatActivity {
222 220
        private ImageView closeUnfold;
223 221
        private TextView topicTitle;
224 222
        private ConstraintLayout userInfo;
223
        private ConstraintLayout statusBar;
225 224
226 225
        public static ChatContentFragment newInstance(int index, String from) {
227 226
            ChatContentFragment fragment = new ChatContentFragment();
@ -249,9 +248,13 @@ public class ChatContentListActivity extends AppCompatActivity {
249 248
                if (bean.targetType == ChatRecommendBean.TARGET_TYPE_VIDEO) {
250 249
                    rootView = inflater.inflate(R.layout.fragment_chat_content_video, container, false);
251 250
                    initVideoView(rootView, bean);
251
                    initCommonView(rootView, bean);
252
                    initListener(rootView, bean);
252 253
                } else if (bean.targetType == ChatRecommendBean.TARGET_TYPE_IMAGE_TEXT) {
253 254
                    rootView = inflater.inflate(R.layout.fragment_chat_content_pictures, container, false);
254 255
                    initPicturesView(rootView, bean);
256
                    initCommonView(rootView, bean);
257
                    initListener(rootView, bean);
255 258
                }
256 259
            }
257 260
@ -263,20 +266,7 @@ public class ChatContentListActivity extends AppCompatActivity {
263 266
            videoPlayer.setUp(bean.videoUrl, true, "");
264 267
            videoIcon = rootView.findViewById(R.id.videoIcon);
265 268
            playIcon = rootView.findViewById(R.id.playIcon);
266
            likeLabel = rootView.findViewById(R.id.likeLabel);
267
            likeIcon = rootView.findViewById(R.id.likeIcon);
268 269
            progressBar = rootView.findViewById(R.id.progressBar);
269
            msg = rootView.findViewById(R.id.msg);
270
            fold = rootView.findViewById(R.id.fold);
271
            toolBar = rootView.findViewById(R.id.toolBar);
272
            headImage = rootView.findViewById(R.id.headImage);
273
            nickName = rootView.findViewById(R.id.nickName);
274
            addDate = rootView.findViewById(R.id.addDate);
275
            topicInfo = rootView.findViewById(R.id.topicInfo);
276
            closeUnfold = rootView.findViewById(R.id.closeUnfold);
277
            topicTitle = rootView.findViewById(R.id.topicTitle);
278
            userInfo = rootView.findViewById(R.id.userInfo);
279
            ConstraintLayout navBar = rootView.findViewById(R.id.navBar);
280 270
281 271
            // 视频尺寸判断
282 272
            if (bean.coverImgH != 0 && bean.coverImgW != 0 && bean.coverImgW > bean.coverImgH) {
@ -289,38 +279,19 @@ public class ChatContentListActivity extends AppCompatActivity {
289 279
                videoPlayer.setLayoutParams(params);
290 280
            }
291 281
292
            ConstraintLayout.LayoutParams navBarParams = (ConstraintLayout.LayoutParams) navBar.getLayoutParams();
293
            navBarParams.topMargin = statusBarHeight;
294
            navBar.setLayoutParams(navBarParams);
295
296
            rootView.findViewById(R.id.backIcon).setOnClickListener(new View.OnClickListener() {
297
                @Override
298
                public void onClick(View view) {
299
                    getActivity().finish();
300
                }
301
            });
302
303
            rootView.findViewById(R.id.moreIcon).setOnClickListener(new View.OnClickListener() {
304
                @Override
305
                public void onClick(View view) {
306
                    ToastUtil.showToast(getContext(), "more ", Toast.LENGTH_SHORT);
307
                }
308
            });
309
310
            likeLabel.setText(bean.likeNums > 999 ? "999+" : bean.likeNums + "");
311
312
            if (bean.likeFlg == 1) {
313
                likeIcon.setImageResource(R.drawable.like_red_icon);
314
            } else {
315
                likeIcon.setImageResource(R.drawable.like_icon);
316
            }
317
318 282
            // 封面图片
319 283
            ImageView thumbImageView = new ImageView(getContext());
320 284
            thumbImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
321 285
            ImageDisplayUtils.dispalyImg(getContext(), bean.coverImgUrl, thumbImageView);
322 286
            videoPlayer.setThumbImageView(thumbImageView);
323 287
288
            videoPlayer.setGSYVideoProgressListener(new GSYVideoProgressListener() {
289
                @Override
290
                public void onProgress(int i, int i1, int i2, int i3) {
291
                    progressBar.setProgress(i);
292
                }
293
            });
294
324 295
            rootView.findViewById(R.id.videoPlayerCover).setOnClickListener(new View.OnClickListener() {
325 296
                @Override
326 297
                public void onClick(View view) {
@ -346,25 +317,80 @@ public class ChatContentListActivity extends AppCompatActivity {
346 317
                }
347 318
            });
348 319
349
            rootView.findViewById(R.id.like).setOnClickListener(new View.OnClickListener() {
350
                @Override
351
                public void onClick(View view) {
352
                    if (bean.likeFlg == 0) {
353
                        doLike(bean);
354
                    }
355
                }
356
            });
320
            setVideoAllCallBack();
321
        }
357 322
358
            videoPlayer.setGSYVideoProgressListener(new GSYVideoProgressListener() {
359
                @Override
360
                public void onProgress(int i, int i1, int i2, int i3) {
361
                    progressBar.setProgress(i);
362
                }
363
            });
323
        private void initListener(final View rootView, final ChatRecommendBean bean) {
324
            rootView.findViewById(R.id.like).setOnClickListener(this);
325
            userInfo.setOnClickListener(this);
326
            topicInfo.setOnClickListener(this);
327
            rootView.findViewById(R.id.backIcon).setOnClickListener(this);
328
            rootView.findViewById(R.id.moreIcon).setOnClickListener(this);
329
            fold.setOnClickListener(this);
330
            closeUnfold.setOnClickListener(this);
331
            rootView.findViewById(R.id.bottomView).setOnClickListener(this);
332
        }
333
334
        @Override
335
        public void onClick(View view) {
336
            Intent intent = null;
337
            switch (view.getId()) {
338
                case R.id.like: // 点赞操作
339
                    doLike(bean);
340
                    break;
341
                case R.id.userInfo: // 点击用户头像,跳转个人中心
342
                    intent = new Intent(getContext(), UserPageActivity.class);
343
                    intent.putExtra("targetUserId", bean.addUserId + "");
344
                    getContext().startActivity(intent);
345
                    break;
346
                case R.id.topicInfo: // 跳转话题列表页
347
                    intent = new Intent(getContext(), TopicDetailActivity.class);
348
                    intent.putExtra("topicId", bean.topicId);
349
                    getContext().startActivity(intent);
350
                    break;
351
                case R.id.backIcon: // 左上退出按钮
352
                    getActivity().finish();
353
                    break;
354
                case R.id.moreIcon: // 右上更多按钮
355
                    ToastUtil.showToast(getContext(), "more ", Toast.LENGTH_SHORT);
356
                    break;
357
                case R.id.fold:         // 超过三行文字,向下展开按钮 或者 折叠
358
                case R.id.closeUnfold:
359
                    unfold();
360
                    break;
361
                case R.id.bottomView: // to do nothing
362
                    break;
363
            }
364 364
365
            final String str = bean.title;
366
            msg.setText(str);
365
        }
367 366
367
        private void initCommonView(final View rootView, final ChatRecommendBean bean) {
368
            statusBar = rootView.findViewById(R.id.statusBar);
369
            likeLabel = rootView.findViewById(R.id.likeLabel);
370
            likeIcon = rootView.findViewById(R.id.likeIcon);
371
            msg = rootView.findViewById(R.id.msg);
372
            fold = rootView.findViewById(R.id.fold);
373
            toolBar = rootView.findViewById(R.id.toolBar);
374
            headImage = rootView.findViewById(R.id.headImage);
375
            nickName = rootView.findViewById(R.id.nickName);
376
            addDate = rootView.findViewById(R.id.addDate);
377
            topicInfo = rootView.findViewById(R.id.topicInfo);
378
            closeUnfold = rootView.findViewById(R.id.closeUnfold);
379
            topicTitle = rootView.findViewById(R.id.topicTitle);
380
            userInfo = rootView.findViewById(R.id.userInfo);
381
382
            ConstraintLayout.LayoutParams statusBarParams = (ConstraintLayout.LayoutParams) statusBar.getLayoutParams();
383
            statusBarParams.height = statusBarHeight;
384
            statusBar.setLayoutParams(statusBarParams);
385
386
            likeLabel.setText(bean.likeNums > 999 ? "999+" : bean.likeNums + "");
387
            if (bean.likeFlg == 1) {
388
                likeIcon.setImageResource(R.drawable.like_red_icon);
389
            } else {
390
                likeIcon.setImageResource(R.drawable.like_icon);
391
            }
392
393
            msg.setText(bean.title);
368 394
            msg.post(new Runnable() {
369 395
                @Override
370 396
                public void run() {
@ -378,52 +404,6 @@ public class ChatContentListActivity extends AppCompatActivity {
378 404
                }
379 405
            });
380 406
381
382
            fold.setOnClickListener(new View.OnClickListener() {
383
                @Override
384
                public void onClick(View view) {
385
                    Log.d(TAG, "onClick: " + msg.getLineCount());
386
                    int maxLines = msg.getMaxLines();
387
                    if (maxLines == 3) {
388
                        closeUnfold.setVisibility(View.VISIBLE);
389
                        fold.setImageResource(R.drawable.unfold_icon);
390
                        if (msgLines > 7) {
391
                            msg.setMaxLines(7);
392
                            msg.setMovementMethod(ScrollingMovementMethod.getInstance());
393
                            msg.setScrollbarFadingEnabled(false);
394
                        } else {
395
                            msg.setMaxLines(Integer.MAX_VALUE);
396
                        }
397
                        toolBar.setVisibility(View.GONE);
398
                    } else {
399
                        closeUnfold.setVisibility(View.GONE);
400
                        fold.setImageResource(R.drawable.fold_icon);
401
                        msg.setMovementMethod(null);
402
                        msg.setMaxLines(3);
403
                        msg.setScrollbarFadingEnabled(true);
404
                        msg.setEllipsize(TextUtils.TruncateAt.END);
405
                        msg.setText(str);  // 重新赋值,解决...不出现的问题
406
407
                        toolBar.setVisibility(View.VISIBLE);
408
                    }
409
                }
410
            });
411
412
            closeUnfold.setOnClickListener(new View.OnClickListener() {
413
                @Override
414
                public void onClick(View view) {
415
                    closeUnfold.setVisibility(View.GONE);
416
                    fold.setImageResource(R.drawable.fold_icon);
417
                    msg.setMovementMethod(null);
418
                    msg.setMaxLines(3);
419
                    msg.setScrollbarFadingEnabled(true);
420
                    msg.setEllipsize(TextUtils.TruncateAt.END);
421
                    msg.setText(str);  // 重新赋值,解决...不出现的问题
422
423
                    toolBar.setVisibility(View.VISIBLE);
424
                }
425
            });
426
427 407
            if (TextUtils.isEmpty(bean.headImgUrl)) {
428 408
                Picasso.with(getContext())
429 409
                        .load(R.drawable.icon_face2_0)
@ -450,36 +430,41 @@ public class ChatContentListActivity extends AppCompatActivity {
450 430
                topicTitle.setText(bean.topicName);
451 431
                topicInfo.setVisibility(View.VISIBLE);
452 432
            }
453
            topicInfo.setOnClickListener(new View.OnClickListener() {
454
                @Override
455
                public void onClick(View view) {
456
                    Intent intent = new Intent(getContext(), TopicDetailActivity.class);
457
                    intent.putExtra("topicId", bean.topicId);
458
                    getContext().startActivity(intent);
459
                }
460
            });
461
462
            userInfo.setOnClickListener(new View.OnClickListener() {
463
                @Override
464
                public void onClick(View view) {
465
                    Intent intent = new Intent(getContext(), UserPageActivity.class);
466
                    intent.putExtra("targetUserId", bean.addUserId + "");
467
                    getContext().startActivity(intent);
468
                }
469
            });
470
471
433
        }
472 434
473
            rootView.findViewById(R.id.bottomView).setOnClickListener(new View.OnClickListener() {
474
                @Override
475
                public void onClick(View view) {
435
        /**
436
         * 展开或折叠操作
437
         */
438
        private void unfold() {
439
            int maxLines = msg.getMaxLines();
440
            if (maxLines == 3) {
441
                closeUnfold.setVisibility(View.VISIBLE);
442
                fold.setImageResource(R.drawable.unfold_icon);
443
                if (msgLines > 7) {
444
                    msg.setMaxLines(7);
445
                    msg.setMovementMethod(ScrollingMovementMethod.getInstance());
446
                    msg.setScrollbarFadingEnabled(false);
447
                } else {
448
                    msg.setMaxLines(Integer.MAX_VALUE);
476 449
                }
477
            });
478
479
            setVideoAllCallBack();
450
                toolBar.setVisibility(View.GONE);
451
            } else {
452
                closeUnfold.setVisibility(View.GONE);
453
                fold.setImageResource(R.drawable.fold_icon);
454
                msg.setMovementMethod(null);
455
                msg.setMaxLines(3);
456
                msg.setScrollbarFadingEnabled(true);
457
                msg.setEllipsize(TextUtils.TruncateAt.END);
458
                msg.setText(bean.title);  // 重新赋值,解决...不出现的问题
459
460
                toolBar.setVisibility(View.VISIBLE);
461
            }
480 462
        }
481 463
482 464
        private void doLike(final ChatRecommendBean bean) {
465
            if (bean.likeFlg == 1) {
466
                return;
467
            }
483 468
            String url = MainApplication.urlNew + "/topic/like.do";
484 469
            Map<String, String> map = new HashMap<>();
485 470
            map.put("targetId", bean.targetId + "");
@ -544,8 +529,6 @@ public class ChatContentListActivity extends AppCompatActivity {
544 529
        }
545 530
546 531
        private void initPicturesView(View rootView, ChatRecommendBean bean) {
547
            TextView positionTextView = rootView.findViewById(R.id.position);
548
            positionTextView.setText(bean.title);
549 532
        }
550 533
551 534
        private void setVideoAllCallBack() {
@ -650,31 +633,5 @@ public class ChatContentListActivity extends AppCompatActivity {
650 633
                }
651 634
            });
652 635
        }
653
654
        @Override
655
        public void onPause() {
656
            super.onPause();
657
            if (videoPlayer != null) {
658
                videoPlayer.onVideoPause();
659
            }
660
            if (playIcon != null) {
661
                playIcon.setVisibility(View.VISIBLE);
662
            }
663
        }
664
665
        @Override
666
        public void onResume() {
667
            super.onResume();
668
//            if (videoPlayer != null) {
669
//                videoPlayer.onVideoResume();
670
//            }
671
        }
672
673
        @Override
674
        public void onDestroy() {
675
            super.onDestroy();
676
            GSYVideoManager.releaseAllVideos();
677
            GSYVideoADManager.releaseAllVideos();
678
        }
679 636
    }
680 637
}

+ 0 - 10
app/src/main/res/layout/activity_chat_content_list.xml

@ -14,14 +14,4 @@
14 14
        app:layout_constraintEnd_toEndOf="parent"
15 15
        app:layout_constraintStart_toStartOf="parent"
16 16
        app:layout_constraintTop_toTopOf="parent"></fr.castorflex.android.verticalviewpager.VerticalViewPager>
17
18
    <Button
19
        android:id="@+id/button2"
20
        android:layout_width="wrap_content"
21
        android:layout_height="wrap_content"
22
        android:layout_marginTop="120dp"
23
        android:text="Button"
24
        app:layout_constraintEnd_toEndOf="parent"
25
        app:layout_constraintStart_toStartOf="parent"
26
        app:layout_constraintTop_toTopOf="parent" />
27 17
</android.support.constraint.ConstraintLayout>

+ 338 - 0
app/src/main/res/layout/fragment_chat_content_common.xml

@ -0,0 +1,338 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<android.support.constraint.ConstraintLayout 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
8
    <android.support.constraint.ConstraintLayout
9
        android:id="@+id/statusBar"
10
        android:layout_width="match_parent"
11
        android:layout_height="20dp"
12
        tools:background="#76daff"
13
        app:layout_constraintLeft_toLeftOf="parent"
14
        app:layout_constraintRight_toRightOf="parent"
15
        app:layout_constraintTop_toTopOf="parent" />
16
17
    <!-- 导航栏 -->
18
    <android.support.constraint.ConstraintLayout
19
        android:id="@+id/navBar"
20
        android:layout_width="match_parent"
21
        android:layout_height="44dp"
22
        app:layout_constraintLeft_toLeftOf="parent"
23
        app:layout_constraintRight_toRightOf="parent"
24
        app:layout_constraintTop_toBottomOf="@+id/statusBar"
25
        tools:background="#DC7633">
26
27
        <ImageView
28
            android:id="@+id/backIcon"
29
            android:layout_width="wrap_content"
30
            android:layout_height="match_parent"
31
            android:paddingLeft="20dp"
32
            android:paddingRight="20dp"
33
            android:src="@drawable/app_white_back_icon"
34
            app:layout_constraintLeft_toLeftOf="parent" />
35
36
        <ImageView
37
            android:id="@+id/moreIcon"
38
            android:layout_width="wrap_content"
39
            android:layout_height="match_parent"
40
            android:paddingLeft="20dp"
41
            android:paddingRight="20dp"
42
            android:src="@drawable/app_header_more_icon"
43
            app:layout_constraintRight_toRightOf="parent" />
44
45
    </android.support.constraint.ConstraintLayout>
46
47
    <!-- 底部视图 -->
48
    <android.support.constraint.ConstraintLayout
49
        android:id="@+id/bottomView"
50
        android:layout_width="match_parent"
51
        android:layout_height="wrap_content"
52
        android:layout_marginBottom="-40dp"
53
        app:layout_constraintBottom_toBottomOf="parent"
54
        tools:background="#f38654">
55
56
        <!-- 主题信息及关闭按钮 -->
57
        <android.support.constraint.ConstraintLayout
58
            android:layout_width="match_parent"
59
            android:layout_height="52dp"
60
            app:layout_constraintBottom_toTopOf="@+id/userInfo"
61
            tools:background="#39bd00">
62
63
            <android.support.constraint.ConstraintLayout
64
                android:id="@+id/topicInfo"
65
                android:layout_width="wrap_content"
66
                android:layout_height="30dp"
67
                android:layout_marginLeft="15dp"
68
                android:background="@drawable/topic_shape"
69
                android:paddingLeft="12dp"
70
                android:paddingRight="12dp"
71
                app:layout_constraintBottom_toBottomOf="parent"
72
                app:layout_constraintLeft_toLeftOf="parent"
73
                app:layout_constraintTop_toTopOf="parent"
74
                tools:background="#ff967d">
75
76
                <ImageView
77
                    android:id="@+id/topicIcon"
78
                    android:layout_width="wrap_content"
79
                    android:layout_height="wrap_content"
80
                    android:src="@drawable/topic_icon"
81
                    app:layout_constraintBottom_toBottomOf="parent"
82
                    app:layout_constraintLeft_toLeftOf="parent"
83
                    app:layout_constraintTop_toTopOf="parent" />
84
85
                <TextView
86
                    android:id="@+id/topicTitle"
87
                    android:layout_width="wrap_content"
88
                    android:layout_height="wrap_content"
89
                    android:paddingLeft="5dp"
90
                    android:textColor="#ffffff"
91
                    android:textSize="11sp"
92
                    app:layout_constraintBottom_toBottomOf="parent"
93
                    app:layout_constraintLeft_toRightOf="@+id/topicIcon"
94
                    app:layout_constraintTop_toTopOf="parent"
95
                    tools:text="#新能源#" />
96
            </android.support.constraint.ConstraintLayout>
97
98
99
            <ImageView
100
                android:id="@+id/closeUnfold"
101
                android:layout_width="22dp"
102
                android:layout_height="22dp"
103
                android:layout_margin="15dp"
104
                android:src="@drawable/icon_close"
105
                android:visibility="gone"
106
                app:layout_constraintBottom_toBottomOf="parent"
107
                app:layout_constraintRight_toRightOf="parent"
108
                app:layout_constraintTop_toTopOf="parent"
109
                tools:background="#013369"
110
                tools:visibility="visible" />
111
        </android.support.constraint.ConstraintLayout>
112
        <!-- 用户信息 -->
113
        <android.support.constraint.ConstraintLayout
114
            android:id="@+id/userInfo"
115
            android:layout_width="wrap_content"
116
            android:layout_height="wrap_content"
117
            android:layout_marginBottom="5dp"
118
            android:paddingLeft="15dp"
119
            app:layout_constraintBottom_toTopOf="@+id/msgContainer"
120
            app:layout_constraintLeft_toLeftOf="parent"
121
            tools:background="#33ccff">
122
123
            <ImageView
124
                android:id="@+id/headImage"
125
                android:layout_width="20dp"
126
                android:layout_height="20dp"
127
                app:layout_constraintBottom_toBottomOf="parent"
128
                app:layout_constraintLeft_toLeftOf="parent"
129
                app:layout_constraintTop_toTopOf="parent"
130
                tools:srcCompat="@tools:sample/avatars[1]" />
131
132
            <android.support.constraint.ConstraintLayout
133
                android:layout_width="wrap_content"
134
                android:layout_height="wrap_content"
135
                android:paddingLeft="5dp"
136
                app:layout_constraintBottom_toBottomOf="parent"
137
                app:layout_constraintLeft_toRightOf="@+id/headImage"
138
                app:layout_constraintTop_toTopOf="parent">
139
140
                <TextView
141
                    android:id="@+id/nickName"
142
                    android:layout_width="wrap_content"
143
                    android:layout_height="wrap_content"
144
                    android:textColor="#ffffff"
145
                    android:textSize="12sp"
146
                    app:layout_constraintLeft_toLeftOf="parent"
147
                    app:layout_constraintTop_toTopOf="parent"
148
                    tools:text="小电" />
149
150
                <TextView
151
                    android:id="@+id/addDate"
152
                    android:layout_width="wrap_content"
153
                    android:layout_height="wrap_content"
154
                    android:textColor="#888888"
155
                    android:textSize="12sp"
156
                    app:layout_constraintBottom_toBottomOf="parent"
157
                    app:layout_constraintLeft_toLeftOf="parent"
158
                    app:layout_constraintTop_toBottomOf="@+id/nickName"
159
                    tools:text="2019-05-29 16:28" />
160
            </android.support.constraint.ConstraintLayout>
161
        </android.support.constraint.ConstraintLayout>
162
163
        <!-- 信息 -->
164
        <android.support.constraint.ConstraintLayout
165
            android:id="@+id/msgContainer"
166
            android:layout_width="match_parent"
167
            android:layout_height="wrap_content"
168
            app:layout_constraintBottom_toTopOf="@+id/progressBar">
169
170
            <TextView
171
                android:id="@+id/msg"
172
                android:layout_width="0dp"
173
                android:layout_height="wrap_content"
174
                android:layout_marginRight="30dp"
175
                android:ellipsize="end"
176
                android:paddingLeft="40dp"
177
                android:paddingRight="10dp"
178
                android:paddingBottom="25dp"
179
                android:scrollbarStyle="outsideOverlay"
180
                android:scrollbars="vertical"
181
                android:textColor="#e2e2e2"
182
                android:textSize="14sp"
183
                app:layout_constraintBottom_toBottomOf="parent"
184
                app:layout_constraintLeft_toLeftOf="parent"
185
                app:layout_constraintRight_toRightOf="parent"
186
                app:layout_constraintTop_toTopOf="parent"
187
                tools:text="迪克啥看来当减肥考虑送到,迪克啥看来当减肥考虑送到迪克啥看来当减肥考虑送到" />
188
189
            <ImageView
190
                android:id="@+id/fold"
191
                android:layout_width="42dp"
192
                android:layout_height="62dp"
193
                android:paddingLeft="15dp"
194
                android:paddingTop="25dp"
195
                android:paddingRight="15dp"
196
                android:paddingBottom="25dp"
197
                android:src="@drawable/unfold_icon"
198
                app:layout_constraintBottom_toBottomOf="parent"
199
                app:layout_constraintRight_toRightOf="parent" />
200
        </android.support.constraint.ConstraintLayout>
201
        <!-- 自定义进度条 -->
202
        <ProgressBar
203
            android:id="@+id/progressBar"
204
            style="@android:style/Widget.ProgressBar.Horizontal"
205
            android:layout_width="match_parent"
206
            android:layout_height="1dp"
207
            android:max="100"
208
            android:progressDrawable="@drawable/video_player_progressbar"
209
            app:layout_constraintBottom_toTopOf="@+id/toolBar"
210
            tools:progress="50" />
211
        <!-- 底部工具栏 -->
212
        <android.support.constraint.ConstraintLayout
213
            android:id="@+id/toolBar"
214
            android:layout_width="match_parent"
215
            android:layout_height="50dp"
216
            app:layout_constraintBottom_toBottomOf="parent"
217
            tools:background="#00aee6">
218
219
            <!-- 写评论-->
220
            <android.support.constraint.ConstraintLayout
221
                android:id="@+id/writeComment"
222
                android:layout_width="wrap_content"
223
                android:layout_height="match_parent"
224
                android:paddingLeft="15dp"
225
                android:paddingRight="15dp"
226
                app:layout_constraintLeft_toLeftOf="parent">
227
228
                <ImageView
229
                    android:id="@+id/WriteCommentIcon"
230
                    android:layout_width="wrap_content"
231
                    android:layout_height="wrap_content"
232
                    app:layout_constraintBottom_toBottomOf="parent"
233
                    app:layout_constraintLeft_toLeftOf="parent"
234
                    app:layout_constraintTop_toTopOf="parent"
235
                    app:srcCompat="@drawable/write_comment_icon" />
236
237
                <TextView
238
                    android:layout_width="wrap_content"
239
                    android:layout_height="match_parent"
240
                    android:gravity="center"
241
                    android:paddingLeft="3dp"
242
                    android:text="写评论"
243
                    android:textColor="#c2c2c2"
244
                    android:textSize="12sp"
245
                    app:layout_constraintLeft_toRightOf="@+id/WriteCommentIcon" />
246
            </android.support.constraint.ConstraintLayout>
247
248
            <!-- 转发 -->
249
            <android.support.constraint.ConstraintLayout
250
                android:id="@+id/transmit"
251
                android:layout_width="wrap_content"
252
                android:layout_height="match_parent"
253
                android:paddingLeft="15dp"
254
                android:paddingRight="15dp"
255
                app:layout_constraintRight_toRightOf="parent">
256
257
                <ImageView
258
                    android:layout_width="wrap_content"
259
                    android:layout_height="wrap_content"
260
                    android:paddingRight="3dp"
261
                    app:layout_constraintBottom_toBottomOf="parent"
262
                    app:layout_constraintRight_toLeftOf="@+id/transmitLabel"
263
                    app:layout_constraintTop_toTopOf="parent"
264
                    app:srcCompat="@drawable/transmit_icon" />
265
266
                <TextView
267
                    android:id="@+id/transmitLabel"
268
                    android:layout_width="wrap_content"
269
                    android:layout_height="match_parent"
270
                    android:gravity="center"
271
                    android:paddingLeft="3dp"
272
                    android:text="转发"
273
                    android:textColor="#888888"
274
                    android:textSize="12sp"
275
                    app:layout_constraintRight_toRightOf="parent" />
276
            </android.support.constraint.ConstraintLayout>
277
278
            <!-- 评论列表 -->
279
            <android.support.constraint.ConstraintLayout
280
                android:id="@+id/comment"
281
                android:layout_width="wrap_content"
282
                android:layout_height="match_parent"
283
                android:paddingLeft="15dp"
284
                android:paddingRight="15dp"
285
                app:layout_constraintRight_toLeftOf="@+id/transmit">
286
287
                <ImageView
288
                    android:layout_width="wrap_content"
289
                    android:layout_height="wrap_content"
290
                    android:src="@drawable/comment_icon"
291
                    app:layout_constraintBottom_toBottomOf="parent"
292
                    app:layout_constraintRight_toLeftOf="@+id/commentLabel"
293
                    app:layout_constraintTop_toTopOf="parent" />
294
295
                <TextView
296
                    android:id="@+id/commentLabel"
297
                    android:layout_width="wrap_content"
298
                    android:layout_height="match_parent"
299
                    android:gravity="center"
300
                    android:paddingLeft="3dp"
301
                    android:textColor="#888888"
302
                    android:textSize="12sp"
303
                    app:layout_constraintRight_toRightOf="parent"
304
                    tools:text="123" />
305
306
            </android.support.constraint.ConstraintLayout>
307
            <!-- 点赞 -->
308
            <android.support.constraint.ConstraintLayout
309
                android:id="@+id/like"
310
                android:layout_width="wrap_content"
311
                android:layout_height="match_parent"
312
                app:layout_constraintRight_toLeftOf="@+id/comment">
313
314
                <ImageView
315
                    android:id="@+id/likeIcon"
316
                    android:layout_width="wrap_content"
317
                    android:layout_height="wrap_content"
318
                    android:src="@drawable/like_icon"
319
                    app:layout_constraintBottom_toBottomOf="parent"
320
                    app:layout_constraintRight_toLeftOf="@+id/likeLabel"
321
                    app:layout_constraintTop_toTopOf="parent" />
322
323
                <TextView
324
                    android:id="@+id/likeLabel"
325
                    android:layout_width="wrap_content"
326
                    android:layout_height="match_parent"
327
                    android:gravity="center"
328
                    android:paddingLeft="3dp"
329
                    android:textColor="#888888"
330
                    android:textSize="12sp"
331
                    app:layout_constraintRight_toRightOf="parent"
332
                    tools:text="999+" />
333
            </android.support.constraint.ConstraintLayout>
334
335
        </android.support.constraint.ConstraintLayout>
336
337
    </android.support.constraint.ConstraintLayout>
338
</android.support.constraint.ConstraintLayout>

+ 1 - 9
app/src/main/res/layout/fragment_chat_content_pictures.xml

@ -7,13 +7,5 @@
7 7
    android:layout_width="match_parent"
8 8
    android:layout_height="match_parent">
9 9
10
    <TextView
11
        android:id="@+id/position"
12
        android:layout_width="wrap_content"
13
        android:layout_height="wrap_content"
14
        android:layout_marginTop="20dp"
15
        android:text="TextView"
16
        app:layout_constraintEnd_toEndOf="parent"
17
        app:layout_constraintStart_toStartOf="parent"
18
        app:layout_constraintTop_toTopOf="parent" />
10
    <include layout="@layout/fragment_chat_content_common"/>
19 11
</android.support.constraint.ConstraintLayout>

+ 2 - 320
app/src/main/res/layout/fragment_chat_content_video.xml

@ -40,327 +40,9 @@
40 40
        app:layout_constraintBottom_toBottomOf="parent"
41 41
        app:layout_constraintLeft_toLeftOf="parent"
42 42
        app:layout_constraintRight_toRightOf="parent"
43
        app:layout_constraintTop_toTopOf="parent"></android.support.constraint.ConstraintLayout>
44
45
    <android.support.constraint.ConstraintLayout
46
        android:id="@+id/navBar"
47
        android:layout_width="match_parent"
48
        android:layout_height="44dp"
49
        android:layout_marginTop="20dp"
50
        app:layout_constraintLeft_toLeftOf="parent"
51
        app:layout_constraintRight_toRightOf="parent"
52
        app:layout_constraintTop_toTopOf="parent"
53
        tools:background="#DC7633">
54
55
        <ImageView
56
            android:id="@+id/backIcon"
57
            android:layout_width="wrap_content"
58
            android:layout_height="match_parent"
59
            android:paddingLeft="20dp"
60
            android:paddingRight="20dp"
61
            android:src="@drawable/app_white_back_icon"
62
            app:layout_constraintLeft_toLeftOf="parent" />
63
64
        <ImageView
65
            android:id="@+id/moreIcon"
66
            android:layout_width="wrap_content"
67
            android:layout_height="match_parent"
68
            android:paddingLeft="20dp"
69
            android:paddingRight="20dp"
70
            android:src="@drawable/app_header_more_icon"
71
            app:layout_constraintRight_toRightOf="parent" />
43
        app:layout_constraintTop_toTopOf="parent">
72 44
73 45
    </android.support.constraint.ConstraintLayout>
74 46
75
    <!-- 底部视图 -->
76
    <android.support.constraint.ConstraintLayout
77
        android:id="@+id/bottomView"
78
        android:layout_width="match_parent"
79
        android:layout_height="wrap_content"
80
        android:layout_marginBottom="-40dp"
81
        app:layout_constraintBottom_toBottomOf="parent"
82
        tools:background="#f38654">
83
84
        <!-- 主题信息及关闭按钮 -->
85
        <android.support.constraint.ConstraintLayout
86
            android:layout_width="match_parent"
87
            android:layout_height="52dp"
88
            app:layout_constraintBottom_toTopOf="@+id/userInfo"
89
            tools:background="#39bd00">
90
91
            <android.support.constraint.ConstraintLayout
92
                android:id="@+id/topicInfo"
93
                android:layout_width="wrap_content"
94
                android:layout_height="30dp"
95
                android:layout_marginLeft="15dp"
96
                android:background="@drawable/topic_shape"
97
                android:paddingLeft="12dp"
98
                android:paddingRight="12dp"
99
                app:layout_constraintBottom_toBottomOf="parent"
100
                app:layout_constraintLeft_toLeftOf="parent"
101
                app:layout_constraintTop_toTopOf="parent"
102
                tools:background="#ff967d">
103
104
                <ImageView
105
                    android:id="@+id/topicIcon"
106
                    android:layout_width="wrap_content"
107
                    android:layout_height="wrap_content"
108
                    android:src="@drawable/topic_icon"
109
                    app:layout_constraintBottom_toBottomOf="parent"
110
                    app:layout_constraintLeft_toLeftOf="parent"
111
                    app:layout_constraintTop_toTopOf="parent" />
112
113
                <TextView
114
                    android:id="@+id/topicTitle"
115
                    android:layout_width="wrap_content"
116
                    android:layout_height="wrap_content"
117
                    android:paddingLeft="5dp"
118
                    android:textColor="#ffffff"
119
                    android:textSize="11sp"
120
                    app:layout_constraintBottom_toBottomOf="parent"
121
                    app:layout_constraintLeft_toRightOf="@+id/topicIcon"
122
                    app:layout_constraintTop_toTopOf="parent"
123
                    tools:text="#新能源#" />
124
            </android.support.constraint.ConstraintLayout>
125
126
127
            <ImageView
128
                android:id="@+id/closeUnfold"
129
                android:layout_width="22dp"
130
                android:layout_height="22dp"
131
                android:layout_margin="15dp"
132
                android:src="@drawable/icon_close"
133
                android:visibility="gone"
134
                app:layout_constraintBottom_toBottomOf="parent"
135
                app:layout_constraintRight_toRightOf="parent"
136
                app:layout_constraintTop_toTopOf="parent"
137
                tools:background="#013369"
138
                tools:visibility="visible" />
139
        </android.support.constraint.ConstraintLayout>
140
        <!-- 用户信息 -->
141
        <android.support.constraint.ConstraintLayout
142
            android:id="@+id/userInfo"
143
            android:layout_width="wrap_content"
144
            android:layout_height="wrap_content"
145
            android:layout_marginBottom="5dp"
146
            android:paddingLeft="15dp"
147
            app:layout_constraintBottom_toTopOf="@+id/msgContainer"
148
            app:layout_constraintLeft_toLeftOf="parent"
149
            tools:background="#33ccff">
150
151
            <ImageView
152
                android:id="@+id/headImage"
153
                android:layout_width="20dp"
154
                android:layout_height="20dp"
155
                app:layout_constraintBottom_toBottomOf="parent"
156
                app:layout_constraintLeft_toLeftOf="parent"
157
                app:layout_constraintTop_toTopOf="parent"
158
                tools:srcCompat="@tools:sample/avatars[1]" />
159
160
            <android.support.constraint.ConstraintLayout
161
                android:layout_width="wrap_content"
162
                android:layout_height="wrap_content"
163
                android:paddingLeft="5dp"
164
                app:layout_constraintBottom_toBottomOf="parent"
165
                app:layout_constraintLeft_toRightOf="@+id/headImage"
166
                app:layout_constraintTop_toTopOf="parent">
167
168
                <TextView
169
                    android:id="@+id/nickName"
170
                    android:layout_width="wrap_content"
171
                    android:layout_height="wrap_content"
172
                    android:textColor="#ffffff"
173
                    android:textSize="12sp"
174
                    app:layout_constraintLeft_toLeftOf="parent"
175
                    app:layout_constraintTop_toTopOf="parent"
176
                    tools:text="小电" />
177
178
                <TextView
179
                    android:id="@+id/addDate"
180
                    android:layout_width="wrap_content"
181
                    android:layout_height="wrap_content"
182
                    android:textColor="#888888"
183
                    android:textSize="12sp"
184
                    app:layout_constraintBottom_toBottomOf="parent"
185
                    app:layout_constraintLeft_toLeftOf="parent"
186
                    app:layout_constraintTop_toBottomOf="@+id/nickName"
187
                    tools:text="2019-05-29 16:28" />
188
            </android.support.constraint.ConstraintLayout>
189
        </android.support.constraint.ConstraintLayout>
190
191
        <!-- 信息 -->
192
        <android.support.constraint.ConstraintLayout
193
            android:id="@+id/msgContainer"
194
            android:layout_width="match_parent"
195
            android:layout_height="wrap_content"
196
            app:layout_constraintBottom_toTopOf="@+id/progressBar">
197
198
            <TextView
199
                android:id="@+id/msg"
200
                android:layout_width="0dp"
201
                android:layout_height="wrap_content"
202
                android:layout_marginRight="30dp"
203
                android:ellipsize="end"
204
                android:paddingLeft="40dp"
205
                android:paddingRight="10dp"
206
                android:paddingBottom="25dp"
207
                android:scrollbarStyle="outsideOverlay"
208
                android:scrollbars="vertical"
209
                android:textColor="#e2e2e2"
210
                android:textSize="14sp"
211
                app:layout_constraintBottom_toBottomOf="parent"
212
                app:layout_constraintLeft_toLeftOf="parent"
213
                app:layout_constraintRight_toRightOf="parent"
214
                app:layout_constraintTop_toTopOf="parent"
215
                tools:text="迪克啥看来当减肥考虑送到,迪克啥看来当减肥考虑送到迪克啥看来当减肥考虑送到" />
216
217
            <ImageView
218
                android:id="@+id/fold"
219
                android:layout_width="42dp"
220
                android:layout_height="62dp"
221
                android:paddingLeft="15dp"
222
                android:paddingTop="25dp"
223
                android:paddingRight="15dp"
224
                android:paddingBottom="25dp"
225
                android:src="@drawable/unfold_icon"
226
                app:layout_constraintBottom_toBottomOf="parent"
227
                app:layout_constraintRight_toRightOf="parent" />
228
        </android.support.constraint.ConstraintLayout>
229
        <!-- 自定义进度条 -->
230
        <ProgressBar
231
            android:id="@+id/progressBar"
232
            style="@android:style/Widget.ProgressBar.Horizontal"
233
            android:layout_width="match_parent"
234
            android:layout_height="1dp"
235
            android:max="100"
236
            android:progressDrawable="@drawable/video_player_progressbar"
237
            app:layout_constraintBottom_toTopOf="@+id/toolBar"
238
            tools:progress="50" />
239
        <!-- 底部工具栏 -->
240
        <android.support.constraint.ConstraintLayout
241
            android:id="@+id/toolBar"
242
            android:layout_width="match_parent"
243
            android:layout_height="50dp"
244
            app:layout_constraintBottom_toBottomOf="parent"
245
            tools:background="#00aee6">
246
247
            <!-- 写评论-->
248
            <android.support.constraint.ConstraintLayout
249
                android:id="@+id/writeComment"
250
                android:layout_width="wrap_content"
251
                android:layout_height="match_parent"
252
                android:paddingLeft="15dp"
253
                android:paddingRight="15dp"
254
                app:layout_constraintLeft_toLeftOf="parent">
255
256
                <ImageView
257
                    android:id="@+id/WriteCommentIcon"
258
                    android:layout_width="wrap_content"
259
                    android:layout_height="wrap_content"
260
                    app:layout_constraintBottom_toBottomOf="parent"
261
                    app:layout_constraintLeft_toLeftOf="parent"
262
                    app:layout_constraintTop_toTopOf="parent"
263
                    app:srcCompat="@drawable/write_comment_icon" />
264
265
                <TextView
266
                    android:layout_width="wrap_content"
267
                    android:layout_height="match_parent"
268
                    android:gravity="center"
269
                    android:paddingLeft="3dp"
270
                    android:text="写评论"
271
                    android:textColor="#c2c2c2"
272
                    android:textSize="12sp"
273
                    app:layout_constraintLeft_toRightOf="@+id/WriteCommentIcon" />
274
            </android.support.constraint.ConstraintLayout>
275
276
            <!-- 转发 -->
277
            <android.support.constraint.ConstraintLayout
278
                android:id="@+id/transmit"
279
                android:layout_width="wrap_content"
280
                android:layout_height="match_parent"
281
                android:paddingLeft="15dp"
282
                android:paddingRight="15dp"
283
                app:layout_constraintRight_toRightOf="parent">
284
285
                <ImageView
286
                    android:layout_width="wrap_content"
287
                    android:layout_height="wrap_content"
288
                    android:paddingRight="3dp"
289
                    app:layout_constraintBottom_toBottomOf="parent"
290
                    app:layout_constraintRight_toLeftOf="@+id/transmitLabel"
291
                    app:layout_constraintTop_toTopOf="parent"
292
                    app:srcCompat="@drawable/transmit_icon" />
293
294
                <TextView
295
                    android:id="@+id/transmitLabel"
296
                    android:layout_width="wrap_content"
297
                    android:layout_height="match_parent"
298
                    android:gravity="center"
299
                    android:paddingLeft="3dp"
300
                    android:text="转发"
301
                    android:textColor="#888888"
302
                    android:textSize="12sp"
303
                    app:layout_constraintRight_toRightOf="parent" />
304
            </android.support.constraint.ConstraintLayout>
305
306
            <!-- 评论列表 -->
307
            <android.support.constraint.ConstraintLayout
308
                android:id="@+id/comment"
309
                android:layout_width="wrap_content"
310
                android:layout_height="match_parent"
311
                android:paddingLeft="15dp"
312
                android:paddingRight="15dp"
313
                app:layout_constraintRight_toLeftOf="@+id/transmit">
314
315
                <ImageView
316
                    android:layout_width="wrap_content"
317
                    android:layout_height="wrap_content"
318
                    android:src="@drawable/comment_icon"
319
                    app:layout_constraintBottom_toBottomOf="parent"
320
                    app:layout_constraintRight_toLeftOf="@+id/commentLabel"
321
                    app:layout_constraintTop_toTopOf="parent" />
322
323
                <TextView
324
                    android:id="@+id/commentLabel"
325
                    android:layout_width="wrap_content"
326
                    android:layout_height="match_parent"
327
                    android:gravity="center"
328
                    android:paddingLeft="3dp"
329
                    android:textColor="#888888"
330
                    android:textSize="12sp"
331
                    app:layout_constraintRight_toRightOf="parent"
332
                    tools:text="123" />
333
334
            </android.support.constraint.ConstraintLayout>
335
            <!-- 点赞 -->
336
            <android.support.constraint.ConstraintLayout
337
                android:id="@+id/like"
338
                android:layout_width="wrap_content"
339
                android:layout_height="match_parent"
340
                app:layout_constraintRight_toLeftOf="@+id/comment">
341
342
                <ImageView
343
                    android:id="@+id/likeIcon"
344
                    android:layout_width="wrap_content"
345
                    android:layout_height="wrap_content"
346
                    android:src="@drawable/like_icon"
347
                    app:layout_constraintBottom_toBottomOf="parent"
348
                    app:layout_constraintRight_toLeftOf="@+id/likeLabel"
349
                    app:layout_constraintTop_toTopOf="parent" />
350
351
                <TextView
352
                    android:id="@+id/likeLabel"
353
                    android:layout_width="wrap_content"
354
                    android:layout_height="match_parent"
355
                    android:gravity="center"
356
                    android:paddingLeft="3dp"
357
                    android:textColor="#888888"
358
                    android:textSize="12sp"
359
                    app:layout_constraintRight_toRightOf="parent"
360
                    tools:text="999+" />
361
            </android.support.constraint.ConstraintLayout>
362
363
        </android.support.constraint.ConstraintLayout>
364
365
    </android.support.constraint.ConstraintLayout>
47
    <include layout="@layout/fragment_chat_content_common"/>
366 48
</android.support.constraint.ConstraintLayout>