e">app/src/main/java/com/electric/chargingpile/view/PreferentialDialog.java
View File
@ -0,0 +1,70 @@
1
package com.electric.chargingpile.view;
2
3
import android.os.Bundle;
4
import android.view.LayoutInflater;
5
import android.view.View;
6
import android.view.ViewGroup;
7
import android.widget.TextView;
8
9
import androidx.annotation.NonNull;
10
import androidx.annotation.Nullable;
11
import androidx.recyclerview.widget.LinearLayoutManager;
12
import androidx.recyclerview.widget.RecyclerView;
13
14
import com.electric.chargingpile.R;
15
import com.electric.chargingpile.adapter.PreferentialAdapter;
16
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
17
18
import org.jetbrains.annotations.NotNull;
19
/**
20
 * 选择优惠类型
21
 * */
22
public class PreferentialDialog extends BottomSheetDialogFragment {
23
24
    private RecyclerView recyclerView;
25
    private CompleteListener mListener;
26
27
    public static  PreferentialDialog newInstance(){
28
        PreferentialDialog dialog = new PreferentialDialog();
29
        Bundle arguments = dialog.getArguments();
30
        return dialog;
31
    }
32
33
34
    @Override
35
    public void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
36
        super.onCreate(savedInstanceState);
37
        setStyle(BottomSheetDialogFragment.STYLE_NORMAL, R.style.TransparentVideoDialogFragmentTheme);
38
39
    }
40
41
    @Nullable
42
    @org.jetbrains.annotations.Nullable
43
    @Override
44
    public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
45
        View rootView=inflater.inflate(R.layout.dialog_preferential,container,false);
46
        return rootView;
47
    }
48
49
    @Override
50
    public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
51
        super.onViewCreated(view, savedInstanceState);
52
        TextView complete=view.findViewById(R.id.complete);
53
        recyclerView = view.findViewById(R.id.recyclerView);
54
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
55
        PreferentialAdapter adapter=new PreferentialAdapter();
56
        recyclerView.setAdapter(adapter);
57
        complete.setOnClickListener(v->{
58
            //获取adapter被选中的数据,并且返回回调给
59
            mListener.onComplete();
60
        });
61
    }
62
63
    public void setListener(CompleteListener listener){
64
        mListener=listener;
65
    }
66
67
    public interface CompleteListener{
68
        void onComplete();
69
    }
70
}

BIN
app/src/main/res/drawable-xxhdpi/ic_default_orders.png


BIN
app/src/main/res/drawable-xxhdpi/ic_no_check.png


BIN
app/src/main/res/drawable-xxhdpi/ic_select_check.png


+ 5 - 0
app/src/main/res/drawable/bg_dialog_preferential.xml

@ -0,0 +1,5 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<shape xmlns:android="http://schemas.android.com/apk/res/android">
3
    <corners android:topRightRadius="20dp" android:topLeftRadius="20dp"/>
4
    <solid android:color="@color/white"/>
5
</shape>

+ 8 - 0
app/src/main/res/drawable/checkbox_style.xml

@ -0,0 +1,8 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3
4
    <item android:drawable="@drawable/ic_select_check" android:state_checked="true"/>
5
    <item android:drawable="@drawable/ic_no_check" android:state_checked="false"/>
6
    <item android:drawable="@drawable/ic_no_check"/>
7
8
</selector>

+ 4 - 0
app/src/main/res/layout/activity_oder_details.xml

@ -38,6 +38,7 @@
38 38
39 39
    </RelativeLayout>
40 40
41
41 42
    <LinearLayout
42 43
        android:id="@+id/ll_order"
43 44
        android:layout_width="match_parent"
@ -45,6 +46,9 @@
45 46
        android:layout_below="@+id/rl_title"
46 47
        android:layout_alignParentStart="true"
47 48
        android:layout_alignParentLeft="true"
49
        android:layout_marginStart="-1dp"
50
        android:layout_marginLeft="-1dp"
51
        android:layout_marginTop="0dp"
48 52
        android:background="@color/white"
49 53
        android:orientation="vertical">
50 54

+ 307 - 0
app/src/main/res/layout/activity_submit_orders.xml

@ -0,0 +1,307 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    android:background="@color/white"
5
    android:layout_height="match_parent">
6
    <RelativeLayout
7
        android:id="@+id/rl_title"
8
        android:layout_width="match_parent"
9
        android:layout_height="44dp"
10
        android:layout_alignParentStart="true"
11
        android:layout_alignParentLeft="true"
12
        android:layout_alignParentTop="true"
13
        android:background="@color/white">
14
15
        <TextView
16
            android:id="@+id/tv_zhan_name"
17
            android:layout_width="wrap_content"
18
            android:layout_height="wrap_content"
