Browse Source

代码提交

huyuguo 5 years ago
parent
commit
a0b6f49851

+ 4 - 4
app/src/main/java/com/electric/chargingpile/application/MainApplication.java

@ -73,10 +73,10 @@ public class MainApplication extends MultiDexApplication {
73 73
    public static String firstPoint = "";
74 74
    public static Boolean firstSsyd;
75 75
    public static String password = "";
76
    public static String url = "http://59.110.68.162";// 充电桩测试环境
77
//    public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
78
    public static String urlNew = "http://123.56.67.7:83/api/0200";// 一电测试环境
79
//    public static String urlNew = "https://api.touchev.com:83/api/0200";// 一电正式环境
76
//    public static String url = "http://59.110.68.162";// 充电桩测试环境
77
    public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
78
//    public static String urlNew = "http://123.56.67.7:83/api/0200";// 一电测试环境
79
    public static String urlNew = "https://api.touchev.com:83/api/0200";// 一电正式环境
80 80
    public static String pic_url = "http:/s/cdz.evcharge.cc/zhannew/uploadfile/";
81 81
    //	public static String url = "https://cdz.d1ev.com";
82 82
    public static String build_flag = "0";

+ 28 - 0
app/src/main/java/com/electric/chargingpile/data/CommentBean.java

@ -0,0 +1,28 @@
1
package com.electric.chargingpile.data;
2
3
import java.io.Serializable;
4
5
public class CommentBean implements Serializable {
6
    public long id;
7
    public long targetId;
8
    public int targetType;
9
    public long userId;
10
    public long toUserId;
11
    public String content;
12
    public long addTime;
13
    public long parentId;
14
    public int status;
15
    public long toCommentsId;
16
    public long commentsId;
17
    public String nickNameFromUser;
18
    public String headImgFromUser;
19
    public String nickNameToUser;
20
    public String headImgToUser;
21
    public long likeNums;
22
    public int likeFlg;
23
    public int isDel;
24
    public String addDate;
25
    public long replyNums;
26
27
28
}

+ 44 - 7
app/src/main/java/com/electric/chargingpile/fragment/ChatContentCommentListDialogFragment.java

@ -25,16 +25,19 @@ import com.electric.chargingpile.R;
25 25
import com.electric.chargingpile.activity.UserPageActivity;
26 26
import com.electric.chargingpile.application.MainApplication;
27 27
import com.electric.chargingpile.data.ChatRecommendBean;
28
import com.electric.chargingpile.data.CommentBean;
28 29
import com.electric.chargingpile.data.UserHomePageBean;
29 30
import com.electric.chargingpile.util.CommonParams;
30 31
import com.electric.chargingpile.util.JsonUtils;
31 32
import com.electric.chargingpile.util.ToastUtil;
33
import com.electric.chargingpile.util.Util;
32 34
import com.electric.chargingpile.view.CircleProgressBar;
33 35
import com.wang.avi.AVLoadingIndicatorView;
34 36
import com.zhy.http.okhttp.OkHttpUtils;
35 37
import com.zhy.http.okhttp.callback.StringCallback;
36 38
37 39
import java.util.HashMap;
40
import java.util.List;
38 41
import java.util.Map;
39 42
40 43
import okhttp3.Call;
@ -53,6 +56,7 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
53 56
    private AVLoadingIndicatorView loadingIndicator;
54 57
    private XRefreshView xRefreshView;
55 58
    private RecyclerView recyclerView;
59
    private ConstraintLayout loadingView;
56 60
57 61
    public static ChatContentCommentListDialogFragment newInstance(ChatRecommendBean bean) {
58 62
        Bundle args = new Bundle();
@ -67,6 +71,8 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
67 71
    public Dialog onCreateDialog(Bundle savedInstanceState) {
68 72
        dialog = new Dialog(getActivity(), R.style.CommentDialog);
69 73
        // 外部点击设置为可取消
74
75
70 76
        dialog.setCancelable(true);
71 77
        dialog.setCanceledOnTouchOutside(true);
72 78
@ -94,17 +100,28 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
94 100
        bCommentContent = dialog.findViewById(R.id.bCommentContent);
95 101
        bPublish = dialog.findViewById(R.id.bPublish);
96 102
        allCommentTitle = dialog.findViewById(R.id.allCommentTitle);
103
        loadingView = dialog.findViewById(R.id.loadingView);
97 104
        loadingIndicator = dialog.findViewById(R.id.loadingIndicator);
98
        loadingIndicator.show();
105
        showLoading();
99 106
        xRefreshView = dialog.findViewById(R.id.xRefreshView);
100 107
        recyclerView = dialog.findViewById(R.id.recyclerView);
101 108
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
102
        ((SimpleItemAnimator)recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
109
        ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
103 110
104
        allCommentTitle.setText("全部评论 " + bean.commentNums );
111
        allCommentTitle.setText("全部评论 " + bean.commentNums);
105 112
        requestData();
106 113
    }
107 114
115
    private void showLoading() {
116
        loadingIndicator.show();
117
        loadingView.setVisibility(View.VISIBLE);
118
    }
119
120
    private void hideLoading() {
121
        loadingIndicator.hide();
122
        loadingView.setVisibility(View.GONE);
123
    }
124
108 125
    private void initListener() {
109 126
        allComments.setOnClickListener(this);
110 127
        dialog.findViewById(R.id.allCommentsClose).setOnClickListener(this);
@ -147,7 +164,7 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
147 164
        map.put("limit", "20");
148 165
        map.put("targetId", bean.targetId + "");
149 166
        map.put("targetType", bean.targetType + "");
150
        if (page== 1) {
167
        if (page == 1) {
151 168
            map.put("commentsId", "0");
152 169
        } else {
153 170
            // TODO
@ -155,11 +172,10 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
155 172
156 173
        CommonParams.addCommonParams(map);
157 174
158
        Log.d(TAG, "requestData: " + url);
159
        Log.d(TAG, "requestData: " + map);
160 175
        OkHttpUtils.get().url(url).params(map).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
161 176
            @Override
162 177
            public void onError(Call call, Exception e) {
178
                hideLoading();
163 179
                if (page == 1) {
164 180
                    xRefreshView.stopRefresh();
165 181
                } else {
@ -171,11 +187,12 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
171 187
172 188
            @Override
173 189
            public void onResponse(String s) {
190
                hideLoading();
174 191
                String code = JsonUtils.getKeyResult(s, "code");
175 192
                Log.d(TAG, "onResponse: " + s);
176 193
                if ("1000".equals(code)) {
177 194
                    String data = JsonUtils.getKeyResult(s, "data");
178
//                    UserHomePageBean userHomePageBean = (UserHomePageBean) JsonUtils.parseToObjectBean(data, UserHomePageBean.class);
195
                    List<CommentBean> beans = (List<CommentBean>) JsonUtils.parseToObjectList(data, CommentBean.class);
179 196
                    if (page == 1) {
180 197
                        xRefreshView.setLoadComplete(false);
181 198
//                        userVo = userHomePageBean.userVo;
@ -214,5 +231,25 @@ public class ChatContentCommentListDialogFragment extends DialogFragment impleme
214 231
        });
215 232
    }
216 233
234
    private class CommentHolder extends RecyclerView.ViewHolder {
235
        private CommentBean bean;
236
        private TextView content;
237
238
        public CommentHolder(LayoutInflater layoutInflater, ViewGroup parent) {
239
            super(layoutInflater.inflate(R.layout.list_item_comment, parent, false));
240
241
            initView();
242
        }
243
244
        private void initView() {
245
            content = itemView.findViewById(R.id.content);
246
        }
247
248
        private void bind(CommentBean bean) {
249
            this.bean = bean;
250
            content.setText(bean.content);
251
        }
252
    }
253
217 254
//    private class CommentAdapter extends RecyclerView.Adapter
218 255
}

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

@ -0,0 +1,9 @@
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="100dp" /> <!-- 圆角大小 -->
6
    <solid android:color="#424242" /> <!-- 填充颜色 -->
7
    <stroke android:width="1dp" android:color="#979797"/> <!-- 边框颜色 -->
8
9
</shape>

+ 84 - 39
app/src/main/res/layout/fragment_chat_content_comment_list.xml

@ -10,7 +10,7 @@
10 10
        android:id="@+id/allComments"
11 11
        android:layout_width="match_parent"
12 12
        android:layout_height="480dp"
13
        android:background="@drawable/bg_all_comment_shape"
13
        android:background="#424242"
14 14
        app:layout_constraintBottom_toBottomOf="parent"
15 15
        app:layout_constraintLeft_toLeftOf="parent"
16 16
        app:layout_constraintRight_toRightOf="parent">
@ -48,54 +48,99 @@
48 48
                app:layout_constraintBottom_toBottomOf="parent" />
49 49
        </android.support.constraint.ConstraintLayout>
50 50
51
        <!-- 内容部分 -->
52
        <android.support.constraint.ConstraintLayout
53
            android:layout_width="match_parent"
54
            android:layout_height="wrap_content"
55
            android:minHeight="386dp"
51
        <com.andview.refreshview.XRefreshView
52
            android:id="@+id/xRefreshView"
53
            android:layout_width="0dp"
54
            android:layout_height="0dp"
56 55
            app:layout_constraintBottom_toTopOf="@+id/bottomView"
56
            app:layout_constraintLeft_toLeftOf="parent"
57
            app:layout_constraintRight_toRightOf="parent"
57 58
            app:layout_constraintTop_toBottomOf="@+id/titleView">
58 59
59
            <com.andview.refreshview.XRefreshView
60
                android:id="@+id/xRefreshView"
60
            <android.support.v7.widget.RecyclerView
61
                android:id="@+id/recyclerView"
61 62
                android:layout_width="match_parent"
62 63
                android:layout_height="match_parent">
63 64
64
                <android.support.v7.widget.RecyclerView
65
                    android:id="@+id/recyclerView"
66
                    android:layout_width="match_parent"
67
                    android:layout_height="match_parent">
65
            </android.support.v7.widget.RecyclerView>
66
        </com.andview.refreshview.XRefreshView>
68 67
69
                </android.support.v7.widget.RecyclerView>
70
            </com.andview.refreshview.XRefreshView>
71 68
72
            <android.support.constraint.ConstraintLayout
73
                android:id="@+id/loadingView"
74
                android:layout_width="match_parent"
75
                android:layout_height="match_parent">
69
        <!-- 加载部分部分 -->
70
        <android.support.constraint.ConstraintLayout
71
            android:id="@+id/loadingView"
72
            android:layout_width="0dp"
73
            android:layout_height="0dp"
74
            android:visibility="gone"
75
            app:layout_constraintBottom_toTopOf="@+id/bottomView"
76
            app:layout_constraintEnd_toEndOf="parent"
77
            app:layout_constraintStart_toStartOf="parent"
78
            app:layout_constraintTop_toBottomOf="@+id/titleView">
76 79
77
                <com.wang.avi.AVLoadingIndicatorView
78
                    android:id="@+id/loadingIndicator"
79
                    android:layout_width="wrap_content"
80
                    android:layout_height="wrap_content"
81
                    android:layout_marginTop="80dp"
82
                    app:indicatorName="BallClipRotatePulseIndicator"
83
                    app:layout_constraintLeft_toLeftOf="parent"
84
                    app:layout_constraintRight_toRightOf="parent"
85
                    app:layout_constraintTop_toTopOf="parent" />
80
            <com.wang.avi.AVLoadingIndicatorView
81
                android:id="@+id/loadingIndicator"
82
                android:layout_width="wrap_content"
83
                android:layout_height="wrap_content"
84
                android:layout_marginTop="80dp"
85
                app:indicatorName="BallClipRotatePulseIndicator"
86
                app:layout_constraintLeft_toLeftOf="parent"
87
                app:layout_constraintRight_toRightOf="parent"
88
                app:layout_constraintTop_toTopOf="parent" />
89
90
            <TextView
91
                android:id="@+id/textView37"
92
                android:layout_width="wrap_content"
93
                android:layout_height="wrap_content"
94
                android:layout_marginTop="20dp"
95
                android:text="小主正在为您努力加载,请耐心等待~"
96
                android:textColor="#ffffff"
97
                android:textSize="14sp"
98
                app:layout_constraintEnd_toEndOf="parent"
99
                app:layout_constraintStart_toStartOf="parent"
100
                app:layout_constraintTop_toBottomOf="@+id/loadingIndicator" />
101
        </android.support.constraint.ConstraintLayout>
102
103
        <!-- 检查网络 -->
104
105
        <android.support.constraint.ConstraintLayout
106
            android:visibility="gone"
107
            android:id="@+id/noNetView"
108
            android:layout_width="0dp"
109
            android:layout_height="wrap_content"
110
            app:layout_constraintBottom_toTopOf="@+id/bottomView"
111
            app:layout_constraintEnd_toEndOf="parent"
112
            app:layout_constraintStart_toStartOf="parent"
113
            app:layout_constraintTop_toBottomOf="@+id/titleView">
114
115
            <TextView
116
                android:id="@+id/noNetTitle"
117
                android:layout_width="wrap_content"
118
                android:layout_height="wrap_content"
119
                android:layout_marginTop="20dp"
120
                android:text="网络跑调啦,请检查网络~"
121
                android:textColor="#ffffff"
122
                android:textSize="14sp"
123
                app:layout_constraintEnd_toEndOf="parent"
124
                app:layout_constraintStart_toStartOf="parent"
125
                app:layout_constraintTop_toTopOf="parent" />
126
127
            <TextView
128
                android:id="@+id/noNetTry"
129
                android:layout_width="wrap_content"
130
                android:layout_height="wrap_content"
131
                android:layout_marginTop="20dp"
132
                android:width="123dp"
133
                android:height="40dp"
134
                android:background="@drawable/btn_comment_shape"
135
                android:gravity="center"
136
                android:text="点击重试"
137
                android:textColor="#ffffff"
138
                android:textSize="14sp"
139
                app:layout_constraintBottom_toBottomOf="parent"
140
                app:layout_constraintEnd_toEndOf="parent"
141
                app:layout_constraintStart_toStartOf="parent"
142
                app:layout_constraintTop_toBottomOf="@+id/noNetTitle" />
86 143
87
                <TextView
88
                    android:id="@+id/textView37"
89
                    android:layout_width="wrap_content"
90
                    android:layout_height="wrap_content"
91
                    android:layout_marginTop="20dp"
92
                    android:text="小主正在为您努力加载,请耐心等待~"
93
                    android:textColor="#ffffff"
94
                    android:textSize="14sp"
95
                    app:layout_constraintEnd_toEndOf="parent"
96
                    app:layout_constraintStart_toStartOf="parent"
97
                    app:layout_constraintTop_toBottomOf="@+id/loadingIndicator" />
98
            </android.support.constraint.ConstraintLayout>
99 144
        </android.support.constraint.ConstraintLayout>
100 145
101 146
        <!-- 底部评论输入及发布 -->

+ 163 - 0
app/src/main/res/layout/list_item_comment.xml

@ -0,0 +1,163 @@
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="wrap_content"
7
    tools:background="#424242">
8
9
    <!-- 用户信息及点赞 -->
10
    <android.support.constraint.ConstraintLayout
11
        android:id="@+id/topView"
12
        android:layout_width="match_parent"
13
        android:layout_height="64dp"
14
        android:paddingTop="10dp"
15
        app:layout_constraintTop_toTopOf="parent">
16
17
        <ImageView
18
            android:id="@+id/headImage"
19
            android:layout_width="20dp"
20
            android:layout_height="20dp"
21
            android:layout_marginLeft="15dp"
22
            app:layout_constraintBottom_toBottomOf="parent"
23
            app:layout_constraintLeft_toLeftOf="parent"
24
            app:layout_constraintTop_toTopOf="parent"
25
            tools:srcCompat="@tools:sample/avatars[8]" />
26
27
        <TextView
28
            android:id="@+id/nickName"
29
            android:layout_width="wrap_content"
30
            android:layout_height="wrap_content"
31
            android:layout_marginLeft="5dp"
32
            android:paddingTop="10dp"
33
            android:textColor="#ffffff"
34
            android:textSize="12sp"
35
            app:layout_constraintLeft_toRightOf="@+id/headImage"
36
            app:layout_constraintTop_toTopOf="parent"
37
            tools:text="小电" />
38
39
        <TextView
40
            android:id="@+id/addDate"
41
            android:layout_width="wrap_content"
42
            android:layout_height="wrap_content"
43
            android:layout_marginLeft="5dp"
44
            android:layout_marginBottom="10dp"
45
            android:textColor="#888888"
46
            android:textSize="12sp"
47
            app:layout_constraintBottom_toBottomOf="parent"
48
            app:layout_constraintLeft_toRightOf="@+id/headImage"
49
            tools:text="刚刚" />
50
51
        <android.support.constraint.ConstraintLayout
52
            android:id="@+id/likeView"
53
            android:layout_width="wrap_content"
54
            android:layout_height="match_parent"
55
            android:paddingLeft="17dp"
56
            android:paddingRight="17dp"
57
            app:layout_constraintRight_toRightOf="parent"
58
            tools:background="#ff0000">
59
60
            <ImageView
61
                android:id="@+id/likeIcon"
62
                android:layout_width="18dp"
63
                android:layout_height="18dp"
64
                android:src="@drawable/like_small_icon"
65
                app:layout_constraintBottom_toBottomOf="parent"
66
                app:layout_constraintLeft_toLeftOf="parent"
67
                app:layout_constraintTop_toTopOf="parent" />
68
69
            <TextView
70
                android:id="@+id/likeLabel"
71
                android:layout_width="wrap_content"
72
                android:layout_height="wrap_content"
73
                android:paddingLeft="4dp"
74
                android:textColor="#888888"
75
                android:textSize="12sp"
76
                app:layout_constraintBottom_toBottomOf="parent"
77
                app:layout_constraintLeft_toRightOf="@+id/likeIcon"
78
                app:layout_constraintRight_toRightOf="parent"
79
                app:layout_constraintTop_toTopOf="parent"
80
                tools:text="123" />
81
82
        </android.support.constraint.ConstraintLayout>
83
    </android.support.constraint.ConstraintLayout>
84
85
    <TextView
86
        android:id="@+id/content"
87
        android:layout_width="match_parent"
88
        android:layout_height="wrap_content"
89
        android:layout_marginLeft="39dp"
90
        android:layout_marginRight="37dp"
91
        android:textColor="#ffffff"
92
        android:textSize="14sp"
93
        app:layout_constraintTop_toBottomOf="@+id/topView"
94
        tools:text="充电桩挺多的,但是油车也多,充电的车也多。园区进门就收费,还好去了两次都充上了。"></TextView>
95
96
    <android.support.constraint.ConstraintLayout
97
        android:id="@+id/replyView"
98
        android:layout_width="match_parent"
99
        android:layout_height="42dp"
100
        android:paddingLeft="29dp"
101
        app:layout_constraintBottom_toBottomOf="parent"
102
        app:layout_constraintTop_toBottomOf="@+id/content"
103
        tools:background="#06648f">
104
105
        <android.support.constraint.ConstraintLayout
106
            android:id="@+id/replayInfo"
107
            android:layout_width="wrap_content"
108
            android:layout_height="match_parent"
109
            android:layout_marginLeft="10dp"
110
            android:layout_marginTop="10dp"
111
            android:layout_marginBottom="10dp"
112
            android:background="@drawable/bg_comment_shape"
113
            android:paddingLeft="9dp"
114
            android:paddingRight="9dp"
115
            app:layout_constraintLeft_toLeftOf="parent">
116
117
            <ImageView
118
                android:id="@+id/commentIcon"
119
                android:layout_width="16dp"
120
                android:layout_height="16dp"
121
                android:src="@drawable/comment_small_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/replyLabel"
128
                android:layout_width="wrap_content"
129
                android:layout_height="wrap_content"
130
                android:layout_marginLeft="5dp"
131
                android:textColor="#c2c2c2"
132
                android:textSize="12sp"
133
                app:layout_constraintBottom_toBottomOf="parent"
134
                app:layout_constraintLeft_toRightOf="@+id/commentIcon"
135
                app:layout_constraintRight_toRightOf="parent"
136
                app:layout_constraintTop_toTopOf="parent"
137
                tools:text="32回复" />
138
        </android.support.constraint.ConstraintLayout>
139
140
        <TextView
141
            android:layout_width="wrap_content"
142
            android:layout_height="42dp"
143
            android:gravity="center"
144
            android:paddingLeft="10dp"
145
            android:paddingRight="10dp"
146
            android:text="删除"
147
            android:textColor="#c2c2c2"
148
            android:textSize="12sp"
149
            app:layout_constraintBottom_toBottomOf="parent"
150
            app:layout_constraintLeft_toRightOf="@+id/replayInfo"
151
            app:layout_constraintTop_toTopOf="parent"
152
            tools:background="#790f59" />
153
    </android.support.constraint.ConstraintLayout>
154
155
    <View
156
        android:layout_width="match_parent"
157
        android:layout_height="1dp"
158
        android:layout_marginLeft="16dp"
159
        android:layout_marginTop="10dp"
160
        android:background="#505050"
161
        app:layout_constraintBottom_toBottomOf="parent"
162
        app:layout_constraintTop_toBottomOf="@+id/replyView" />
163
</android.support.constraint.ConstraintLayout>

+ 0 - 1
app/src/main/res/values/styles.xml

@ -17,7 +17,6 @@
17 17
        <item name="android:layout_width">match_parent</item>
18 18
        <item name="android:layout_height">wrap_content</item>
19 19
        <item name="android:windowIsFloating">true</item>
20
        <item name="android:windowSoftInputMode">stateAlwaysHidden</item><!--显示软件盘-->
21 20
    </style>
22 21

23 22
    <style name="actionBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">