cancel = view.findViewById(R.id.cancel);
37
        open = view.findViewById(R.id.open);
38
39
        // 定义Dialog布局和参数
40
        dialog = new Dialog(context, R.style.AlertDialogStyle);
41
        dialog.setContentView(view);
42
43
        // 调整dialog背景大小
44
        bgNotLogin.setLayoutParams(new FrameLayout.LayoutParams(
45
                dip2px(context,  268),
46
                dip2px(context, 124)
47
        ));
48
49
        return this;
50
    }
51
52
    public SettleAccountsDialog setContentText(String str){
53
        content.setText(str);
54
        return this;
55
    }
56
    public SettleAccountsDialog setCancelText(String str){
57
        cancel.setText(str);
58
        return this;
59
    }
60
    public SettleAccountsDialog setOpenText(String str){
61
        open.setText(str);
62
        return this;
63
    }
64
65
    public SettleAccountsDialog setCancelable(boolean cancel) {
66
        dialog.setCancelable(cancel);
67
        dialog.setCanceledOnTouchOutside(cancel);
68
        return this;
69
    }
70
71
    public  SettleAccountsDialog setOpenOnClick(final View.OnClickListener listener){
72
        if (open!=null){
73
            open.setOnClickListener(new View.OnClickListener() {
74
                @Override
75
                public void onClick(View v) {
76
                    listener.onClick(v);
77
                    dialog.dismiss();
78
                }
79
            });
80
        }
81
        return this;
82
    }
83
84
    public  SettleAccountsDialog setCancleOnClick(final View.OnClickListener listener){
85
        if (cancel!=null){
86
            cancel.setOnClickListener(new View.OnClickListener() {
87
                @Override
88
                public void onClick(View v) {
89
                    listener.onClick(v);
90
                    dialog.dismiss();
91
                }
92
            });
93
        }
94
95
        return this;
96
    }
97
98
    public void show() {
99
        dialog.show();
100
    }
101
    /**
102
     * 根据手机的分辨率从 dp 的单位 转成为 px(像素)
103
     */
104
    public static int dip2px(Context context, float dpValue) {
105
        final float scale = context.getResources().getDisplayMetrics().density;
106
        return (int) (dpValue * scale + 0.5f);
107
    }
108
}

+ 6 - 0
zxing/src/main/res/drawable/bg_3ec34c_radius20.xml

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

+ 6 - 0
zxing/src/main/res/drawable/bg_ececec_radius20.xml

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

+ 6 - 0
zxing/src/main/res/drawable/bg_while_radius16.xml

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

+ 1 - 0
zxing/src/main/res/layout/capture.xml

@ -310,6 +310,7 @@
310 310
        android:visibility="gone"/>
311 311
312 312
    <RelativeLayout
313
        tools:visibility="visible"
313 314
        android:id="@+id/rl_costWay"
314 315
        android:layout_width="240dp"
315 316
        android:layout_height="32dp"

+ 60 - 0
zxing/src/main/res/layout/dialog_settle_accounts.xml

@ -0,0 +1,60 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:tools="http://schemas.android.com/tools"
4
    xmlns:app="http://schemas.android.com/apk/res-auto"
5
    android:orientation="vertical"
6
    tools:background="#f1f1"
7
    android:id="@+id/bgSettleDialog"
8
    android:layout_width="match_parent"
9
    android:layout_height="match_parent">
10
11
    <RelativeLayout
12
        android:id="@+id/bg_"
13
        android:background="@drawable/bg_while_radius16"
14
        android:layout_gravity="center"
15
        android:layout_width="268dp"
16
        android:layout_height="124dp">
17
        <TextView
18
            android:id="@+id/content"
19
            android:layout_alignParentStart="true"
20
            android:layout_alignParentEnd="true"
21
            android:layout_alignParentTop="true"
22
            android:layout_marginStart="15dp"
23
            android:layout_marginEnd="15sp"
24
            android:layout_marginTop="16dp"
25
            android:layout_width="wrap_content"
26
            android:layout_height="wrap_content"
27
            android:text="您有一笔未结算的订单,请先结算后
28
开启其他订单"
29
            android:textColor="#ff0e0e0e"
30
            android:textSize="14sp"
31
            />
32
       <LinearLayout