19
            android:layout_centerInParent="true"
20
            android:text="订单详情"
21
            android:textColor="@color/ui_62"
22
            android:textSize="18sp" />
23
24
        <ImageView
25
            android:id="@+id/iv_back"
26
            android:layout_width="wrap_content"
27
            android:layout_height="match_parent"
28
            android:layout_alignParentLeft="true"
29
            android:layout_centerVertical="true"
30
            android:contentDescription="@null"
31
            android:paddingLeft="15dp"
32
            android:paddingRight="15dp"
33
            android:src="@drawable/icon_lvback1119" />
34
35
    </RelativeLayout>
36
    <LinearLayout
37
        android:id="@+id/ll_order"
38
        android:layout_width="match_parent"
39
        android:layout_height="wrap_content"
40
        android:layout_below="@+id/rl_title"
41
        android:layout_alignParentStart="true"
42
        android:layout_alignParentLeft="true"
43
        android:layout_marginStart="-1dp"
44
        android:layout_marginLeft="-1dp"
45
        android:layout_marginTop="0dp"
46
        android:background="@color/white"
47
        android:orientation="vertical">
48
49
        <TextView
50
            android:id="@+id/tv_name"
51
            android:layout_width="wrap_content"
52
            android:layout_height="wrap_content"
53
            android:layout_gravity="center_horizontal"
54
            android:layout_marginTop="27dp"
55
            android:drawableLeft="@drawable/icon_zhan_name"
56
            android:drawablePadding="8dp"
57
            android:gravity="center"
58
            android:text=""
59
            android:textColor="@color/ui_62"
60
            android:textSize="18sp" />
61
62
        <TextView
63
            android:id="@+id/tv_charging_shifu"
64
            android:layout_width="wrap_content"
65
            android:layout_height="wrap_content"
66
            android:layout_gravity="center_horizontal"
67
            android:layout_marginTop="30dp"
68
            android:text="--"
69
            android:textColor="@color/ui_62"
70
            android:textSize="31sp" />
71
72
        <TextView
73
            android:layout_width="wrap_content"
74
            android:layout_height="wrap_content"
75
            android:layout_gravity="center_horizontal"
76
            android:layout_marginTop="14dp"
77
            android:text="实付金额(元)"
78
            android:textColor="@color/ui_68"
79
            android:textSize="14sp" />
80
81
        <RelativeLayout
82
            android:layout_width="match_parent"
83
            android:layout_height="wrap_content"
84
            android:layout_marginTop="21dp">
85
86
            <TextView
87
                android:layout_width="wrap_content"
88
                android:layout_height="wrap_content"
89
                android:layout_alignParentLeft="true"
90
                android:layout_marginLeft="15dp"
91
                android:text="充电费"
92
                android:textColor="@color/ui_62"
93
                android:textSize="14sp" />
94
95
            <TextView
96
                android:id="@+id/tv_charging_cost"
97
                android:layout_width="wrap_content"
98
                android:layout_height="wrap_content"
99
                android:layout_alignParentRight="true"
100
                android:layout_marginRight="15dp"
101
                android:text="--"
102
                android:textColor="@color/ui_62"
103
                android:textSize="14sp" />
104
105
        </RelativeLayout>
106
107
        <RelativeLayout
108
            android:layout_width="match_parent"
109
            android:layout_height="wrap_content"
110
            android:layout_marginTop="13dp">
111
112
            <TextView
113
                android:layout_width="wrap_content"
114
                android:layout_height="wrap_content"
115
                android:layout_alignParentLeft="true"
116
                android:layout_marginLeft="15dp"
117
                android:text="服务费"
118
                android:textColor="@color/ui_62"
119
                android:textSize="14sp" />
120
121
            <TextView
122
                android:id="@+id/tv_service_cost"
123
                android:layout_width="wrap_content"
124
                android:layout_height="wrap_content"
125
                android:layout_alignParentRight="true"
126
                android:layout_marginRight="15dp"
127
                android:text="--"
128
                android:textColor="@color/ui_62"
129
                android:textSize="14sp" />
130
131
        </RelativeLayout>
132
133
        <RelativeLayout
134
            android:id="@+id/layoutRed"
135
            android:layout_width="match_parent"
136
            android:layout_height="wrap_content"
137
            android:layout_marginTop="13dp">
138
139
            <TextView
140
                android:id="@+id/redEnvelope"
141
                android:layout_width="wrap_content"
142
                android:layout_height="wrap_content"
143
                android:layout_alignParentLeft="true"
144
                android:layout_marginLeft="15dp"
145
                android:text="红包/优惠券"
146
                android:textSize="14sp" />
147
            <ImageView
148
                android:layout_marginTop="8dp"
