Browse Source

详情开发

huyuguo 6 years ago
parent
commit
dd941c98a5

+ 34 - 0
app/src/main/java/com/electric/chargingpile/activity/ChatContentListActivity.java

12
import android.text.TextUtils;
12
import android.text.TextUtils;
13
import android.text.method.ScrollingMovementMethod;
13
import android.text.method.ScrollingMovementMethod;
14
import android.view.LayoutInflater;
14
import android.view.LayoutInflater;
15
import android.view.MotionEvent;
15
import android.view.View;
16
import android.view.View;
16
import android.view.ViewGroup;
17
import android.view.ViewGroup;
17
import android.widget.ImageView;
18
import android.widget.ImageView;
44
import com.zhy.http.okhttp.OkHttpUtils;
45
import com.zhy.http.okhttp.OkHttpUtils;
45
import com.zhy.http.okhttp.callback.StringCallback;
46
import com.zhy.http.okhttp.callback.StringCallback;
46
47
48
import org.w3c.dom.Text;
49
47
import java.util.HashMap;
50
import java.util.HashMap;
48
import java.util.Map;
51
import java.util.Map;
49
52
221
        private TextView topicTitle;
224
        private TextView topicTitle;
222
        private ConstraintLayout userInfo;
225
        private ConstraintLayout userInfo;
223
        private ConstraintLayout statusBar;
226
        private ConstraintLayout statusBar;
227
        private TextView commentNumber;
228
        private ConstraintLayout allComments;
229
        private ConstraintLayout allCommentsContainer;
224
230
225
        public static ChatContentFragment newInstance(int index, String from) {
231
        public static ChatContentFragment newInstance(int index, String from) {
226
            ChatContentFragment fragment = new ChatContentFragment();
232
            ChatContentFragment fragment = new ChatContentFragment();
329
            fold.setOnClickListener(this);
335
            fold.setOnClickListener(this);
330
            closeUnfold.setOnClickListener(this);
336
            closeUnfold.setOnClickListener(this);
331
            rootView.findViewById(R.id.bottomView).setOnClickListener(this);
337
            rootView.findViewById(R.id.bottomView).setOnClickListener(this);
338
            rootView.findViewById(R.id.writeComment).setOnClickListener(this);
339
            rootView.findViewById(R.id.comment).setOnClickListener(this);
340
            allCommentsContainer.setOnClickListener(this);
341
            allComments.setOnClickListener(this);
332
        }
342
        }
333
343
334
        @Override
344
        @Override
360
                    break;
370
                    break;
361
                case R.id.bottomView: // to do nothing
371
                case R.id.bottomView: // to do nothing
362
                    break;
372
                    break;
373
                case R.id.writeComment: // 评论列表
374
                case R.id.comment:
375
                    allCommentsContainer.setVisibility(View.VISIBLE);
376
                    break;
377
                case R.id.allCommentsContainer:
378
                    allCommentsContainer.setVisibility(View.GONE);
379
                    break;
363
            }
380
            }
364
381
365
        }
382
        }
378
            closeUnfold = rootView.findViewById(R.id.closeUnfold);
395
            closeUnfold = rootView.findViewById(R.id.closeUnfold);
379
            topicTitle = rootView.findViewById(R.id.topicTitle);
396
            topicTitle = rootView.findViewById(R.id.topicTitle);
380
            userInfo = rootView.findViewById(R.id.userInfo);
397
            userInfo = rootView.findViewById(R.id.userInfo);
398
            commentNumber = rootView.findViewById(R.id.commentNumber);
399
400
            allCommentsContainer = rootView.findViewById(R.id.allCommentsContainer);
401
            allComments = rootView.findViewById(R.id.allComments);
381
402
382
            ConstraintLayout.LayoutParams statusBarParams = (ConstraintLayout.LayoutParams) statusBar.getLayoutParams();
403
            ConstraintLayout.LayoutParams statusBarParams = (ConstraintLayout.LayoutParams) statusBar.getLayoutParams();
383
            statusBarParams.height = statusBarHeight;
404
            statusBarParams.height = statusBarHeight;
430
                topicTitle.setText(bean.topicName);
451
                topicTitle.setText(bean.topicName);
431
                topicInfo.setVisibility(View.VISIBLE);
452
                topicInfo.setVisibility(View.VISIBLE);
432
            }
453
            }
454
455
            if (bean.commentNums == 0) {
456
                commentNumber.setText("");
457
            } else {
458
                commentNumber.setText(bean.commentNums + "");
459
            }
460
461
            rootView.findViewById(R.id.allCommentsContainer).setOnTouchListener(new View.OnTouchListener() {
462
                @Override
463
                public boolean onTouch(View view, MotionEvent motionEvent) {
464
                    return false;
465
                }
466
            });
433
        }
467
        }
