Przeglądaj źródła

照片列表开发

huyuguo 5 lat temu
rodzic
commit
7c5715eaf6

+ 1 - 0
app/build.gradle

@ -285,4 +285,5 @@ dependencies {
285 285
    compile 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
286 286
287 287
    compile 'com.shuyu:GSYVideoPlayer:5.0.2'
288
    compile 'com.github.chrisbanes:PhotoView:2.0.0'
288 289
}

+ 50 - 5
app/src/main/java/com/electric/chargingpile/activity/ChatContentListActivity.java

@ -14,10 +14,12 @@ import android.support.v7.app.AppCompatActivity;
14 14
import android.os.Bundle;
15 15
import android.text.TextUtils;
16 16
import android.text.method.ScrollingMovementMethod;
17
import android.util.Log;
17 18
import android.view.LayoutInflater;
18 19
import android.view.MotionEvent;
19 20
import android.view.View;
20 21
import android.view.ViewGroup;
22
import android.view.ViewTreeObserver;
21 23
import android.widget.ImageView;
22 24
import android.widget.ProgressBar;
23 25
import android.widget.TextView;
@ -25,9 +27,11 @@ import android.widget.Toast;
25 27
26 28
import com.blankj.utilcode.util.NetworkUtils;
27 29
import com.electric.chargingpile.R;
30
import com.electric.chargingpile.adapter.ChatPhotoFragmentPagerAdapter;
28 31
import com.electric.chargingpile.application.MainApplication;
29 32
import com.electric.chargingpile.data.ChatBeanLab;
30 33
import com.electric.chargingpile.data.ChatRecommendBean;
34
import com.electric.chargingpile.fragment.ChatPhotoFragment;
31 35
import com.electric.chargingpile.iview.ChatVerticalViewPager;
32 36
import com.electric.chargingpile.manager.ProfileManager;
33 37
import com.electric.chargingpile.util.CircleTransform;
@ -51,7 +55,9 @@ import com.zhy.http.okhttp.callback.StringCallback;
51 55
52 56
import org.w3c.dom.Text;
53 57
58
import java.util.ArrayList;
54 59
import java.util.HashMap;
60
import java.util.List;
55 61
import java.util.Map;
56 62
57 63
import okhttp3.Call;
@ -77,7 +83,7 @@ public class ChatContentListActivity extends AppCompatActivity {
77 83
        public void handleMessage(Message msg) {
78 84
            switch (msg.what) {
79 85
                case UPDATE_VERTICAL_VIEW_PAGER_SCROLL:
80
                    boolean isScroll = (boolean)msg.obj;
86
                    boolean isScroll = (boolean) msg.obj;
81 87
                    verticalViewPager.setScroll(isScroll);
82 88
                    break;
83 89
            }
@ -201,9 +207,11 @@ public class ChatContentListActivity extends AppCompatActivity {
201 207
202 208
        public Map<String, ChatContentFragment> map = new HashMap<>();
203 209
        private Handler handler;
210
        private FragmentManager fm;
204 211
205 212
        public ChatContentAdapter(FragmentManager fm, Handler handler) {
206 213
            super(fm);
214
            this.fm = fm;
207 215
            this.handler = handler;
208 216
        }
209 217
@ -211,6 +219,7 @@ public class ChatContentListActivity extends AppCompatActivity {
211 219
        public android.support.v4.app.Fragment getItem(int i) {
212 220
            ChatContentFragment fragment = ChatContentFragment.newInstance(i, from);
213 221
            fragment.handler = handler;
222
            fragment.fm = fm;
214 223
            map.put(i + "", fragment);
215 224
            return fragment;
216 225
        }
@ -223,6 +232,7 @@ public class ChatContentListActivity extends AppCompatActivity {
223 232
224 233
225 234
    public static class ChatContentFragment extends Fragment implements View.OnClickListener {
235
        private FragmentManager fm;
226 236
        private Handler handler;
227 237
        private static final String ARG_INDEX = "index";
228 238
        private static final String ARG_FROM = "from";
@ -248,6 +258,9 @@ public class ChatContentListActivity extends AppCompatActivity {
248 258
        private TextView commentNumber;
249 259
        private ConstraintLayout allComments;
250 260
        private ConstraintLayout allCommentsContainer;
261
        private ViewPager photoPager;
262
        private ConstraintLayout bottomView;
263
        private TextView navTitle;
251 264
252 265
        public static ChatContentFragment newInstance(int index, String from) {
253 266
            ChatContentFragment fragment = new ChatContentFragment();
@ -274,13 +287,13 @@ public class ChatContentListActivity extends AppCompatActivity {
274 287
            if (bean != null) {
275 288
                if (bean.targetType == ChatRecommendBean.TARGET_TYPE_VIDEO) {
276 289
                    rootView = inflater.inflate(R.layout.fragment_chat_content_video, container, false);
277
                    initVideoView(rootView, bean);
278 290
                    initCommonView(rootView, bean);
291
                    initVideoView(rootView, bean);
279 292
                    initListener(rootView, bean);
280 293
                } else if (bean.targetType == ChatRecommendBean.TARGET_TYPE_IMAGE_TEXT) {
281 294
                    rootView = inflater.inflate(R.layout.fragment_chat_content_pictures, container, false);
282
                    initPicturesView(rootView, bean);
283 295
                    initCommonView(rootView, bean);
296
                    initPicturesView(rootView, bean);
284 297
                    initListener(rootView, bean);
285 298
                }
286 299
            }
@ -404,7 +417,7 @@ public class ChatContentListActivity extends AppCompatActivity {
404 417
                    allCommentsContainer.setVisibility(View.GONE);
405 418
                    break;
406 419
                case R.id.bWriteComment: // 写评论
407
                    
420
408 421
                    break;
409 422
            }
410 423
        }
@ -422,6 +435,7 @@ public class ChatContentListActivity extends AppCompatActivity {
422 435
        }
423 436
424 437
        private void initCommonView(final View rootView, final ChatRecommendBean bean) {
438
            bottomView = rootView.findViewById(R.id.bottomView);
425 439
            statusBar = rootView.findViewById(R.id.statusBar);
426 440
            likeLabel = rootView.findViewById(R.id.likeLabel);
427 441
            likeIcon = rootView.findViewById(R.id.likeIcon);
@ -595,7 +609,38 @@ public class ChatContentListActivity extends AppCompatActivity {
595 609
            }
596 610
        }
597 611
598
        private void initPicturesView(View rootView, ChatRecommendBean bean) {
612
        private void initPicturesView(View rootView, final ChatRecommendBean bean) {
613
            photoPager = rootView.findViewById(R.id.photoPager);
614
            navTitle = rootView.findViewById(R.id.navTitle);
615
            if (bean.imgUrls != null && bean.imgUrls.size() > 0) {
616
                navTitle.setText("1/" + bean.imgUrls.size());
617
            } else {
618
                navTitle.setText("");
619
            }
620
621
            List<ChatPhotoFragment> chatPhotoFragments = new ArrayList<>();
622
            for (String url : bean.imgUrls) {
623
                ChatPhotoFragment fragment = ChatPhotoFragment.newInstance(url);
624
                chatPhotoFragments.add(fragment);
625
            }
626
627
            ChatPhotoFragmentPagerAdapter chatPhotoFragmentPagerAdapter = new ChatPhotoFragmentPagerAdapter(fm, chatPhotoFragments);
628
            photoPager.setAdapter(chatPhotoFragmentPagerAdapter);
629
            photoPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
630
                @Override
631
                public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
632
                    navTitle.setText(position + 1 + "/" + bean.imgUrls.size());
633
                }
634
635
                @Override
636
                public void onPageSelected(int position) {
637
                }
638
639
                @Override
640
                public void onPageScrollStateChanged(int state) {
641
                }
642
            });
643
599 644
        }
600 645
601 646
        private void setVideoAllCallBack() {

+ 29 - 0
app/src/main/java/com/electric/chargingpile/adapter/ChatPhotoFragmentPagerAdapter.java

@ -0,0 +1,29 @@
1
package com.electric.chargingpile.adapter;
2
3
import android.support.v4.app.Fragment;
4
import android.support.v4.app.FragmentManager;
5
import android.support.v4.app.FragmentPagerAdapter;
6
7
import com.electric.chargingpile.fragment.ChatPhotoFragment;
8
9
import java.util.ArrayList;
10
import java.util.List;
11
12
public class ChatPhotoFragmentPagerAdapter extends FragmentPagerAdapter {
13
    private List<ChatPhotoFragment> fragments = new ArrayList<>();
14
15
    public ChatPhotoFragmentPagerAdapter(FragmentManager fm, List<ChatPhotoFragment> fragments) {
16
        super(fm);
17
        this.fragments = fragments;
18
    }
19
20
    @Override
21
    public Fragment getItem(int i) {
22
        return fragments.get(i);
23
    }
24
25
    @Override
26
    public int getCount() {
27
        return fragments.size();
28
    }
29
}

+ 67 - 0
app/src/main/java/com/electric/chargingpile/fragment/ChatPhotoFragment.java

@ -0,0 +1,67 @@
1
package com.electric.chargingpile.fragment;
2
3
import android.os.Bundle;
4
import android.support.annotation.Nullable;
5
import android.support.v4.app.Fragment;
6
import android.util.Log;
7
import android.view.GestureDetector;
8
import android.view.LayoutInflater;
9
import android.view.MotionEvent;
10
import android.view.View;
11
import android.view.ViewGroup;
12
import android.widget.ImageView;
13
14
import com.electric.chargingpile.R;
15
import com.github.chrisbanes.photoview.PhotoView;
16
17
public class ChatPhotoFragment extends Fragment {
18
    private static final String TAG = "ChatPhotoFragment";
19
    private static final String ARG_URL = "url";
20
21
    public static ChatPhotoFragment newInstance(String url) {
22
        ChatPhotoFragment fragment = new ChatPhotoFragment();
23
        Bundle args = new Bundle();
24
        args.putString(ARG_URL, url);
25
        fragment.setArguments(args);
26
        return fragment;
27
    }
28
29
    public ChatPhotoFragment() {
30
    }
31
32
    @Nullable
33
    @Override
34
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
35
        String url = getArguments().getString(ARG_URL);
36
        View rootView = inflater.inflate(R.layout.fragment_chat_photo, container, false);
37
        initView(rootView, url);
38
        return rootView;
39
    }
40
41
    private void initView(View rootView,String url) {
42
        final PhotoView photoView = rootView.findViewById(R.id.photoView);
43
        photoView.setImageResource(R.drawable.bg_guide_one);
44
//        photoView.setScaleType(ImageView.ScaleType.FIT_XY);
45
        photoView.setOnDoubleTapListener(new GestureDetector.OnDoubleTapListener() {
46
            @Override
47
            public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
48
                return false;
49
            }
50
51
            @Override
52
            public boolean onDoubleTap(MotionEvent motionEvent) {
53
                if (photoView.getScaleType() == ImageView.ScaleType.FIT_CENTER) {
54
                    photoView.setScaleType(ImageView.ScaleType.FIT_START);
55
                }
56
                Log.d(TAG, "onDoubleTap: " + photoView.getScaleType());
57
                return false;
58
            }
59
60
            @Override
61
            public boolean onDoubleTapEvent(MotionEvent motionEvent) {
62
63
                return false;
64
            }
65
        });
66
    }
67
}

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

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

+ 332 - 1
app/src/main/res/layout/fragment_chat_content_video.xml

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

+ 13 - 0
app/src/main/res/layout/fragment_chat_photo.xml

@ -0,0 +1,13 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<android.support.constraint.ConstraintLayout
3
    xmlns:android="http://schemas.android.com/apk/res/android"
4
    xmlns:app="http://schemas.android.com/apk/res-auto"
5
    xmlns:tools="http://schemas.android.com/tools"
6
    android:layout_width="match_parent"
7
    android:layout_height="match_parent">
8
9
    <com.github.chrisbanes.photoview.PhotoView
10
        android:id="@+id/photoView"
11
        android:layout_width="match_parent"
12
        android:layout_height="match_parent" />
13
</android.support.constraint.ConstraintLayout>