149
                android:layout_alignStart="@+id/redEnvelope"
150
                android:src="@drawable/ic_default_orders"
151
                android:layout_below="@+id/redEnvelope"
152
                android:layout_width="wrap_content"
153
                android:layout_height="wrap_content"/>
154
155
            <TextView
156
                android:layout_centerVertical="true"
157
                android:id="@+id/tv_charging_hongbao"
158
                android:layout_width="wrap_content"
159
                android:layout_height="wrap_content"
160
                android:layout_alignParentRight="true"
161
                android:layout_marginRight="15dp"
162
                android:text="--"
163
                android:textColor="@color/juhuang"
164
                android:textSize="14sp" />
165
166
        </RelativeLayout>
167
168
        <View
169
            android:layout_width="match_parent"
170
            android:layout_height="5dp"
171
            android:layout_marginTop="20dp"
172
            android:layout_marginBottom="20dp"
173
            android:background="#F6F6F6" />
174
175
        <RelativeLayout
176
            android:layout_width="match_parent"
177
            android:layout_height="wrap_content"
178
           >
179
180
            <TextView
181
                android:layout_width="wrap_content"
182
                android:layout_height="wrap_content"
183
                android:layout_alignParentLeft="true"
184
                android:layout_marginLeft="15dp"
185
                android:text="充电桩编号"
186
                android:textColor="@color/ui_68"
187
                android:textSize="14sp" />
188
189
            <TextView
190
                android:id="@+id/tv_zhuang_no"
191
                android:layout_width="wrap_content"
192
                android:layout_height="wrap_content"
193
                android:layout_alignParentRight="true"
194
                android:layout_marginRight="15dp"
195
                android:text="--"
196
                android:textColor="@color/ui_68"
197
                android:textSize="14sp" />
198
199
        </RelativeLayout>
200
201
        <RelativeLayout
202
            android:layout_width="match_parent"
203
            android:layout_height="wrap_content"
204
            android:layout_marginTop="13dp">
205
206
            <TextView
207
                android:layout_width="wrap_content"
208
                android:layout_height="wrap_content"
209
                android:layout_alignParentLeft="true"
210
                android:layout_marginLeft="15dp"
211
                android:text="充电时长"
212
                android:textColor="@color/ui_68"
213
                android:textSize="14sp" />
214
215
            <TextView
216
                android:id="@+id/tv_charging_time"
217
                android:layout_width="wrap_content"
218
                android:layout_height="wrap_content"
219
                android:layout_alignParentRight="true"
220
                android:layout_marginRight="15dp"
221
                android:text="--"
222
                android:textColor="@color/ui_68"
223
                android:textSize="14sp" />
224
225
        </RelativeLayout>
226
227
        <RelativeLayout
228
            android:layout_width="match_parent"
229
            android:layout_height="wrap_content"
230
            android:layout_marginTop="13dp">
231
232
            <TextView
233
                android:layout_width="wrap_content"
234
                android:layout_height="wrap_content"
235
                android:layout_alignParentLeft="true"
236
                android:layout_marginLeft="15dp"
237
                android:text="充电度数"
238
                android:textColor="@color/ui_68"
239
                android:textSize="14sp" />
240
241
            <TextView
242
                android:id="@+id/tv_charging_liang"
243
                android:layout_width="wrap_content"
244
                android:layout_height="wrap_content"
245
                android:layout_alignParentRight="true"
246
                android:layout_marginRight="15dp"
247
                android:text="--"
248
                android:textColor="@color/ui_68"
249
                android:textSize="14sp" />
250
251
        </RelativeLayout>
252
253
        <RelativeLayout
254
            android:id="@+id/rl_end_info"
255
            android:layout_width="match_parent"
256
            android:layout_height="wrap_content"
257
            android:layout_marginTop="13dp">
258
259
            <TextView
260
                android:layout_width="wrap_content"
261
                android:layout_height="wrap_content"
262
                android:layout_alignParentLeft="true"
263
                android:layout_marginLeft="15dp"
264
                android:text="结束原因"
265
                android:textColor="@color/ui_68"
266
                android:textSize="14sp" />
267
268
            <TextView
269
                android:id="@+id/tv_tishi"
270
                android:layout_width="wrap_content"
271
                android:layout_height="wrap_content"
272
                android:layout_alignParentRight="true"
273
                android:layout_marginRight="15dp"
274
                android:text="--"
275
                android:textColor="@color/ui_68"
276
                android:textSize="14sp" />
277
278
        </RelativeLayout>
279
    </LinearLayout>
280
281
    <TextView
282
        android:layout_centerHorizontal="true"
283
        android:layout_above="@+id/tv_gocomment"
284
        android:layout_width="wrap_content"
285
        android:layout_height="wrap_content"