434
468
435
        /**
469
        /**

+ 1 - 2
app/src/main/java/com/electric/chargingpile/activity/PublishItemsActivity.java

49
    private ImageView publish_radio;
49
    private ImageView publish_radio;
50
    private boolean publishRadioSelected = false;
50
    private boolean publishRadioSelected = false;
51
    private PublishItemSerializable intentData;
51
    private PublishItemSerializable intentData;
52
    private int activity_publish_items;
53
52
54
    @Override
53
    @Override
55
    protected void onCreate(Bundle savedInstanceState) {
54
    protected void onCreate(Bundle savedInstanceState) {
56
        super.onCreate(savedInstanceState);
55
        super.onCreate(savedInstanceState);
57
        setContentView(activity_publish_items);
56
        setContentView(R.layout.activity_publish_items);
58
        BarColorUtil.initStatusBarColor(PublishItemsActivity.this);
57
        BarColorUtil.initStatusBarColor(PublishItemsActivity.this);
59
        initView();
58
        initView();
60
    }
59
    }

+ 9 - 0
app/src/main/res/drawable/bg_all_comment_shape.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:shape="rectangle">
4
5
    <corners
6
        android:topLeftRadius="6dp"
7
        android:topRightRadius="6dp" />
8
    <solid android:color="#606060" />
9
</shape>

+ 10 - 0
app/src/main/res/drawable/bg_comment_shape.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<shape xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:shape="rectangle">
4
5
    <corners android:radius="14.5dp" />
6
7
    <solid android:color="#606060" />
8
9
10
</shape>

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

14
        app:layout_constraintEnd_toEndOf="parent"
14
        app:layout_constraintEnd_toEndOf="parent"
15
        app:layout_constraintStart_toStartOf="parent"
15
        app:layout_constraintStart_toStartOf="parent"
16
        app:layout_constraintTop_toTopOf="parent"></fr.castorflex.android.verticalviewpager.VerticalViewPager>
16
        app:layout_constraintTop_toTopOf="parent"></fr.castorflex.android.verticalviewpager.VerticalViewPager>
17
17
</android.support.constraint.ConstraintLayout>
18
</android.support.constraint.ConstraintLayout>

+ 114 - 0
app/src/main/res/layout/fragment_chat_content_comment_list.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:id="@+id/allCommentsContainer"
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
    tools:background="#68b8be">
9
10
    <android.support.constraint.ConstraintLayout
11
        android:id="@+id/allComments"
12
        android:layout_width="match_parent"
13
        android:layout_height="480dp"
14
        android:background="@drawable/bg_all_comment_shape"
15
        app:layout_constraintBottom_toBottomOf="parent"
16
        app:layout_constraintLeft_toLeftOf="parent"
17
        app:layout_constraintRight_toRightOf="parent">
18
19
20
        <android.support.constraint.ConstraintLayout
21
            android:layout_width="match_parent"
22
            android:layout_height="40dp"
23
            app:layout_constraintTop_toTopOf="parent">
24
            <TextView
25
                android:id="@+id/allCommentTitle"
26
                tools:text="全部评论 12"
27
                app:layout_constraintTop_toTopOf="parent"
28
                app:layout_constraintBottom_toBottomOf="parent"
29
                android:gravity="center_horizontal"
30
                android:textSize="14sp"
31
                android:textColor="#c2c2c2"
32
                android:layout_width="match_parent"
33
                android:layout_height="wrap_content" />
34
            <ImageView
35
                android:id="@+id/allCommentsClose"
36
                android:src="@drawable/icon_close"
37
                android:scaleType="center"
38
                app:layout_constraintRight_toRightOf="parent"
39
                android:layout_width="45dp"
40
                android:layout_height="match_parent" />
41
42
            <View
43
                android:background="#505050"
44
                android:layout_width="match_parent"
45
                android:layout_height="1dp"
46
                app:layout_constraintBottom_toBottomOf="parent" />
47
        </android.support.constraint.ConstraintLayout>
48
49
        <!-- 底部评论输入及发布 -->
50
        <android.support.constraint.ConstraintLayout
51
            android:layout_width="match_parent"
52
            android:layout_height="54dp"
53
            android:background="#535353"
54
            app:layout_constraintBottom_toBottomOf="parent"
55
            app:layout_constraintEnd_toEndOf="parent"
56
            app:layout_constraintStart_toStartOf="parent">
57
58
            <android.support.constraint.ConstraintLayout
59
                android:layout_width="0dp"
60
                android:layout_height="30dp"
61
                android:layout_marginLeft="15dp"
62
                android:background="@drawable/bg_comment_shape"
63
                app:layout_constraintBottom_toBottomOf="parent"
64
                app:layout_constraintLeft_toLeftOf="parent"
65
                app:layout_constraintRight_toLeftOf="@+id/bPublish"
66
                app:layout_constraintTop_toTopOf="parent">
67
68
                <ImageView
69
                    android:id="@+id/bCommentIcon"
70
                    android:layout_width="wrap_content"
71
                    android:layout_height="wrap_content"
72
                    android:layout_marginStart="15dp"
73
                    android:paddingRight="5dp"
74
                    app:layout_constraintBottom_toBottomOf="parent"
75
                    app:layout_constraintStart_toStartOf="parent"
76
                    app:layout_constraintTop_toTopOf="parent"
77
                    app:srcCompat="@drawable/write_comment_icon" />
78
79
                <TextView
80
                    android:id="@+id/bCommentContent"
81
                    android:layout_width="0dp"
82
                    android:layout_height="wrap_content"
83
                    android:ellipsize="end"
84
                    android:gravity="center_vertical"
85
                    android:hint="写评论"
86
                    android:maxLines="1"
87
                    android:textColor="#ffffff"
88
                    android:textColorHint="#c2c2c2"
89
                    android:textSize="14sp"
90
                    app:layout_constraintBottom_toBottomOf="parent"
91
                    app:layout_constraintLeft_toRightOf="@+id/bCommentIcon"
92
                    app:layout_constraintRight_toRightOf="parent"
93
                    app:layout_constraintTop_toTopOf="parent" />
94
            </android.support.constraint.ConstraintLayout>
95
96
            <TextView
97
                android:id="@+id/bPublish"
98
                android:layout_width="wrap_content"
99
                android:layout_height="0dp"
100
                android:gravity="center_vertical"
101
                android:paddingLeft="13dp"
102
                android:paddingRight="15dp"
103
                android:text="发布"
104
                android:textColor="#7e7e7e"
105
                android:textSize="14sp"
106
                app:layout_constraintBottom_toBottomOf="parent"
107
                app:layout_constraintRight_toRightOf="parent"
108
                app:layout_constraintTop_toTopOf="parent"
109
                tools:layout_editor_absoluteX="348dp"
110
                tools:layout_editor_absoluteY="19dp" />
111
        </android.support.constraint.ConstraintLayout>
112
    </android.support.constraint.ConstraintLayout>
113
114
</android.support.constraint.ConstraintLayout>

+ 2 - 2
app/src/main/res/layout/fragment_chat_content_common.xml

289
                    android:layout_height="wrap_content"
289
                    android:layout_height="wrap_content"
290
                    android:src="@drawable/comment_icon"
290
                    android:src="@drawable/comment_icon"
291
                    app:layout_constraintBottom_toBottomOf="parent"
291
                    app:layout_constraintBottom_toBottomOf="parent"
292
                    app:layout_constraintRight_toLeftOf="@+id/commentLabel"
292
                    app:layout_constraintRight_toLeftOf="@+id/commentNumber"
293
                    app:layout_constraintTop_toTopOf="parent" />
293
                    app:layout_constraintTop_toTopOf="parent" />
294
294
295
                <TextView
295
                <TextView
296
                    android:id="@+id/commentLabel"
296
                    android:id="@+id/commentNumber"
297
                    android:layout_width="wrap_content"
297
                    android:layout_width="wrap_content"
298
                    android:layout_height="match_parent"
298
                    android:layout_height="match_parent"
299
                    android:gravity="center"
299
                    android:gravity="center"

+ 8 - 5
app/src/main/res/layout/fragment_chat_content_pictures.xml

1
<?xml version="1.0" encoding="utf-8"?>
1
<?xml version="1.0" encoding="utf-8"?>
2
<android.support.constraint.ConstraintLayout
3
    xmlns:android="http://schemas.android.com/apk/res/android"
2
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
4
    xmlns:app="http://schemas.android.com/apk/res-auto"
3
    xmlns:app="http://schemas.android.com/apk/res-auto"
5
    xmlns:tools="http://schemas.android.com/tools"
4
    xmlns:tools="http://schemas.android.com/tools"
6
    android:background="#990545"
7
    android:layout_width="match_parent"
5
    android:layout_width="match_parent"
8
    android:layout_height="match_parent">
6
    android:layout_height="match_parent"
7
    android:background="#990545">
9
8
10
    <include layout="@layout/fragment_chat_content_common"/>
9
    <include layout="@layout/fragment_chat_content_common" />
10
11
    <include
12
        layout="@layout/fragment_chat_content_comment_list"
13
        android:visibility="gone" />
11
</android.support.constraint.ConstraintLayout>
14
</android.support.constraint.ConstraintLayout>

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

44
44
45
    </android.support.constraint.ConstraintLayout>
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
    <include
50
        layout="@layout/fragment_chat_content_comment_list"
51
        android:visibility="gone" />
48
</android.support.constraint.ConstraintLayout>
52
</android.support.constraint.ConstraintLayout>