33
           android:layout_marginBottom="16dp"
34
           android:layout_alignParentBottom="true"
35
           android:gravity="center"
36
           android:layout_width="match_parent"
37
           android:layout_height="wrap_content">
38
           <TextView
39
               android:textColor="#000000"
40
               android:layout_marginEnd="16dp"
41
               android:id="@+id/cancel"
42
               android:layout_width="110dp"
43
               android:layout_height="40dp"
44
               android:background="@drawable/bg_ececec_radius20"
45
               android:gravity="center"
46
               android:text="取消"
47
               android:textSize="17sp" />
48
           <TextView
49
               android:textColor="#FFFFFF"
50
               android:id="@+id/open"
51
               android:layout_width="110dp"
52
               android:layout_height="40dp"
53
               android:background="@drawable/bg_3ec34c_radius20"
54
               android:gravity="center"
55
               android:text="去结算"
56
               android:textSize="17sp" />
57
       </LinearLayout>
58
    </RelativeLayout>
59
60
</LinearLayout>

代码更新 · e04cd4c39a - Gogs: Go Git Service
Browse Source

代码更新

huyuguo 5 years ago
parent
commit
e04cd4c39a

+ 7 - 5
app/src/main/java/com/electric/chargingpile/activity/ChargingCommentActivity.java

@ -1452,7 +1452,7 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1452 1452
1453 1453
1454 1454
    private void getShareIntegral() {
1455
        String url = MainApplication.url + "/zhannew/basic/web/index.php/member/insert-task?userid=" + MainApplication.userId;
1455
        String url = MainApplication.url + "/zhannew/basic/web/index.php/member/insert-task?userid=" + MainApplication.userId + "&order_id=" + order_id;
1456 1456
        OkHttpUtils.get().url(url).build().execute(new StringCallback() {
1457 1457
            @Override
1458 1458
            public void onError(Call call, Exception e) {
@ -1463,6 +1463,12 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1463 1463
            public void onResponse(String response) {
1464 1464
                LogUtils.e(response);
1465 1465
                String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
1466
                String red_money = JsonUtils.getKeyResult(response, "red_money");
1467
                int redMoney = Integer.valueOf(red_money);
1468
                if (redMoney > 0) {
1469
                    new HongBaoResultDialog(ChargingCommentActivity.this).builder().setCancelable(true).show(redMoney);
1470
                }
1471
1466 1472
                if ("01".equals(rtnCode)) { // 成功
1467 1473
                    String plusScore = JsonUtils.getKeyResult(response, "plusScore");
1468 1474
                    if (!plusScore.equals("")) {
@ -1475,10 +1481,6 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1475 1481
                            }
1476 1482
                        }, 1500);
1477 1483
                    }
1478
1479
                    String redMoney = JsonUtils.getKeyResult(response, "red_money");
1480
                    System.out.println("dsssssssss");
1481
1482 1484
                } else {
1483 1485
                    ToastUtil.showToast(getApplicationContext(), "分享成功", Toast.LENGTH_SHORT);
1484 1486
                }

+ 3 - 1
app/src/main/java/com/electric/chargingpile/view/HongBaoResultDialog.java

@ -56,7 +56,9 @@ public class HongBaoResultDialog {
56 56
        return this;
57 57
    }
58 58
59
    public void show() {
59
    public void show(int redMoney) {
60
        TextView red_money = dialog.findViewById(R.id.red_money);
61
        red_money.setText(redMoney + "元");
60 62
        dialog_close.setOnClickListener(new View.OnClickListener() {
61 63
            @Override
62 64
            public void onClick(View view) {

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

@ -17,8 +17,17 @@
17 17
            android:layout_width="wrap_content"
18 18
            android:layout_height="wrap_content"
19 19
            android:src="@drawable/icon_hongbao_result" />
20
20 21
    </LinearLayout>
21 22
23
    <TextView
24
        android:id="@+id/red_money"
25
        android:layout_width="match_parent"
26
        android:layout_height="wrap_content"
27
        android:textAlignment="center"
28
        android:text=""
29
        android:textColor="@color/red"
30
        android:textSize="40sp" />
22 31
    <ImageView
23 32
        android:id="@+id/dialog_close"
24 33
        android:layout_width="wrap_content"