286
        android:text="注:结束充电半小时没有提交结算订单系统默认按最大折扣结算"
287
        android:textColor="#ff707070"
288
        android:textSize="12sp"
289
        />
290
291
    <TextView
292
        android:id="@+id/tv_gocomment"
293
        android:layout_width="match_parent"
294
        android:layout_height="39dp"
295
        android:layout_alignParentBottom="true"
296
        android:layout_marginLeft="15dp"
297
        android:layout_marginTop="15dp"
298
        android:layout_marginRight="15dp"
299
        android:layout_marginBottom="7dp"
300
        android:background="@drawable/textview_greenstyle"
301
        android:gravity="center"
302
        android:text="提交订单并结算"
303
        android:textColor="@color/white"
304
        android:textSize="16sp" />
305
306
307
</RelativeLayout>

+ 45 - 0
app/src/main/res/layout/dialog_preferential.xml

@ -0,0 +1,45 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    android:orientation="vertical"
5
    android:background="@drawable/bg_dialog_preferential"
6
    android:layout_height="444dp">
7
8
    <TextView
9
        android:layout_marginBottom="15dp"
10
        android:layout_marginTop="20dp"
11
        android:layout_gravity="center_horizontal"
12
        android:layout_width="wrap_content"
13
        android:layout_height="wrap_content"
14
        android:text="优惠类型"
15
        android:textColor="#ff0e0e0e"
16
        android:textSize="18sp"
17
        />
18
    <androidx.recyclerview.widget.RecyclerView
19
        android:id="@+id/recyclerView"
20
        android:layout_width="match_parent"
21
        android:layout_height="320dp"/>
22
    <TextView
23
        android:visibility="gone"
24
        android:gravity="center"
25
        android:text="暂无优惠券~"
26
        android:textColor="#ff9b9b9b"
27
        android:textSize="18sp"
28
        android:id="@+id/noPreferential"
29
        android:layout_width="match_parent"
30
        android:layout_height="320dp"/>
31
    <TextView
32
        android:id="@+id/complete"
33
        android:layout_width="match_parent"
34
        android:layout_height="39dp"
35
        android:layout_marginLeft="12dp"
36
        android:layout_marginTop="15dp"
37
        android:layout_marginRight="12dp"
38
        android:layout_marginBottom="7dp"
39
        android:background="@drawable/textview_greenstyle"
40
        android:gravity="center"
41
        android:text="完成"
42
        android:textColor="@color/white"
43
        android:textSize="16sp" />
44
45
</LinearLayout>

+ 26 - 0
app/src/main/res/layout/item_text_checkbox.xml

@ -0,0 +1,26 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    android:padding="10dp"
5
    android:layout_height="wrap_content">
6
7
    <TextView
8
        android:layout_gravity="center"
9
        android:id="@+id/name"
10
        android:layout_weight="1"
11
        android:layout_width="0dp"
12
        android:layout_height="wrap_content"
13
        android:text="不使用"
14
        android:textColor="@color/color_ff333333"
15
        android:textSize="14sp" />
16
    <CheckBox
17
        android:layout_gravity="center"
18
        android:padding="5dp"
19
        style="@style/CustomCheckboxTheme"
20
        android:src="@drawable/ic_no_check"
21
        android:id="@+id/checkBox"
22
        android:layout_width="wrap_content"
23
        android:layout_height="wrap_content"
24
      />
25
26
</LinearLayout>

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

@ -198,6 +198,7 @@
198 198
    <color name="sv_white">#FFFFFF</color>
199 199
    <color name="color_3ec34c">#3EC34C</color>
200 200
    <color name="color_f08f4b">#F08F4B</color>
201
    <color name="color_ff333333">#ff333333</color>
201 202

202 203

203 204


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

@ -366,4 +366,15 @@
366 366
        <attr name="drawableBottomWidth" format="dimension" />
367 367
        <attr name="drawableBottomHeight" format="dimension" />
368 368
    </declare-styleable>
369

370
    <style name="TransparentVideoDialogFragmentTheme" parent="Theme.Design.Light.BottomSheetDialog">
371
        <item name="bottomSheetStyle">@style/CustomBottomSheetDialogFragmentStyle</item>
372

373
    </style>
374
    <style name="CustomBottomSheetDialogFragmentStyle" parent="Widget.Design.BottomSheet.Modal">
375
        <item name="android:background">@android:color/transparent</item>
376
    </style>
377
    <style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
378
        <item name="android:button">@drawable/checkbox_style</item>
379
    </style>
369 380
</resources>

话题详情开发 · d55e574519 - Gogs: Go Git Service
瀏覽代碼

话题详情开发

huyuguo 6 年之前
父節點
當前提交
d55e574519

