478
                    String desc = JsonUtils.getKeyResult(response, "desc");
479
                    if ("1000".equals(code)) {
480
                        deleteComment();
481
                    } else if ("8010".equals(code)) {
482
                        startActivity(new Intent(getContext(), LoginActivity.class));
483
                        ToastUtil.showToast(getContext(), desc, Toast.LENGTH_LONG);
484
                    } else {
485
                        ToastUtil.showToast(getContext(), desc, Toast.LENGTH_SHORT);
486
                    }
487
                }
488
            });
489
        }
490
491
        private void deleteComment() {
492
            String url = MainApplication.urlNew + "/topic/del.do";
493
            final Map<String, String> map = new HashMap<>();
494
            map.put("targetId", bean.id + "");
495
            map.put("targetType", "25");
496
            map.put("userId", bean.userId + "");
497
            CommonParams.addCommonParams(map);
498
499
            OkHttpUtils.post().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
500
                @Override
501
                public void onError(Call call, Exception e) {
502
                    ToastUtil.showToast(getContext(), e.getMessage(), Toast.LENGTH_SHORT);
503
                }
504
505
                @Override
506
                public void onResponse(String response) {
507
                    String code = JsonUtils.getKeyResult(response, "code");
508
                    String desc = JsonUtils.getKeyResult(response, "desc");
509
                    if ("1000".equals(code)) {
510
                        commentAdapter.removeData(position);
511
                        commentAdapter.notifyItemRemoved(position);
512
                        if (chatRecommendBean.commentNums > 0) {
513
                            chatRecommendBean.commentNums--;
514
                        }
515
                        allCommentTitle.setText("全部评论 " + chatRecommendBean.commentNums);
516
                        if (chatContentCommentListDialogFragmentListener != null) {
517
                            chatContentCommentListDialogFragmentListener.updateCommentNum(chatRecommendBean.commentNums);
518
                        }
519
                    } else {
520
                        ToastUtil.showToast(getContext(), desc, Toast.LENGTH_SHORT);
521
                    }
522
                }
523
            });
524
        }
525
526
    }
527
528
    private class CommentAdapter extends RecyclerView.Adapter<CommentHolder> {
529
        private static final String TAG = "CommentAdapter";
530
        private List<CommentBean> beans;
531
532
        public CommentAdapter() {
533
            this.beans = new ArrayList<>();
534
        }
535
536
        @Override
537
        public CommentHolder onCreateViewHolder(ViewGroup parent, int i) {
538
            LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
539
            return new CommentHolder(layoutInflater, parent);
540
        }
541
542
        @Override
543
        public void onBindViewHolder(CommentHolder commentHolder, int i) {
544
            CommentBean bean = beans.get(i);
545
            commentHolder.bindView(bean, i);
546
        }
547
548
        @Override
549
        public int getItemCount() {
550
            return beans.size();
551
        }
552
553
        public void setData(List<CommentBean> beans) {
554
            this.beans.clear();
555
            this.beans.addAll(beans);
556
            notifyDataSetChanged();
557
        }
558
559
        public void addData(List<CommentBean> beans) {
560
            int size = this.beans.size();
561
            this.beans.addAll(beans);
562
            notifyItemRangeChanged(size, beans.size());
563
        }
564
565
        public void clearData() {
566
            beans.clear();
251
        }
567
        }
568
569
        public void removeData(int position) {
570
            if (position < beans.size()) {
571
                beans.remove(position);
572
            }
573
574
        }
575
576
        public List<CommentBean> getCurrentData() {
577
            return beans;
578
        }
579
252
    }
580
    }
253
581
254
//    private class CommentAdapter extends RecyclerView.Adapter
582
    public interface OnChatContentCommentListDialogFragmentListener {
583
        void updateCommentNum(int num);
584
    }
585
586
    public void setOnCommonDialogFragmentListener(OnChatContentCommentListDialogFragmentListener listener) {
587
        this.chatContentCommentListDialogFragmentListener = listener;
588
    }
