android:textSize="12sp"
76
                    tools:text="电费:0.5906元/度 服务费:0.5906元/度" />
77
            </LinearLayout>
70 78
        </LinearLayout>
71
    </LinearLayout>
79
80
        <ImageView
81
            android:id="@+id/now_icon"
82
            android:layout_width="wrap_content"
83
            android:layout_height="wrap_content"
84
            android:src="@drawable/now_icon"
85
            android:visibility="gone"
86
            app:layout_constraintRight_toRightOf="parent"
87
            app:layout_constraintTop_toTopOf="parent"
88
            tools:visibility="visible" />
89
    </androidx.constraintlayout.widget.ConstraintLayout>
72 90
73 91
    <View
74 92
        android:layout_width="match_parent"

代码保存 · 148e65f9d2 - Gogs: Go Git Service
huyuguo 7 年 前
コミット
148e65f9d2

+ 1 - 0
app/build.gradle

@ -286,4 +286,5 @@ dependencies {
286 286
287 287
    compile 'com.shuyu:GSYVideoPlayer:5.0.2'
288 288
    compile 'com.github.chrisbanes:PhotoView:2.0.0'
289
    compile 'com.wang.avi:library:2.1.3'
289 290
}

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

@ -135,17 +135,6 @@ public class ChatContentListActivity extends AppCompatActivity {
135 135
        GSYVideoManager.releaseAllVideos();
136 136
    }
137 137
138
    @Override
139
    public void onBackPressed() {
140
        final ChatContentFragment chatContentFragment = (ChatContentFragment) chatContentAdapter.map.get(chatContentPosition + "");
141
        if (chatContentFragment.allCommentsContainer.getVisibility() == View.GONE) {
142
            finish();
143
        } else {
144
            chatContentFragment.allCommentsContainer.setVisibility(View.GONE);
145
        }
146
147
    }