+ 34 - 1
app/src/main/java/com/electric/chargingpile/activity/TopicDetailActivity.java

@ -3,22 +3,55 @@ package com.electric.chargingpile.activity;
3 3
import android.os.Bundle;
4 4
import android.support.annotation.Nullable;
5 5
import android.support.v7.app.AppCompatActivity;
6
import android.support.v7.widget.RecyclerView;
6 7
import android.view.View;
8
import android.widget.TextView;
9
10
import com.andview.refreshview.XRefreshView;
7 11
import com.electric.chargingpile.R;
8 12
9 13
/**
10 14
 * @desc 话题详情
11 15
 */
12 16
public class TopicDetailActivity extends AppCompatActivity implements View.OnClickListener {
17
18
    private TextView titleTextView;
19
    private XRefreshView xRefreshView;
20
    private RecyclerView recyclerView;
21
13 22
    @Override
14 23
    protected void onCreate(@Nullable Bundle savedInstanceState) {
15 24
        super.onCreate(savedInstanceState);
16
        setContentView(R.layout.activity_topic_details_info);
25
        setContentView(R.layout.activity_topic_detail);
26
        initView();
27
        initListener();
28
    }
29
30
    private void initView() {
31
        titleTextView = findViewById(R.id.titleTextView);
32
        xRefreshView = findViewById(R.id.xRefreshView);
33
        recyclerView = findViewById(R.id.recyclerView);
17 34
    }
18 35
36
    private void initListener() {
37
        findViewById(R.id.backImageView).setOnClickListener(this);
38
        findViewById(R.id.shareTextView).setOnClickListener(this);
39
    }
19 40
20 41
    @Override
21 42
    public void onClick(View view) {
43
        switch (view.getId()) {
44
            case R.id.backImageView:
45
                finish();
46
                break;
47
            case R.id.shareTextView:
48
                shareInfo();
49
                break;
50
        }
51
52
    }
22 53
54
    private void shareInfo() {
55
        // TODO by huyuguo share information
23 56
    }
24 57
}

+ 111 - 0
app/src/main/java/com/electric/chargingpile/adapter/TopicDetailAdapter.java

@ -0,0 +1,111 @@
1
package com.electric.chargingpile.adapter;
2
3
import android.content.Context;
4
import android.support.v7.widget.RecyclerView;
5
import android.view.LayoutInflater;
6
import android.view.View;
7
import android.view.ViewGroup;
8
import android.widget.ArrayAdapter;
9
10
import com.aspsine.irecyclerview.IViewHolder;
11
import com.electric.chargingpile.R;
12
import com.electric.chargingpile.data.ChatRecommendBean;
13
import com.electric.chargingpile.data.TopicDetailBeanLab;
14
15
import java.util.ArrayList;
16
17
public class TopicDetailAdapter extends RecyclerView.Adapter<IViewHolder> {
18
    public static final int TOPIC_DETAIL_HEADER = 1;
19
    public static final int TOPIC_DETAIL_CONTENT = 2;
20
    private Context context;
21
    private LayoutInflater layoutInflater;
22
    private final TopicDetailBeanLab beanLab;
23
    private ChatRecommendBean topicDetailBean;
24
25
    public TopicDetailAdapter(Context context) {
26
        this.context = context;
27
        this.layoutInflater = LayoutInflater.from(context);
28
        beanLab = TopicDetailBeanLab.get(context);
29
    }
30
31
    @Override
32
    public IViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
33
        View itemView = null;
34
        IViewHolder viewHolder = null;
35
        switch (viewType) {
36
            case TOPIC_DETAIL_HEADER:
37
                itemView = layoutInflater.inflate(R.layout.activity_topic_detail_header, parent, false);
38
                viewHolder = new HeaderViewHolder(itemView);
39
                break;
40
            case TOPIC_DETAIL_CONTENT:
41
                itemView = layoutInflater.inflate(R.layout.activity_chat_content, parent, false);
42
                viewHolder = new ContentViewHolder(itemView);
43
                break;
44
        }
45
        return viewHolder;
46
    }
47
48
    @Override
49
    public void onBindViewHolder(IViewHolder viewHolder, int position) {
50
        switch (viewHolder.getItemViewType()) {
51
            case TOPIC_DETAIL_HEADER:
52
                bindHeaderViewHolder(viewHolder, position);
53
                break;
54
            case TOPIC_DETAIL_CONTENT:
55
                bindContentViewHolder(viewHolder, position);
56
                break;
57
        }
58
    }
59
60
    @Override
61
    public int getItemCount() {
62
        return beanLab.beans().size() + 1;
63
    }
64
65
    @Override
66
    public int getItemViewType(int position) {
67
        return position == 0 ? TOPIC_DETAIL_HEADER : TOPIC_DETAIL_CONTENT;
68
    }