255
}
589
}

+ 25 - 2
app/src/main/res/layout/fragment_chat_content_comment_list.xml

100
                app:layout_constraintTop_toBottomOf="@+id/loadingIndicator" />
100
                app:layout_constraintTop_toBottomOf="@+id/loadingIndicator" />
101
        </android.support.constraint.ConstraintLayout>
101
        </android.support.constraint.ConstraintLayout>
102
102
103
        <!-- 检查网络 -->
104
103
        <!-- 没有数据 -->
105
        <android.support.constraint.ConstraintLayout
104
        <android.support.constraint.ConstraintLayout
105
            android:id="@+id/noDataView"
106
            android:layout_width="0dp"
107
            android:layout_height="0dp"
106
            android:visibility="gone"
108
            android:visibility="gone"
109
            app:layout_constraintBottom_toTopOf="@+id/bottomView"
110
            app:layout_constraintEnd_toEndOf="parent"
111
            app:layout_constraintStart_toStartOf="parent"
112
            app:layout_constraintTop_toBottomOf="@+id/titleView">
113
114
            <TextView
115
                android:layout_width="wrap_content"
116
                android:layout_height="wrap_content"
117
                android:layout_marginTop="20dp"
118
                android:text="还没有评论哦,快去抢沙发~"
119
                android:textColor="#ffffff"
120
                android:textSize="14sp"
121
                app:layout_constraintBottom_toBottomOf="parent"
122
                app:layout_constraintEnd_toEndOf="parent"
123
                app:layout_constraintStart_toStartOf="parent"
124
                app:layout_constraintTop_toTopOf="parent" />
125
        </android.support.constraint.ConstraintLayout>
126
127
        <!-- 检查网络 -->
128
        <android.support.constraint.ConstraintLayout
107
            android:id="@+id/noNetView"
129
            android:id="@+id/noNetView"
108
            android:layout_width="0dp"
130
            android:layout_width="0dp"
109
            android:layout_height="wrap_content"
131
            android:layout_height="wrap_content"
132
            android:visibility="gone"
110
            app:layout_constraintBottom_toTopOf="@+id/bottomView"
133
            app:layout_constraintBottom_toTopOf="@+id/bottomView"
111
            app:layout_constraintEnd_toEndOf="parent"
134
            app:layout_constraintEnd_toEndOf="parent"
112
            app:layout_constraintStart_toStartOf="parent"
135
            app:layout_constraintStart_toStartOf="parent"

+ 7 - 5
app/src/main/res/layout/list_item_comment.xml

94
        tools:text="充电桩挺多的,但是油车也多,充电的车也多。园区进门就收费,还好去了两次都充上了。"></TextView>
94
        tools:text="充电桩挺多的,但是油车也多,充电的车也多。园区进门就收费,还好去了两次都充上了。"></TextView>
95
95
96
    <android.support.constraint.ConstraintLayout
96
    <android.support.constraint.ConstraintLayout
97
        android:id="@+id/replyView"
98
        android:layout_width="match_parent"
97
        android:id="@+id/replyAndDeleteView"
98
        android:layout_width="wrap_content"
99
        android:layout_height="42dp"
99
        android:layout_height="42dp"
100
        android:paddingLeft="29dp"
100
        android:paddingLeft="29dp"
101
        app:layout_constraintLeft_toLeftOf="parent"
101
        app:layout_constraintBottom_toBottomOf="parent"
102
        app:layout_constraintBottom_toBottomOf="parent"
102
        app:layout_constraintTop_toBottomOf="@+id/content"
103
        app:layout_constraintTop_toBottomOf="@+id/content"
103
        tools:background="#06648f">
104
        tools:background="#06648f">
104
105
105
        <android.support.constraint.ConstraintLayout
106
        <android.support.constraint.ConstraintLayout