148
149 138
    private void initView() {
150 139
        isFirstPlay = true;
151 140
        screenWidth = ScreenUtils.getScreenWidth(ChatContentListActivity.this);
@ -287,15 +276,11 @@ public class ChatContentListActivity extends AppCompatActivity {
287 276
        private ConstraintLayout userInfo;
288 277
        private ConstraintLayout statusBar;
289 278
        private TextView commentNumber;
290
        private ConstraintLayout allComments;
291
        public ConstraintLayout allCommentsContainer;
292 279
        private ViewPager photoPager;
293 280
        private ConstraintLayout bottomView;
294 281
        private TextView navTitle;
295 282
        private List<ChatPhotoFragment> chatPhotoFragments;
296 283
        private ChatPhotoFragmentPagerAdapter chatPhotoFragmentPagerAdapter;
297
        private TextView bCommentContent;
298
        private TextView bPublish;
299 284
300 285
        public static ChatContentFragment newInstance(int index, String from) {
301 286
            ChatContentFragment fragment = new ChatContentFragment();
@ -410,10 +395,6 @@ public class ChatContentListActivity extends AppCompatActivity {
410 395
            rootView.findViewById(R.id.bottomView).setOnClickListener(this);
411 396
            rootView.findViewById(R.id.writeComment).setOnClickListener(this);
412 397
            rootView.findViewById(R.id.comment).setOnClickListener(this);
413
            allCommentsContainer.setOnClickListener(this);
414
            allComments.setOnClickListener(this);
415
            rootView.findViewById(R.id.allCommentsClose).setOnClickListener(this);
416
            rootView.findViewById(R.id.bWriteComment).setOnClickListener(this);
417 398
        }
418 399
419 400
        @Override
@ -461,30 +442,8 @@ public class ChatContentListActivity extends AppCompatActivity {
461 442
                    dialogFragment.show(getChildFragmentManager(), "评论列表");
462 443
                    break;
463 444
                case R.id.allCommentsClose: // 关闭评论
464
                case R.id.allCommentsContainer:
465
                    setViewPagerScroll(true);
466
                    allCommentsContainer.setVisibility(View.GONE);
467
                    break;
468
                case R.id.bWriteComment: // 写评论
469
                    CommonDialogFragment commonDialogFragment = CommonDialogFragment.newInstance(bCommentContent.getText().toString());
470
                    commonDialogFragment.show(getChildFragmentManager(), "CommonDialogFragment");
471
472
                    commonDialogFragment.setOnCommonDialogFragmentListener(new CommonDialogFragment.OnCommonDialogFragmentListener() {
473
                        @Override
474
                        public void updateComment(String comment) {
475
                            bCommentContent.setText(comment);
476
                            if (comment.length() > 0) {
477
                                bPublish.setTextColor(Color.parseColor("#00EDB2"));
478
                            } else {
479
                                bPublish.setTextColor(Color.parseColor("#7e7e7e"));
480
                            }
481
                        }
482
483
                        @Override
484
                        public void publish() {
485
                            Log.d(TAG, "publish: xxxxxxxxxxxxxx");
486
                        }
487
                    });
445
//                    setViewPagerScroll(true);
446
//                    allCommentsContainer.setVisibility(View.GONE);
488 447
                    break;
489 448
            }
490 449
        }
@ -518,10 +477,7 @@ public class ChatContentListActivity extends AppCompatActivity {
518 477
            userInfo = rootView.findViewById(R.id.userInfo);
519 478
            commentNumber = rootView.findViewById(R.id.commentNumber);
520 479
521
            allCommentsContainer = rootView.findViewById(R.id.allCommentsContainer);
522
            allComments = rootView.findViewById(R.id.allComments);
523
            bCommentContent = rootView.findViewById(R.id.bCommentContent);
524
            bPublish = rootView.findViewById(R.id.bPublish);
480
525 481
526 482
            ConstraintLayout.LayoutParams statusBarParams = (ConstraintLayout.LayoutParams) statusBar.getLayoutParams();
527 483
            statusBarParams.height = statusBarHeight;
@ -564,7 +520,7 @@ public class ChatContentListActivity extends AppCompatActivity {
564 520
                        .into(headImage);
565 521
            }
566 522
567
            nickName.setText(bean.nickName);
523
            nickName.setText(bean.nickName + " " + bean.carSeriesName);
568 524
            addDate.setText(bean.addDate);
569 525
570 526
@ -579,7 +535,7 @@ public class ChatContentListActivity extends AppCompatActivity {
579 535
            if (bean.commentNums == 0) {
580 536
                commentNumber.setText("");
581 537
            } else {
582
                commentNumber.setText(bean.commentNums + "");
538
                commentNumber.setText(bean.commentNums < 10000 ? bean.commentNums + "" : String.format("%.1fW",bean.commentNums/10000f));
583 539
            }
584 540
        }
585 541

+ 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";

+ 2 - 0
app/src/main/java/com/electric/chargingpile/data/ChatRecommendBean.java

@ -23,6 +23,7 @@ public class ChatRecommendBean implements Serializable {
23 23
    public List<String> imgUrls;
24 24
    public String headImgUrl;
25 25
    public String nickName;
26
    public String carSeriesName;
26 27
    public String topicName;
27 28
    public String content;
28 29
    public String shareUrl;
@ -52,6 +53,7 @@ public class ChatRecommendBean implements Serializable {
52 53
                ", imgUrls=" + imgUrls +
53 54
                ", headImgUrl='" + headImgUrl + '\'' +
54 55
                ", nickName='" + nickName + '\'' +
56
                ", carSeriesName='" + carSeriesName + '\'' +
55 57
                ", topicName='" + topicName + '\'' +
56 58
                ", content='" + content + '\'' +
57 59
                ", shareUrl='" + shareUrl + '\'' +

+ 165 - 4
app/src/main/java/com/electric/chargingpile/fragment/ChatContentCommentListDialogFragment.java

@ -1,23 +1,58 @@
1 1
package com.electric.chargingpile.fragment;
2 2
3 3
import android.app.Dialog;
4
import android.graphics.Color;
4 5
import android.os.Bundle;
5 6
import android.support.annotation.NonNull;
6 7
import android.support.annotation.Nullable;
8
import android.support.constraint.ConstraintLayout;
7 9
import android.support.v4.app.DialogFragment;
10
import android.support.v7.widget.LinearLayoutManager;
11
import android.support.v7.widget.RecyclerView;
12
import android.support.v7.widget.SimpleItemAnimator;
13
import android.util.Log;
8 14
import android.view.Gravity;
9 15
import android.view.LayoutInflater;
10 16
import android.view.View;
11 17
import android.view.ViewGroup;
12 18
import android.view.Window;
13 19
import android.view.WindowManager;
20
import android.widget.TextView;
21
import android.widget.Toast;
14 22
23
import com.andview.refreshview.XRefreshView;
15 24
import com.electric.chargingpile.R;
25
import com.electric.chargingpile.activity.UserPageActivity;
26
import com.electric.chargingpile.application.MainApplication;
16 27
import com.electric.chargingpile.data.ChatRecommendBean;
28
import com.electric.chargingpile.data.UserHomePageBean;
29
import com.electric.chargingpile.util.CommonParams;
30
import com.electric.chargingpile.util.JsonUtils;
31
import com.electric.chargingpile.util.ToastUtil;
32
import com.electric.chargingpile.view.CircleProgressBar;
33
import com.wang.avi.AVLoadingIndicatorView;
34
import com.zhy.http.okhttp.OkHttpUtils;
35
import com.zhy.http.okhttp.callback.StringCallback;
17 36
18
public class ChatContentCommentListDialogFragment extends DialogFragment {
37
import java.util.HashMap;
38
import java.util.Map;
39
40
import okhttp3.Call;
41
42
public class ChatContentCommentListDialogFragment extends DialogFragment implements View.OnClickListener {
43
    private static final String TAG = "ChatContentCommentListDialogFragment";
19 44
    private static final String ARG_BEAN = "bean";
20 45
    private ChatRecommendBean bean;
46
    private ConstraintLayout allComments;
47
    private TextView bCommentContent;
48
    private TextView bPublish;
49
    private Dialog dialog;
50
    private TextView allCommentTitle;
51
52
    private int page = 1;
53
    private AVLoadingIndicatorView loadingIndicator;
54
    private XRefreshView xRefreshView;
55
    private RecyclerView recyclerView;
21 56
22 57
    public static ChatContentCommentListDialogFragment newInstance(ChatRecommendBean bean) {
23 58
        Bundle args = new Bundle();
@ -30,7 +65,7 @@ public class ChatContentCommentListDialogFragment extends DialogFragment {
30 65
    @NonNull
31 66
    @Override
32 67
    public Dialog onCreateDialog(Bundle savedInstanceState) {
33
        Dialog dialog = new Dialog(getActivity(), R.style.CommentDialog);
68
        dialog = new Dialog(getActivity(), R.style.CommentDialog);
34 69
        // 外部点击设置为可取消
35 70
        dialog.setCancelable(true);
36 71
        dialog.setCanceledOnTouchOutside(true);
@ -46,12 +81,138 @@ public class ChatContentCommentListDialogFragment extends DialogFragment {
46 81
        layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
47 82
        window.setAttributes(layoutParams);
48 83
49
        initDialog(dialog);
84
        initDialog();
85
        initListener();
50 86
        return dialog;
51 87
    }
52 88
53 89
54
    private void initDialog(Dialog dialog) {
90
    private void initDialog() {
55 91
        bean = (ChatRecommendBean) getArguments().getSerializable(ARG_BEAN);
92
93
        allComments = dialog.findViewById(R.id.allComments);
94
        bCommentContent = dialog.findViewById(R.id.bCommentContent);
95
        bPublish = dialog.findViewById(R.id.bPublish);
96
        allCommentTitle = dialog.findViewById(R.id.allCommentTitle);
97
        loadingIndicator = dialog.findViewById(R.id.loadingIndicator);
98
        loadingIndicator.show();
99
        xRefreshView = dialog.findViewById(R.id.xRefreshView);
100
        recyclerView = dialog.findViewById(R.id.recyclerView);
101
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
102
        ((SimpleItemAnimator)recyclerView.getItemAnimator()).setSupportsChangeAnimations(false);
103
104
        allCommentTitle.setText("全部评论 " + bean.commentNums );
105
        requestData();
56 106
    }
107
108
    private void initListener() {
109
        allComments.setOnClickListener(this);
110
        dialog.findViewById(R.id.allCommentsClose).setOnClickListener(this);
111
        dialog.findViewById(R.id.bWriteComment).setOnClickListener(this);
112
    }
113
114
    @Override
115
    public void onClick(View view) {
116
        switch (view.getId()) {
117
            case R.id.bWriteComment: // 写评论
118
                CommonDialogFragment commonDialogFragment = CommonDialogFragment.newInstance(bCommentContent.getText().toString());
119
                commonDialogFragment.show(getChildFragmentManager(), "CommonDialogFragment");
120
121
                commonDialogFragment.setOnCommonDialogFragmentListener(new CommonDialogFragment.OnCommonDialogFragmentListener() {
122
                    @Override
123
                    public void updateComment(String comment) {
124
                        bCommentContent.setText(comment);
125
                        if (comment.length() > 0) {
126
                            bPublish.setTextColor(Color.parseColor("#00EDB2"));
127
                        } else {
128
                            bPublish.setTextColor(Color.parseColor("#7e7e7e"));
129
                        }
130
                    }
131
132
                    @Override
133
                    public void publish() {
134
                    }
135
                });
136
                break;
137
            case R.id.allCommentsClose:
138
                dialog.dismiss();
139
                break;
140
        }
141
    }
142
143
    private void requestData() {
144
        String url = MainApplication.urlNew + "/topic/comments/list.do";
145
        Map<String, String> map = new HashMap<>();
146
        map.put("page", page + "");
147
        map.put("limit", "20");
148
        map.put("targetId", bean.targetId + "");
149
        map.put("targetType", bean.targetType + "");
150
        if (page== 1) {
151
            map.put("commentsId", "0");
152
        } else {
153
            // TODO
154
        }
155
156
        CommonParams.addCommonParams(map);
157
158
        Log.d(TAG, "requestData: " + url);
159
        Log.d(TAG, "requestData: " + map);
160
        OkHttpUtils.get().url(url).params(map).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
161
            @Override
162
            public void onError(Call call, Exception e) {
163
                if (page == 1) {
164
                    xRefreshView.stopRefresh();
165
                } else {
166
                    page--;
167
                    xRefreshView.stopLoadMore();
168
                }
169
                ToastUtil.showToast(getContext(), "加载失败,请重试", Toast.LENGTH_SHORT);
170
            }
171
172
            @Override
173
            public void onResponse(String s) {
174
                String code = JsonUtils.getKeyResult(s, "code");
175
                Log.d(TAG, "onResponse: " + s);
176
                if ("1000".equals(code)) {
177
                    String data = JsonUtils.getKeyResult(s, "data");
178
//                    UserHomePageBean userHomePageBean = (UserHomePageBean) JsonUtils.parseToObjectBean(data, UserHomePageBean.class);
179
                    if (page == 1) {
180
                        xRefreshView.setLoadComplete(false);
181
//                        userVo = userHomePageBean.userVo;
182
//                        updateTopView();
183
//                        if (userHomePageBean.list.size() == 0) {
184
//                            zeroTopicNum.setVisibility(View.VISIBLE);
185
//                            xRefreshView.setLoadComplete(true);
186
//                        } else {
187
//                            zeroTopicNum.setVisibility(View.GONE);
188
//                            userPageAdapter.setContentData(userHomePageBean.list);
189
//                        }
190
//                        userPageAdapter.setFooterData(false);
191
                        xRefreshView.stopRefresh();
192
                    } else {
193
//                        if (userHomePageBean.list.size() == 0) {
194
//                            xRefreshView.setLoadComplete(true);
195
////                            userPageAdapter.setFooterData(true);
196
//                        } else {
197
//                            userPageAdapter.addContentData(userHomePageBean.list);
198
//                            userPageAdapter.setFooterData(false);
199
//                        }
200
                        xRefreshView.stopLoadMore();
201
                    }
202
                } else {
203
                    String desc = JsonUtils.getKeyResult(s, "desc");
204
                    ToastUtil.showToast(getContext(), desc, Toast.LENGTH_SHORT);
205
                    if (page == 1) {
206
                        xRefreshView.stopRefresh();
207
                    } else {
208
                        page--;
209
                        xRefreshView.stopLoadMore();
210
                    }
211
                }
212
213
            }
214
        });
215
    }
216
217
//    private class CommentAdapter extends RecyclerView.Adapter
57 218
}

+ 67 - 14
app/src/main/res/layout/fragment_chat_content_comment_list.xml

@ -1,6 +1,5 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:id="@+id/allCommentsContainer"
4 3
    xmlns:app="http://schemas.android.com/apk/res-auto"
5 4
    xmlns:tools="http://schemas.android.com/tools"
6 5
    android:layout_width="match_parent"
@ -16,38 +15,92 @@
16 15
        app:layout_constraintLeft_toLeftOf="parent"
17 16
        app:layout_constraintRight_toRightOf="parent">
18 17
19
18
        <!-- 标题栏-->
20 19
        <android.support.constraint.ConstraintLayout
20
            android:id="@+id/titleView"
21 21
            android:layout_width="match_parent"
22 22
            android:layout_height="40dp"
23 23
            app:layout_constraintTop_toTopOf="parent">
24
24 25
            <TextView
25 26
                android:id="@+id/allCommentTitle"
26
                tools:text="全部评论 12"
27
                app:layout_constraintTop_toTopOf="parent"
28
                app:layout_constraintBottom_toBottomOf="parent"
27
                android:layout_width="match_parent"
28
                android:layout_height="wrap_content"
29 29
                android:gravity="center_horizontal"
30
                android:textSize="14sp"
31 30
                android:textColor="#c2c2c2"
32
                android:layout_width="match_parent"
33
                android:layout_height="wrap_content" />
31
                android:textSize="14sp"
32
                app:layout_constraintBottom_toBottomOf="parent"
33
                app:layout_constraintTop_toTopOf="parent"
34
                tools:text="全部评论 12" />
35
34 36
            <ImageView
35 37
                android:id="@+id/allCommentsClose"
36
                android:src="@drawable/icon_close"
37
                android:scaleType="center"
38
                app:layout_constraintRight_toRightOf="parent"
39 38
                android:layout_width="45dp"
40
                android:layout_height="match_parent" />
39
                android:layout_height="match_parent"
40
                android:scaleType="center"
41
                android:src="@drawable/icon_close"
42
                app:layout_constraintRight_toRightOf="parent" />
41 43
42 44
            <View
43
                android:background="#505050"
44 45
                android:layout_width="match_parent"
45 46
                android:layout_height="1dp"
47
                android:background="#505050"
46 48
                app:layout_constraintBottom_toBottomOf="parent" />
47 49
        </android.support.constraint.ConstraintLayout>
48 50
51
        <!-- 内容部分 -->
52
        <android.support.constraint.ConstraintLayout
53
            android:layout_width="match_parent"
54
            android:layout_height="wrap_content"
55
            android:minHeight="386dp"
56
            app:layout_constraintBottom_toTopOf="@+id/bottomView"
57
            app:layout_constraintTop_toBottomOf="@+id/titleView">
58
59
            <com.andview.refreshview.XRefreshView
60
                android:id="@+id/xRefreshView"
61
                android:layout_width="match_parent"
62
                android:layout_height="match_parent">
63
64
                <android.support.v7.widget.RecyclerView
65
                    android:id="@+id/recyclerView"
66
                    android:layout_width="match_parent"
67
                    android:layout_height="match_parent">
68
69
                </android.support.v7.widget.RecyclerView>
70
            </com.andview.refreshview.XRefreshView>
71
72
            <android.support.constraint.ConstraintLayout
73
                android:id="@+id/loadingView"
74
                android:layout_width="match_parent"
75
                android:layout_height="match_parent">
76
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" />
86
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
        </android.support.constraint.ConstraintLayout>
100
49 101
        <!-- 底部评论输入及发布 -->
50 102
        <android.support.constraint.ConstraintLayout
103
            android:id="@+id/bottomView"
51 104
            android:layout_width="match_parent"
52 105
            android:layout_height="54dp"
53 106
            android:background="#535353"
@ -83,9 +136,9 @@
83 136
                    android:layout_height="wrap_content"
84 137
                    android:ellipsize="end"
85 138
                    android:gravity="center_vertical"
86
                    android:paddingLeft="5dp"
87 139
                    android:hint="写评论"
88 140
                    android:maxLines="1"
141
                    android:paddingLeft="5dp"
89 142
                    android:textColor="#ffffff"
90 143
                    android:textColorHint="#c2c2c2"
91 144
                    android:textSize="14sp"

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

@ -362,13 +362,4 @@
362 362
        </android.support.constraint.ConstraintLayout>
363 363
364 364
    </android.support.constraint.ConstraintLayout>
365
366
    <include
367
        layout="@layout/fragment_chat_content_comment_list"
368
        android:visibility="gone" />
369
    <FrameLayout
370
        android:id="@+id/fragment_container"
371
        android:layout_width="match_parent"
372
        android:layout_height="match_parent">
373
    </FrameLayout>
374 365
</android.support.constraint.ConstraintLayout>

+ 0 - 8
app/src/main/res/layout/fragment_chat_content_video.xml

@ -379,12 +379,4 @@
379 379
380 380
    </android.support.constraint.ConstraintLayout>
381 381
382
    <include
383
        layout="@layout/fragment_chat_content_comment_list"
384
        android:visibility="gone" />
385
    <FrameLayout
386
        android:id="@+id/fragment_container"
387
        android:layout_width="match_parent"
388
        android:layout_height="match_parent">
389
    </FrameLayout>
390 382
</android.support.constraint.ConstraintLayout>

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

@ -17,6 +17,7 @@
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><!--显示软件盘-->
20 21
    </style>
21 22

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

主题详情页开发完成 · 43208863a3 - Gogs: Go Git Service
瀏覽代碼

主题详情页开发完成

huyuguo 7 年之前
父節點
當前提交
43208863a3

+ 2 - 1
app/build.gradle

@ -258,7 +258,8 @@ dependencies {
258 258
    compile 'com.android.support:appcompat-v7:26.1.0'
259 259
    compile 'com.android.support:design:26.1.0'
260 260
    //    compile 'com.nineoldandroids:library:2.4.0'
261
    compile 'com.github.bumptech.glide:glide:4.1.1'
261
//    compile 'com.github.bumptech.glide:glide:4.1.1'
262
    compile 'com.github.bumptech.glide:glide:4.2.0'
262 263
    compile 'me.iwf.photopicker:PhotoPicker:0.9.12@aar'
263 264
    compile 'top.zibin:Luban:1.1.2'
264 265
    compile 'com.ms-square:expandableTextView:0.1.4'

+ 104 - 8
app/src/main/java/com/electric/chargingpile/activity/TopicDetailActivity.java

@ -1,12 +1,15 @@
1 1
package com.electric.chargingpile.activity;
2 2
3
import android.content.Intent;
3 4
import android.os.Bundle;
4 5
import android.support.annotation.Nullable;
5 6
import android.support.v7.app.AppCompatActivity;
6 7
import android.support.v7.widget.RecyclerView;
7 8
import android.support.v7.widget.StaggeredGridLayoutManager;
9
import android.text.TextUtils;
8 10
import android.util.Log;
9 11
import android.view.View;
12
import android.widget.ImageView;
10 13
import android.widget.TextView;
11 14
import android.widget.Toast;
12 15
@ -14,10 +17,13 @@ import com.andview.refreshview.XRefreshView;
14 17
import com.electric.chargingpile.R;
15 18
import com.electric.chargingpile.adapter.TopicDetailAdapter;
16 19
import com.electric.chargingpile.application.MainApplication;
20
import com.electric.chargingpile.data.ChatRecommendBean;
17 21
import com.electric.chargingpile.data.HomePageBean;
18 22
import com.electric.chargingpile.iview.RecyclerItemTypeClickListener;
23
import com.electric.chargingpile.manager.ProfileManager;
19 24
import com.electric.chargingpile.util.CommonParams;
20 25
import com.electric.chargingpile.util.JsonUtils;
26
import com.electric.chargingpile.util.LoadingDialog;
21 27
import com.electric.chargingpile.util.NetUtil;
22 28
import com.electric.chargingpile.util.ToastUtil;
23 29
import com.zhy.http.okhttp.OkHttpUtils;
@ -33,15 +39,20 @@ import okhttp3.Call;
33 39
 */
34 40
public class TopicDetailActivity extends AppCompatActivity implements View.OnClickListener {
35 41
    private static final String TAG = "TopicDetailActivity";
42
    public static final int CLICK_PUBLISH_BTN_TOPIC = 1011;
36 43
    private TextView titleTextView;
37 44
    private XRefreshView xRefreshView;
38 45
    private RecyclerView recyclerView;
46
    private LoadingDialog loadingDialog;
39 47
40 48
    private int topicId;
41 49
    private int sort = 1;
42 50
    private int page = 1;
43 51
    private TopicDetailAdapter topicDetailAdapter;
44 52
    private StaggeredGridLayoutManager staggeredGridLayoutManager;
53
    public boolean isFirst = false;
54
    private ImageView chatPublishTips;
55
    private ImageView chatPublishIcon;
45 56
46 57
    @Override
47 58
    protected void onCreate(@Nullable Bundle savedInstanceState) {
@ -52,7 +63,7 @@ public class TopicDetailActivity extends AppCompatActivity implements View.OnCli
52 63
53 64
        if (NetUtil.CheckNetwork(this)) {
54 65
            xRefreshView.startRefresh();
55
            requestData();
66
            requestData("1");
56 67
        } else {
57 68
            // TODO by hyg
58 69
        }
@ -60,24 +71,27 @@ public class TopicDetailActivity extends AppCompatActivity implements View.OnCli
60 71
61 72
    private void initView() {
62 73
        topicId = getIntent().getIntExtra("topicId", 0);
74
        loadingDialog = new LoadingDialog(TopicDetailActivity.this);
75
        loadingDialog.setCanceledOnTouchOutside(false);
76
63 77
        titleTextView = findViewById(R.id.titleTextView);
64 78
        xRefreshView = findViewById(R.id.xRefreshView);
65 79
        xRefreshView.setPullLoadEnable(true); // 允许加载更多
66
        xRefreshView.setPinnedTime(1000);
80
        xRefreshView.setPinnedTime(0);
67 81
        xRefreshView.setMoveForHorizontal(true);
68 82
        xRefreshView.setXRefreshViewListener(new XRefreshView.SimpleXRefreshListener() {
69 83
            @Override
70 84
            public void onRefresh(boolean isPullDown) {
71 85
                super.onRefresh(isPullDown);
72 86
                page = 1;
73
                requestData();
87
                requestData("1");
74 88
            }
75 89
76 90
            @Override
77 91
            public void onLoadMore(boolean isSilence) {
78 92
                super.onLoadMore(isSilence);
79 93
                page++;
80
                requestData();
94
                requestData("0");
81 95
            }
82 96
        });
83 97
@ -91,16 +105,28 @@ public class TopicDetailActivity extends AppCompatActivity implements View.OnCli
91 105
        recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
92 106
            @Override
93 107
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
94
                // TODO by hyg 发布功能
108
                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
109
                    chatPublishIcon.setVisibility(View.VISIBLE);
110
                    if (isFirst) {
111
                        chatPublishTips.setVisibility(View.VISIBLE);
112
                    }
113
                } else if (newState == RecyclerView.SCREEN_STATE_ON) {
114
                    chatPublishIcon.setVisibility(View.GONE);
115
                    if (isFirst) {
116
                        chatPublishTips.setVisibility(View.GONE);
117
                    }
118
                }
95 119
            }
96 120
97 121
            @Override
98 122
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
123
                super.onScrolled(recyclerView, dx, dy);
99 124
            }
100 125
        });
101 126
102 127
        recyclerView.setLayoutManager(staggeredGridLayoutManager);
103 128
        recyclerView.setAdapter(topicDetailAdapter);
129
        recyclerView.addItemDecoration(new TopicDetailAdapter.ContentViewDecoration());
104 130
        topicDetailAdapter.setOnRecyclerItemClickListener(new RecyclerItemTypeClickListener() {
105 131
            @Override
106 132
            public void onItemClickListener(int position, int index) {
@ -109,14 +135,27 @@ public class TopicDetailActivity extends AppCompatActivity implements View.OnCli
109 135
            }
110 136
        });
111 137
138
112 139
        topicDetailAdapter.setChooseTopicSortInterface(new TopicDetailAdapter.ChooseTopicSortInterface() {
113 140
            @Override
114 141
            public void chooseTopicSort(int s) {
115 142
                sort = s;
116 143
                page = 1;
117
                requestData();
144
                requestData("1");
118 145
            }
119 146
        });
147
148
        chatPublishTips = findViewById(R.id.chatPublishTips);
149
        chatPublishIcon = findViewById(R.id.chatPublishIcon);
150
        chatPublishIcon.setOnClickListener(this);
151
152
        String clickedUserPublishTopic = ProfileManager.getInstance().getClickedUserPublishTopic(getApplicationContext());
153
        if (TextUtils.isEmpty(clickedUserPublishTopic)) {
154
            isFirst = true;
155
            chatPublishTips.setVisibility(View.VISIBLE);
156
        } else {
157
            chatPublishTips.setVisibility(View.GONE);
158
        }
120 159
    }
121 160
122 161
    private void initListener() {
@ -133,6 +172,14 @@ public class TopicDetailActivity extends AppCompatActivity implements View.OnCli
133 172
            case R.id.shareTextView: // 右上角分享功能
134 173
                shareInfo();
135 174
                break;
175
            case R.id.chatPublishIcon: // 发布功能
176
                if (MainApplication.isLogin()) {
177
                    loginSign();
178
                } else {
179
                    startActivity(new Intent(getApplicationContext().getApplicationContext(), LoginActivity.class));
180
                    ToastUtil.showToast(getApplicationContext().getApplicationContext(), "请先登录", Toast.LENGTH_SHORT);
181
                }
182
                break;
136 183
        }
137 184
138 185
    }
@ -141,12 +188,48 @@ public class TopicDetailActivity extends AppCompatActivity implements View.OnCli
141 188
        // TODO by hyg share information
142 189
    }
143 190
144
    private void requestData() {
191
    // 服务器签名验证
192
    private void loginSign() {
193
        String url = MainApplication.urlNew + "/topic/sign.do";
194
        final Map<String, String> map = new HashMap<>();
195
        map.put("fileNames", "android");
196
        map.put("targetType", ChatRecommendBean.TARGET_TYPE_IMAGE_TEXT + "");
197
        CommonParams.addCommonParams(map);
198
        loadingDialog.show();
199
        OkHttpUtils.post().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
200
            @Override
201
            public void onError(Call call, Exception e) {
202
                loadingDialog.dismiss();
203
                ToastUtil.showToast(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT);
204
            }
205
206
            @Override
207
            public void onResponse(String response) {
208
                loadingDialog.dismiss();
209
                String code = JsonUtils.getKeyResult(response, "code");
210
                String desc = JsonUtils.getKeyResult(response, "desc");
211
                if ("1000".equals(code)) {
212
                    chatPublishTips.setVisibility(View.GONE);
213
                    ProfileManager.getInstance().setClickedUserPublishTopic(getApplicationContext(), "label");
214
                    isFirst = false;
215
                    startActivityForResult(new Intent(getApplicationContext(), PublishItemsActivity.class), CLICK_PUBLISH_BTN_TOPIC);
216
                } else if ("8010".equals(code)) {
217
                    startActivity(new Intent(getApplicationContext(), LoginActivity.class));
218
                    ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_LONG);
219
                } else {
220
                    ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
221
                }
222
            }
223
        });
224
225
    }
226
227
    private void requestData(String init) {
145 228
        String url = MainApplication.urlNew + "/topic/homepage.do";
146 229
        Map<String, String> map = new HashMap<>();
147 230
        map.put("topicId", topicId + "");
148 231
        map.put("sort", sort + "");              //   1:最新发布 2:最后回复 3:最热
149
        map.put("init", "1");                   //   0:只返回话题下内容列表 1:返回话题名等信息
232
        map.put("init", init);                   //   0:只返回话题下内容列表 1:返回话题名等信息
150 233
        map.put("page", page + "");
151 234
        map.put("limit", "20");
152 235
        CommonParams.addCommonParams(map);
@ -174,9 +257,22 @@ public class TopicDetailActivity extends AppCompatActivity implements View.OnCli
174 257
                    HomePageBean homePageBean = (HomePageBean) JsonUtils.parseToObjectBean(data, HomePageBean.class);
175 258
                    if (page == 1) {
176 259
                        xRefreshView.stopRefresh();
260
                        xRefreshView.setLoadComplete(false);
177 261
                        topicDetailAdapter.setHeaderData(homePageBean.topicVo);
178 262
                        topicDetailAdapter.setContentData(homePageBean.list);
263
264
                        if (homePageBean.list.size() == 0) {
265
                            topicDetailAdapter.setFooterData(true);
266
                        } else {
267
                            topicDetailAdapter.setFooterData(false);
268
                        }
179 269
                    } else {
270
                        if (homePageBean.list.size() == 0) {
271
                            topicDetailAdapter.setFooterData(true);
272
                            xRefreshView.setLoadComplete(true);
273
                        } else {
274
                            topicDetailAdapter.addContentData(homePageBean.list);
275
                        }
180 276
                        xRefreshView.stopLoadMore();
181 277
                    }
182 278
                } else {

+ 114 - 13
app/src/main/java/com/electric/chargingpile/adapter/TopicDetailAdapter.java

@ -2,6 +2,7 @@ package com.electric.chargingpile.adapter;
2 2
3 3
import android.app.Activity;
4 4
import android.content.Context;
5
import android.graphics.Rect;
5 6
import android.support.constraint.ConstraintLayout;
6 7
import android.support.v7.widget.RecyclerView;
7 8
import android.support.v7.widget.StaggeredGridLayoutManager;
@ -22,14 +23,18 @@ import com.electric.chargingpile.data.TopicDetailBeanLab;
22 23
import com.electric.chargingpile.iview.RecyclerItemTypeClickListener;
23 24
import com.electric.chargingpile.util.CircleTransform;
24 25
import com.electric.chargingpile.util.CommonParams;
26
import com.electric.chargingpile.util.DensityUtil;
25 27
import com.electric.chargingpile.util.ImageDisplayUtils;
26 28
import com.electric.chargingpile.util.JsonUtils;
29
import com.electric.chargingpile.util.ScreenUtils;
27 30
import com.electric.chargingpile.util.ToastUtil;
28 31
import com.electric.chargingpile.view.SortTopicPopWindow;
29 32
import com.squareup.picasso.Picasso;
30 33
import com.zhy.http.okhttp.OkHttpUtils;
31 34
import com.zhy.http.okhttp.callback.StringCallback;
32 35
36
import org.w3c.dom.Text;
37
33 38
import java.util.ArrayList;
34 39
import java.util.HashMap;
35 40
import java.util.List;
@ -41,6 +46,7 @@ public class TopicDetailAdapter extends RecyclerView.Adapter<IViewHolder> {
41 46
    private static final String TAG = "TopicDetailAdapter";
42 47
    public static final int TOPIC_DETAIL_HEADER = 1;
43 48
    public static final int TOPIC_DETAIL_CONTENT = 2;
49
    public static final int TOPIC_DETAIL_FOOTER = 3;
44 50
    private int sort = 1;
45 51
    private Context context;
46 52
    private Activity activity;
@ -49,12 +55,24 @@ public class TopicDetailAdapter extends RecyclerView.Adapter<IViewHolder> {
49 55
    private HomePageBean.HomePageTopicBean topicDetailBean;
50 56
    private RecyclerItemTypeClickListener onRecyclerItemClickListener;
51 57
    private ChooseTopicSortInterface chooseTopicSortInterface;
58
    private final int screenWidth;
59
    private final int screenHeight;
60
    private final int statusHeight;
61
    private final int headerHeight;
62
    private int itemWidth;
63
    private boolean showFooter = false;
52 64
53 65
    public TopicDetailAdapter(Context context, Activity activity) {
54 66
        this.context = context;
55 67
        this.activity = activity;
56 68
        this.layoutInflater = LayoutInflater.from(context);
57 69
        beanLab = TopicDetailBeanLab.get(context);
70
71
        screenWidth = ScreenUtils.getScreenWidth(context);
72
        screenHeight = ScreenUtils.getScreenHeight(context);
73
        statusHeight = ScreenUtils.getStatusHeight(context);
74
        headerHeight = DensityUtil.dip2px(context, 260);
75
        itemWidth = (screenWidth - DensityUtil.dip2px(context, 10 * 2)) / 2;
58 76
    }
59 77
60 78
    @Override
@ -70,30 +88,43 @@ public class TopicDetailAdapter extends RecyclerView.Adapter<IViewHolder> {
70 88
                itemView = layoutInflater.inflate(R.layout.activity_chat_content, parent, false);
71 89
                viewHolder = new ContentViewHolder(itemView);
72 90
                break;
91
            case TOPIC_DETAIL_FOOTER:
92
                itemView = layoutInflater.inflate(R.layout.activity_chat_footer, parent, false);
93
                viewHolder = new FooterViewHolder(itemView);
94
                break;
73 95
        }
74 96
        return viewHolder;
75 97
    }
76 98
77 99
    @Override
78 100
    public void onBindViewHolder(IViewHolder viewHolder, int position) {
79
        switch (viewHolder.getItemViewType()) {
101
        switch (getItemViewType(position)) {
80 102
            case TOPIC_DETAIL_HEADER:
81 103
                bindHeaderViewHolder(viewHolder, position);
82 104
                break;
83 105
            case TOPIC_DETAIL_CONTENT:
84 106
                bindContentViewHolder(viewHolder, position);
85 107
                break;
108
            case TOPIC_DETAIL_FOOTER:
109
                bindFooterViewHolder(viewHolder, position);
110
                break;
86 111
        }
87 112
    }
88 113
89 114
    @Override
90 115
    public int getItemCount() {
91
        return beanLab.beans().size() + 1;
116
        return beanLab.beans().size() + 1 + 1;
92 117
    }
93 118
94 119
    @Override
95 120
    public int getItemViewType(int position) {
96
        return position == 0 ? TOPIC_DETAIL_HEADER : TOPIC_DETAIL_CONTENT;
121
        if (position == 0) {
122
            return TOPIC_DETAIL_HEADER;
123
        } else if (position == getItemCount() - 1) {
124
            return TOPIC_DETAIL_FOOTER;
125
        } else {
126
            return TOPIC_DETAIL_CONTENT;
127
        }
97 128
    }
98 129
99 130
    private void bindHeaderViewHolder(IViewHolder viewHolder, int position) {
@ -126,24 +157,18 @@ public class TopicDetailAdapter extends RecyclerView.Adapter<IViewHolder> {
126 157
                                sortPopWindow.dismiss();
127 158
                                headerViewHolder.sortTextView.setText("最新发布");
128 159
                                headerViewHolder.chooseTopicSort(sort);
129
//                                page = 1;
130
//                                requestData();
131 160
                                break;
132 161
                            case R.id.tv_2:
133 162
                                sort = 2;
134 163
                                sortPopWindow.dismiss();
135 164
                                headerViewHolder.sortTextView.setText("最后回复");
136 165
                                headerViewHolder.chooseTopicSort(sort);
137
//                                page = 1;
138
//                                requestData();
139 166
                                break;
140 167
                            case R.id.tv_3:
141 168
                                sort = 3;
142 169
                                sortPopWindow.dismiss();
143 170
                                headerViewHolder.sortTextView.setText("最热");
144 171
                                headerViewHolder.chooseTopicSort(sort);
145
//                                page = 1;
146
//                                requestData();
147 172
                                break;
148 173
                        }
149 174
                    }
@ -160,9 +185,22 @@ public class TopicDetailAdapter extends RecyclerView.Adapter<IViewHolder> {
160 185
161 186
        final ChatRecommendBean bean = beans.get(position - 1);
162 187
        ContentViewHolder contentViewHolder = (ContentViewHolder) viewHolder;
188
        ConstraintLayout.LayoutParams coverImageParams = (ConstraintLayout.LayoutParams) contentViewHolder.coverImage.getLayoutParams();
189
        coverImageParams.width = itemWidth;
190
191
        if (bean.coverImgW == 0 || bean.coverImgH == 0) {
192
            coverImageParams.height = (int) (itemWidth * 16f / 9f);
193
        } else {
194
            if ((float) bean.coverImgH / bean.coverImgW > 16f / 9f) {
195
                coverImageParams.height = (int) (itemWidth * 16f / 9f);
196
            } else {
197
                coverImageParams.height = (int) ((float) itemWidth * bean.coverImgH / bean.coverImgW);
198
            }
199
        }
200
        contentViewHolder.coverImage.setLayoutParams(coverImageParams);
163 201
        ImageDisplayUtils.dispalyImg(context, bean.coverImgUrl, contentViewHolder.coverImage);
164
        contentViewHolder.videoIcon.setVisibility(bean.targetType == ChatRecommendBean.TARGET_TYPE_VIDEO ? View.VISIBLE : View.GONE);
165 202
203
        contentViewHolder.videoIcon.setVisibility(bean.targetType == ChatRecommendBean.TARGET_TYPE_VIDEO ? View.VISIBLE : View.GONE);
166 204
        contentViewHolder.isTop.setVisibility(bean.isTop == 1 ? View.VISIBLE : View.GONE);
167 205
        contentViewHolder.title.setText(bean.title);
168 206
        contentViewHolder.authorInfo.setOnClickListener(new View.OnClickListener() {
@ -248,6 +286,32 @@ public class TopicDetailAdapter extends RecyclerView.Adapter<IViewHolder> {
248 286
        });
249 287
    }
250 288
289
    private void bindFooterViewHolder(IViewHolder viewHolder, final int position) {
290
        FooterViewHolder footerViewHolder = (FooterViewHolder) viewHolder;
291
        StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) footerViewHolder.footerContainer.getLayoutParams();
292
        layoutParams.setFullSpan(true);
293
294
        footerViewHolder.footerContainer.setVisibility(showFooter ? View.VISIBLE : View.GONE);
295
296
        ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) footerViewHolder.footerView.getLayoutParams();
297
        if (TopicDetailBeanLab.get(context).beans().size() == 0) {
298
            footerViewHolder.footTextView.setText("还没有任何内容哦,快来抢沙发~");
299
            params.height = DensityUtil.dip2px(context, (screenHeight - headerHeight - statusHeight) / 4);
300
            params.bottomMargin = 0;
301
        } else {
302
            footerViewHolder.footTextView.setText("已经全部加载完毕");
303
            params.height = DensityUtil.dip2px(context, 20);
304
            params.bottomMargin = DensityUtil.dip2px(context, 10);
305
        }
306
307
        if (showFooter == false) {
308
            params.height = 0;
309
            params.bottomMargin = DensityUtil.dip2px(context, 10);
310
        }
311
312
        footerViewHolder.footTextView.setLayoutParams(params);
313
    }
314
251 315
    private void showAuthorInfo(int position) {
252 316
        // TODO
253 317
    }
@ -262,14 +326,18 @@ public class TopicDetailAdapter extends RecyclerView.Adapter<IViewHolder> {
262 326
    public void addContentData(ArrayList<ChatRecommendBean> beans) {
263 327
        int startSize = beanLab.beans().size();
264 328
        beanLab.add(beans);
265
        int endSize = beanLab.beans().size();
266
        notifyItemRangeChanged(startSize, endSize);
329
        notifyItemRangeChanged(startSize, beans.size());
267 330
    }
268 331
269 332
    public void setHeaderData(HomePageBean.HomePageTopicBean bean) {
270 333
        topicDetailBean = bean;
271 334
    }
272 335
336
    public void setFooterData(Boolean showFooter) {
337
        this.showFooter = showFooter;
338
        notifyItemRangeChanged(getItemCount() - 1, 1);
339
    }
340
273 341
    class HeaderViewHolder extends IViewHolder {
274 342
        ConstraintLayout topicDetailHeader;
275 343
        ImageView headImage;
@ -303,7 +371,6 @@ public class TopicDetailAdapter extends RecyclerView.Adapter<IViewHolder> {
303 371
                chooseTopicSortInterface.chooseTopicSort(sort);
304 372
            }
305 373
        }
306
307 374
    }
308 375
309 376
    public class ContentViewHolder extends IViewHolder {
@ -347,6 +414,40 @@ public class TopicDetailAdapter extends RecyclerView.Adapter<IViewHolder> {
347 414
        }
348 415
    }
349 416
417
    public class FooterViewHolder extends IViewHolder {
418
419
        ConstraintLayout footerContainer;
420
        ConstraintLayout footerView;
421
        TextView footTextView;
422
423
        public FooterViewHolder(View itemView) {
424
            super(itemView);
425
            footerContainer = itemView.findViewById(R.id.footerContainer);
426
            footerView = itemView.findViewById(R.id.footerView);
427
            footTextView = itemView.findViewById(R.id.footTextView);
428
        }
429
    }
430
431
    public static class ContentViewDecoration extends RecyclerView.ItemDecoration {
432
        private StaggeredGridLayoutManager.LayoutParams layoutParams;
433
434
        @Override
435
        public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
436
            layoutParams = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
437
            int position = parent.getChildAdapterPosition(view);
438
            if (position > 0) {
439
                if (layoutParams.getSpanIndex() % 2 == 0) {
440
                    outRect.left = DensityUtil.dip2px(view.getContext(), 15);
441
                    outRect.right = DensityUtil.dip2px(view.getContext(), 5);
442
                } else {
443
                    outRect.right = DensityUtil.dip2px(view.getContext(), 15);
444
                    outRect.left = DensityUtil.dip2px(view.getContext(), 5);
445
                }
446
            }
447
448
        }
449
    }
450
350 451
    public void setOnRecyclerItemClickListener(RecyclerItemTypeClickListener onRecyclerItemClickListener) {
351 452
        this.onRecyclerItemClickListener = onRecyclerItemClickListener;
352 453
    }

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

@ -73,11 +73,11 @@ 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";// 一电正式环境
80
    public static String pic_url = "http://cdz.evcharge.cc/zhannew/uploadfile/";
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
    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";
83 83
    public static String support = "0";

+ 11 - 0
app/src/main/java/com/electric/chargingpile/manager/ProfileManager.java

@ -60,6 +60,7 @@ public class ProfileManager {
60 60
    private static final String KEY_DATA_UPTIME = "key_data_uptime";
61 61
    private static final String KEY_FIND_DATE = "key_find_date";
62 62
    private static final String KEY_ADD_COME_FIRST = "key_add_come_first";
63
    private static final String KEY_CLICKED_USER_PUBLISH_TOPIC = "key_clicked_user_publish_topic";
63 64
    private static final String KEY_CLICKED_USER_PUBLISH_ROLE = "key_clicked_user_publish_role";
64 65

65 66
    private static ProfileManager instance;
@ -187,6 +188,11 @@ public class ProfileManager {
187 188
                .putString(KEY_ADD_COME_FIRST, content);
188 189
    }
189 190

191
    public void setClickedUserPublishTopic(Context context, String content) {
192
        PreferenceManager.getInstance(context)
193
                .putString(KEY_CLICKED_USER_PUBLISH_TOPIC, content);
194
    }
195

190 196
    public void setClickedUserPublishRole(Context context, String content) {
191 197
        PreferenceManager.getInstance(context)
192 198
                .putString(KEY_CLICKED_USER_PUBLISH_ROLE, content);
@ -505,6 +511,11 @@ public class ProfileManager {
505 511
                "");
506 512
    }
507 513

514
    public String getClickedUserPublishTopic(Context context) {
515
        return PreferenceManager.getInstance(context).getString(KEY_CLICKED_USER_PUBLISH_TOPIC,
516
                "");
517
    }
518

508 519
    public String getClickedUserPublishRole(Context context) {
509 520
        return PreferenceManager.getInstance(context).getString(KEY_CLICKED_USER_PUBLISH_ROLE,
510 521
                "");

+ 9 - 10
app/src/main/res/layout/activity_chat_content.xml

@ -18,9 +18,10 @@
18 18
19 19
        <ImageView
20 20
            android:id="@+id/coverImage"
21
            android:layout_width="168dp"
22
            android:layout_height="147dp"
21
            android:layout_width="wrap_content"
22
            android:layout_height="wrap_content"
23 23
            android:contentDescription="信息图片"
24
            android:scaleType="fitXY"
24 25
            app:layout_constraintEnd_toEndOf="parent"
25 26
            app:layout_constraintStart_toStartOf="parent"
26 27
            app:layout_constraintTop_toTopOf="parent"
@ -59,11 +60,11 @@
59 60
            android:id="@+id/title"
60 61
            android:layout_width="0dp"
61 62
            android:layout_height="wrap_content"
62
            android:layout_marginLeft="10dp"
63
            android:layout_marginTop="10dp"
64
            android:layout_marginRight="10dp"
63
            android:paddingLeft="10dp"
64
            android:paddingRight="10dp"
65
            android:paddingTop="10dp"
65 66
            android:ellipsize="end"
66
            android:maxLines="2"
67
            android:maxLines="3"
67 68
            android:textColor="#222222"
68 69
            android:textSize="15sp"
69 70
            app:layout_constraintEnd_toEndOf="parent"
@ -74,6 +75,8 @@
74 75
        <android.support.constraint.ConstraintLayout
75 76
            android:layout_width="0dp"
76 77
            android:layout_height="48dp"
78
            android:paddingLeft="10dp"
79
            android:paddingRight="10dp"
77 80
            app:layout_constraintLeft_toLeftOf="parent"
78 81
            app:layout_constraintRight_toRightOf="parent"
79 82
            app:layout_constraintTop_toBottomOf="@+id/title">
@ -82,8 +85,6 @@
82 85
                android:id="@+id/authorInfo"
83 86
                android:layout_width="wrap_content"
84 87
                android:layout_height="0dp"
85
                android:paddingLeft="10dp"
86
                android:paddingRight="10dp"
87 88
                app:layout_constraintBottom_toBottomOf="parent"
88 89
                app:layout_constraintLeft_toLeftOf="parent"
89 90
                app:layout_constraintTop_toTopOf="parent">
@ -114,8 +115,6 @@
114 115
                android:id="@+id/likeInfo"
115 116
                android:layout_width="wrap_content"
116 117
                android:layout_height="0dp"
117
                android:paddingLeft="10dp"
118
                android:paddingRight="10dp"
119 118
                app:layout_constraintBottom_toBottomOf="parent"
120 119
                app:layout_constraintRight_toRightOf="parent"
121 120
                app:layout_constraintTop_toTopOf="parent">

+ 34 - 0
app/src/main/res/layout/activity_chat_footer.xml

@ -0,0 +1,34 @@
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:id="@+id/footerContainer"
6
    android:layout_width="match_parent"
7
    android:layout_height="wrap_content">
8
9
    <android.support.constraint.ConstraintLayout
10
        android:id="@+id/footerView"
11
        android:layout_width="match_parent"
12
        android:layout_height="20dp"
13
        app:layout_constraintBottom_toBottomOf="parent"
14
        app:layout_constraintEnd_toEndOf="parent"
15
        app:layout_constraintStart_toStartOf="parent"
16
        app:layout_constraintTop_toTopOf="parent">
17
18
        <TextView
19
            android:id="@+id/footTextView"
20
            android:layout_width="match_parent"
21
            android:layout_height="match_parent"
22
            android:gravity="center"
23
            android:paddingLeft="30dp"
24
            android:paddingRight="30dp"
25
            android:textColor="#555555"
26
            android:textSize="14sp"
27
            app:layout_constraintBottom_toBottomOf="parent"
28
            app:layout_constraintEnd_toEndOf="parent"
29
            app:layout_constraintStart_toStartOf="parent"
30
            app:layout_constraintTop_toTopOf="parent"
31
            tools:text="已经全部加载完毕" />
32
    </android.support.constraint.ConstraintLayout>
33
34
</android.support.constraint.ConstraintLayout>

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

@ -74,7 +74,6 @@
74 74
            android:layout_width="match_parent"
75 75
            android:layout_height="match_parent"
76 76
            android:scrollbars="vertical" />
77
78 77
    </com.andview.refreshview.XRefreshView>
79 78
80 79
    <ImageView

+ 2 - 1
zxing/build.gradle

@ -29,7 +29,8 @@ dependencies {
29 29
    })
30 30
    compile 'pub.devrel:easypermissions:0.2.0'
31 31
    compile 'com.google.code.gson:gson:2.2.4'
32
    compile 'com.github.bumptech.glide:glide:4.1.1'
32
//    compile 'com.github.bumptech.glide:glide:4.1.1'
33
    compile 'com.github.bumptech.glide:glide:4.2.0'
33 34
    compile 'com.google.zxing:core:+'
34 35
    compile 'com.google.zxing:android-core:+'
35 36
    compile 'com.blankj:utilcode:1.9.8'