69
70
    private void bindHeaderViewHolder(IViewHolder viewHolder, int position) {
71
        HeaderViewHolder headerViewHolder = (HeaderViewHolder)viewHolder;
72
73
    }
74
75
    private void bindContentViewHolder(IViewHolder viewHolder, int position) {
76
77
    }
78
79
    public void setContentData(ArrayList<ChatRecommendBean> beans) {
80
        beanLab.clear();
81
        beanLab.add(beans);
82
        notifyDataSetChanged();
83
    }
84
85
    public void addContentData(ArrayList<ChatRecommendBean> beans) {
86
        int startSize = beanLab.beans().size();
87
        beanLab.add(beans);
88
        int endSize = beanLab.beans().size();
89
        notifyItemRangeChanged(startSize, endSize);
90
    }
91
92
    public void setHeaderData(ChatRecommendBean bean) {
93
        topicDetailBean = bean;
94
    }
95
96
    class HeaderViewHolder extends IViewHolder {
97
        public HeaderViewHolder(View itemView) {
98
            super(itemView);
99
        }
100
101
    }
102
103
    class ContentViewHolder extends IViewHolder {
104
105
        public ContentViewHolder(View itemView) {
106
            super(itemView);
107
        }
108
    }
109
110
111
}

+ 45 - 0
app/src/main/java/com/electric/chargingpile/data/TopicDetailBeanLab.java

@ -0,0 +1,45 @@
1
package com.electric.chargingpile.data;
2
3
import android.content.Context;
4
5
import java.util.ArrayList;
6
import java.util.List;
7
8
public class TopicDetailBeanLab {
9
    private static TopicDetailBeanLab topicDetailBeanLab;
10
    private List<ChatRecommendBean> beans;
11
12
    public static TopicDetailBeanLab get(Context context) {
13
        if (topicDetailBeanLab == null) {
14
            topicDetailBeanLab = new TopicDetailBeanLab(context);
15
        }
16
17
        return topicDetailBeanLab;
18
    }
19
20
    private TopicDetailBeanLab(Context context) {
21
        beans = new ArrayList<>();
22
    }
23
24
    public List<ChatRecommendBean> beans() {
25
        return beans;
26
    }
27
28
    public ChatRecommendBean bean(int topicId) {
29
        for (ChatRecommendBean bean : beans) {
30
            if (bean.topicId == topicId) {
31
                return bean;
32
            }
33
        }
34
        return null;
35
    }
36
37
    public void clear() {
38
        beans.clear();
39
    }
40
41
42
    public void add(List<ChatRecommendBean> list) {
43
        beans.addAll(list);
44
    }
45
}

二進制
app/src/main/res/drawable-hdpi/app_publish_item_qa.png


二進制
app/src/main/res/drawable-hdpi/chat_publish_tips.png


二進制
app/src/main/res/drawable-hdpi/提问.png


app/src/main/res/drawable-mdpi/提问.png → app/src/main/res/drawable-mdpi/app_publish_item_qa.png


二進制
app/src/main/res/drawable-mdpi/chat_publish_tips.png


app/src/main/res/drawable-xhdpi/提问.png → app/src/main/res/drawable-xhdpi/app_publish_item_qa.png


二進制
app/src/main/res/drawable-xhdpi/chat_publish_tips.png


app/src/main/res/drawable-xxhdpi/提问.png → app/src/main/res/drawable-xxhdpi/app_publish_item_qa.png


二進制
app/src/main/res/drawable-xxhdpi/chat_publish_tips.png


app/src/main/res/drawable-xxxhdpi/提问.png → app/src/main/res/drawable-xxxhdpi/app_publish_item_qa.png


app/src/main/res/drawable-xxxhdpi/发布.png → app/src/main/res/drawable-xxxhdpi/chat_publish_icon.png


二進制
app/src/main/res/drawable-xxxhdpi/chat_publish_tips.png


+ 6 - 0
app/src/main/res/layout/activity_chat_content.xml

@ -0,0 +1,6 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<android.support.constraint.ConstraintLayout
3
    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
4
    android:layout_height="match_parent">
5
6
</android.support.constraint.ConstraintLayout>

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

@ -0,0 +1,100 @@
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="match_parent"
7
    android:background="#f4f4f4"
8
    tools:context=".activity.TopicDetailActivity">
9
10
    <android.support.constraint.ConstraintLayout
11
        android:id="@+id/navBar"
12
        android:layout_width="0dp"
13
        android:layout_height="44dp"
14
        app:layout_constraintEnd_toEndOf="parent"
15
        app:layout_constraintStart_toStartOf="parent"
16
        app:layout_constraintTop_toTopOf="parent">