106
            android:id="@+id/replayInfo"
107
            android:id="@+id/replyInfo"
107
            android:layout_width="wrap_content"
108
            android:layout_width="wrap_content"
108
            android:layout_height="match_parent"
109
            android:layout_height="match_parent"
109
            android:layout_marginLeft="10dp"
110
            android:layout_marginLeft="10dp"
138
        </android.support.constraint.ConstraintLayout>
139
        </android.support.constraint.ConstraintLayout>
139
140
140
        <TextView
141
        <TextView
142
            android:id="@+id/deleteComment"
141
            android:layout_width="wrap_content"
143
            android:layout_width="wrap_content"
142
            android:layout_height="42dp"
144
            android:layout_height="42dp"
143
            android:gravity="center"
145
            android:gravity="center"
147
            android:textColor="#c2c2c2"
149
            android:textColor="#c2c2c2"
148
            android:textSize="12sp"
150
            android:textSize="12sp"
149
            app:layout_constraintBottom_toBottomOf="parent"
151
            app:layout_constraintBottom_toBottomOf="parent"
150
            app:layout_constraintLeft_toRightOf="@+id/replayInfo"
152
            app:layout_constraintLeft_toRightOf="@+id/replyInfo"
151
            app:layout_constraintTop_toTopOf="parent"
153
            app:layout_constraintTop_toTopOf="parent"
152
            tools:background="#790f59" />
154
            tools:background="#790f59" />
153
    </android.support.constraint.ConstraintLayout>
155
    </android.support.constraint.ConstraintLayout>
159
        android:layout_marginTop="10dp"
161
        android:layout_marginTop="10dp"
160
        android:background="#505050"
162
        android:background="#505050"
161
        app:layout_constraintBottom_toBottomOf="parent"
163
        app:layout_constraintBottom_toBottomOf="parent"
162
        app:layout_constraintTop_toBottomOf="@+id/replyView" />
164
        app:layout_constraintTop_toBottomOf="@+id/replyAndDeleteView" />
163
</android.support.constraint.ConstraintLayout>
165
</android.support.constraint.ConstraintLayout>

cdzApp - Gogs: Go Git Service

充电桩app代码

huyuguo 5c68143e90 代码修改 5 years ago
.idea ad7d3228bc 车主认证图片上传 5 years ago
XRefreshView 319397b60f 配置信息优化 5 years ago
app 5c68143e90 代码修改 5 years ago
autolayout 319397b60f 配置信息优化 5 years ago
gradle b98aa2e34f 代码修改 5 years ago
keystore 06bd894653 init 7 years ago
library 319397b60f 配置信息优化 5 years ago
zxing 319397b60f 配置信息优化 5 years ago
.gitignore a90ec777b5 视频功能完成 5 years ago
README.md 9f927f0d57 列表开发 6 years ago
build.gradle 06d8b7460a 代码更新 5 years ago
gradle.properties 2ccff5dbe6 配置优化 5 years ago
gradlew 3473529e39 fix video play exception 7 years ago
gradlew.bat e1cf244fe0 remove Useless dependence 7 years ago
icon_sgreen.png e1cf244fe0 remove Useless dependence 7 years ago
settings.gradle a90ec777b5 视频功能完成 5 years ago

README.md

地图首页

MainMapActivity.java
activity_main_map.xml

智能推荐(地图首页右下角)

RecommendZhanActivity.java
activity_recommend_zhan.xml
item_recommend_zhan.xml

筛选(地图首页)

NewScreenActivity.java
activity_new_screen.xml

列表(地图首页右上角,旧功能由推荐替换)

ZhanListActivity.java
activity_zhan_list.xml

推荐

RecommendChargingStationActivity.java
activity_recommend_charging_station.xml
recommend_charging_station_item.xml

站点详情

NewZhanDetailsActivity.class
activity_new_zhan_details.xml
DetailsFragment.java
fragmen_details_new.xml