17
18
        <ImageView
19
            android:id="@+id/backImageView"
20
            android:layout_width="wrap_content"
21
            android:layout_height="wrap_content"
22
            android:paddingLeft="16dp"
23
            android:paddingTop="5dp"
24
            android:paddingRight="16dp"
25
            android:paddingBottom="5dp"
26
            app:layout_constraintBottom_toBottomOf="parent"
27
            app:layout_constraintStart_toStartOf="parent"
28
            app:layout_constraintTop_toTopOf="parent"
29
            app:srcCompat="@drawable/icon_lvback1119" />
30
31
        <TextView
32
            android:id="@+id/shareTextView"
33
            android:layout_width="wrap_content"
34
            android:layout_height="0dp"
35
            android:gravity="center"
36
            android:paddingLeft="16dp"
37
            android:paddingRight="16dp"
38
            android:text="分享"
39
            android:textColor="#222222"
40
            android:textSize="15sp"
41
            app:layout_constraintBottom_toBottomOf="parent"
42
            app:layout_constraintEnd_toEndOf="parent"
43
            app:layout_constraintTop_toTopOf="parent" />
44
45
        <TextView
46
            android:id="@+id/titleTextView"
47
            android:layout_width="wrap_content"
48
            android:layout_height="0dp"
49
            android:layout_marginStart="8dp"
50
            android:layout_marginEnd="8dp"
51
            android:gravity="center"
52
            android:textColor="#222222"
53
            android:textSize="17sp"
54
            android:textStyle="bold"
55
            app:layout_constraintBottom_toBottomOf="parent"
56
            app:layout_constraintEnd_toStartOf="@+id/shareTextView"
57
            app:layout_constraintStart_toEndOf="@+id/backImageView"
58
            app:layout_constraintTop_toTopOf="parent"
59
            tools:text="TextView" />
60
    </android.support.constraint.ConstraintLayout>
61
62
    <com.andview.refreshview.XRefreshView
63
        android:id="@+id/xRefreshView"
64
        android:layout_width="0dp"
65
        android:layout_height="0dp"
66
        app:layout_constraintBottom_toBottomOf="parent"
67
        app:layout_constraintEnd_toEndOf="parent"
68
        app:layout_constraintStart_toStartOf="parent"
69
        app:layout_constraintTop_toBottomOf="@+id/navBar">
70
71
        <android.support.v7.widget.RecyclerView
72
            android:id="@+id/recyclerView"
73
            android:layout_width="match_parent"
74
            android:layout_height="match_parent"
75
            android:scrollbars="vertical" />
76
77
    </com.andview.refreshview.XRefreshView>
78
79
    <ImageView
80
        android:id="@+id/chatPublishIcon"
81
        android:layout_width="wrap_content"
82
        android:layout_height="wrap_content"
83
        android:layout_marginRight="20dp"
84
        android:layout_marginBottom="30dp"
85
        android:src="@drawable/chat_publish_icon"
86
        app:layout_constraintBottom_toBottomOf="parent"
87
        app:layout_constraintRight_toRightOf="parent" />
88
89
    <ImageView
90
        android:id="@+id/chatPublishTips"
91
        android:layout_width="wrap_content"
92
        android:layout_height="wrap_content"
93
        android:layout_marginRight="5dp"
94
        android:src="@drawable/chat_publish_tips"
95
        app:layout_constraintBottom_toBottomOf="@+id/chatPublishIcon"
96
        app:layout_constraintRight_toLeftOf="@+id/chatPublishIcon"
97
        app:layout_constraintTop_toTopOf="@+id/chatPublishIcon" />
98
99
100
</android.support.constraint.ConstraintLayout>

+ 119 - 0
app/src/main/res/layout/activity_topic_detail_header.xml

@ -0,0 +1,119 @@
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="260dp">
7
8
    <android.support.constraint.ConstraintLayout
9
        android:layout_width="0dp"
10
        android:layout_height="200dp"
11
        android:background="#ffffff"
12
        app:layout_constraintEnd_toEndOf="parent"
13
        app:layout_constraintStart_toStartOf="parent"
14
        app:layout_constraintTop_toTopOf="parent">
15
16
        <ImageView
17
            android:id="@+id/headImage"
18
            android:layout_width="71dp"
19
            android:layout_height="60dp"
20
            android:layout_marginStart="15dp"
21
            android:layout_marginTop="15dp"
22
            app:layout_constraintStart_toStartOf="parent"
23
            app:layout_constraintTop_toTopOf="parent"
24
            tools:srcCompat="@tools:sample/avatars" />
25
26
        <TextView
27
            android:id="@+id/title"
28
            android:layout_width="0dp"
29
            android:layout_height="0dp"
30
            android:layout_marginStart="5dp"
31
            android:layout_marginTop="5dp"
32
            android:layout_marginEnd="15dp"
33
            android:layout_marginBottom="5dp"
34
            android:gravity="center_vertical"
35
            android:maxLines="2"
36
            android:textColor="#222222"
37
            android:textSize="17sp"
38
            android:textStyle="bold"
39
            app:layout_constraintBottom_toBottomOf="@+id/headImage"
40
            app:layout_constraintEnd_toEndOf="parent"
41
            app:layout_constraintStart_toEndOf="@+id/headImage"
42
            app:layout_constraintTop_toTopOf="@+id/headImage"
43
            tools:text="#车主说车#" />
44
45
        <TextView
46
            android:id="@+id/desc"
47
            android:layout_width="0dp"
48
            android:layout_height="wrap_content"
49
            android:layout_marginStart="15dp"
50
            android:layout_marginTop="15dp"
51
            android:layout_marginEnd="15dp"
52
            android:maxLines="3"
53
            android:textColor="#555555"
54
            android:textSize="15sp"
55
            app:layout_constraintEnd_toEndOf="parent"
56
            app:layout_constraintStart_toStartOf="parent"
57
            app:layout_constraintTop_toBottomOf="@+id/headImage"
58
            tools:text="电动小汽车,炫13.98万元起,魅15.98万元起,太值了!NEDC综合续航510km" />
59
60
        <TextView
61
            android:id="@+id/readLabel"
62
            android:layout_width="wrap_content"
63
            android:layout_height="wrap_content"
64
            android:layout_marginStart="15dp"
65
            android:layout_marginBottom="14dp"
66
            android:text="阅读"
67
            android:textColor="#555555"
68
            android:textSize="12sp"
69
            app:layout_constraintBottom_toBottomOf="parent"
70
            app:layout_constraintStart_toStartOf="parent" />
71
72
        <TextView
73
            android:id="@+id/readTextView"
74
            android:layout_width="wrap_content"
75
            android:layout_height="wrap_content"
76
            android:layout_marginStart="5dp"
77
            android:gravity="center_vertical"
78
            android:textSize="12sp"
79
            app:layout_constraintBottom_toBottomOf="@+id/readLabel"
80
            app:layout_constraintLeft_toRightOf="@+id/readLabel"
81
            app:layout_constraintTop_toTopOf="@+id/readLabel"
82
            tools:text="8" />
83
84
        <TextView
85
            android:id="@+id/joinLabel"
86
            android:layout_width="wrap_content"
87
            android:layout_height="wrap_content"
88
            android:layout_marginStart="30dp"
89
            android:gravity="center_vertical"
90
            android:text="参与"
91
            android:textColor="#555555"
92
            android:textSize="12sp"
93
            app:layout_constraintBottom_toBottomOf="@+id/readTextView"
94
            app:layout_constraintStart_toEndOf="@+id/readTextView"
95
            app:layout_constraintTop_toTopOf="@+id/readTextView" />
96
97
        <TextView
98
            android:id="@+id/joinTextView"
99
            android:layout_width="wrap_content"
100
            android:layout_height="wrap_content"
101
            android:layout_marginStart="5dp"
102
            android:gravity="center_vertical"
103
            android:text="32"
104
            android:textColor="#555555"
105
            android:textSize="12sp"
106
            app:layout_constraintBottom_toBottomOf="@+id/joinLabel"
107
            app:layout_constraintStart_toEndOf="@+id/joinLabel"
108
            app:layout_constraintTop_toTopOf="@+id/joinLabel" />
109
    </android.support.constraint.ConstraintLayout>
110
111
    <LinearLayout
112
        android:layout_width="0dp"
113
        android:layout_height="50dp"
114
        android:background="#ff00ff"
115
        android:orientation="horizontal"
116
        app:layout_constraintBottom_toBottomOf="parent"
117
        app:layout_constraintEnd_toEndOf="parent"
118
        app:layout_constraintStart_toStartOf="parent"></LinearLayout>
119
</android.support.constraint.ConstraintLayout>

+ 0 - 19
app/src/main/res/layout/activity_topic_details_info.xml

@ -1,19 +0,0 @@
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="match_parent"
7
    tools:context=".activity.TopicDetailActivity">
8
9
    <com.andview.refreshview.XRefreshView
10
        android:layout_width="0dp"
11
        android:layout_height="0dp"
12
        app:layout_constraintBottom_toBottomOf="parent"
13
        app:layout_constraintEnd_toEndOf="parent"
14
        app:layout_constraintStart_toStartOf="parent"
15
        app:layout_constraintTop_toTopOf="parent">
16
17
    </com.andview.refreshview.XRefreshView>
18
19
</android.support.constraint.ConstraintLayout>