Quellcode durchsuchen

红包功能开发完成

huyuguo vor 4 Jahren
Ursprung
Commit
6192d368be

+ 9 - 6
app/src/main/java/com/electric/chargingpile/activity/ChargingCommentActivity.java

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

+ 2 - 10
app/src/main/java/com/electric/chargingpile/activity/UserCenterActivity.java

@ -993,16 +993,8 @@ public class UserCenterActivity extends Activity implements View.OnClickListener
993 993
                break;
994 994
995 995
            case R.id.rl_offline_upload:
996
                //startActivity(new Intent(getApplication(), OfflineMapActivity.class));
997
                //MobclickAgent.onEvent(getApplicationContext(), "0816");
998
999
                // TODO by hyg
1000
                Intent intentx = new Intent(getApplicationContext(), ChargingCommentActivity.class);
1001
                intentx.putExtra("zhan_id", "1101050425");
1002
                intentx.putExtra("order_id", "344275980202005131001348381");
1003
                intentx.putExtra("zhuang_id", "1101050425602");
1004
                startActivity(intentx);
1005
996
                startActivity(new Intent(getApplication(), OfflineMapActivity.class));
997
                MobclickAgent.onEvent(getApplicationContext(), "0816");
1006 998
                break;
1007 999
1008 1000
            case R.id.chat_share_bar: // 聊聊入口

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

@ -11,6 +11,7 @@ import android.widget.LinearLayout;
11 11
import android.widget.TextView;
12 12
13 13
import com.electric.chargingpile.R;
14
import com.mabeijianxi.smallvideorecord2.DeviceUtils;
14 15
15 16
/**
16 17
 * Created by demon on 2017/5/25.
@ -19,7 +20,6 @@ import com.electric.chargingpile.R;
19 20
public class HongBaoResultDialog {
20 21
    private Context context;
21 22
    private android.app.Dialog dialog;
22
    private Display display;
23 23
    private ImageView dialog_close;
24 24
    private LinearLayout dialog_bg;
25 25
@ -27,7 +27,6 @@ public class HongBaoResultDialog {
27 27
        this.context = context;
28 28
        WindowManager windowManager = (WindowManager) context
29 29
                .getSystemService(Context.WINDOW_SERVICE);
30
        display = windowManager.getDefaultDisplay();
31 30
    }
32 31
33 32
    public HongBaoResultDialog builder() {
@ -44,8 +43,7 @@ public class HongBaoResultDialog {
44 43
        dialog.setContentView(view);
45 44
46 45
        // 调整dialog背景大小
47
        dialog_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
48
                .getWidth() * 0.85), LinearLayout.LayoutParams.WRAP_CONTENT));
46
        dialog_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (DeviceUtils.getScreenWidth(context) * 0.85), LinearLayout.LayoutParams.WRAP_CONTENT));
49 47
50 48
        return this;
51 49
    }
@ -56,7 +54,9 @@ public class HongBaoResultDialog {
56 54
        return this;
57 55
    }
58 56
59
    public void show() {
57
    public void show(String redMoney) {
58
        TextView red_money = dialog.findViewById(R.id.red_money);
59
        red_money.setText(redMoney );
60 60
        dialog_close.setOnClickListener(new View.OnClickListener() {
61 61
            @Override
62 62
            public void onClick(View view) {

+ 55 - 3
app/src/main/res/layout/dialog_hongbao_result.xml

@ -1,11 +1,12 @@
1 1
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
    xmlns:app="http://schemas.android.com/apk/res-auto"
2 3
    xmlns:tools="http://schemas.android.com/tools"
3 4
    android:id="@+id/dialog_bg"
4 5
    android:layout_width="match_parent"
5 6
    android:layout_height="match_parent"
6 7
    android:orientation="vertical">
7 8
8
    <LinearLayout
9
    <android.support.constraint.ConstraintLayout
9 10
        android:id="@+id/dialog_layout"
10 11
        android:layout_width="290dp"
11 12
        android:layout_height="290dp"
@ -16,8 +17,59 @@
16 17
        <ImageView
17 18
            android:layout_width="wrap_content"
18 19
            android:layout_height="wrap_content"
19
            android:src="@drawable/icon_hongbao_result" />
20
    </LinearLayout>
20
            android:src="@drawable/icon_hongbao_result"
21
            app:layout_constraintBottom_toBottomOf="parent"
22
            app:layout_constraintLeft_toLeftOf="parent"
23
            app:layout_constraintRight_toRightOf="parent"
24
            app:layout_constraintTop_toTopOf="parent" />
25
26
        <LinearLayout
27
            android:layout_marginBottom="60dp"
28
            android:layout_width="match_parent"
29
            android:layout_height="wrap_content"
30
            android:gravity="center"
31
            android:orientation="vertical"
32
            app:layout_constraintBottom_toBottomOf="parent"
33
            app:layout_constraintLeft_toLeftOf="parent"
34
            app:layout_constraintRight_toRightOf="parent">
35
36
            <LinearLayout
37
                android:layout_width="wrap_content"
38
                android:layout_height="wrap_content"
39
                android:gravity="center_horizontal|bottom">
40
41
                <TextView
42
                    android:id="@+id/red_money"
43
                    android:layout_width="wrap_content"
44
                    android:layout_height="wrap_content"
45
                    tools:text="3"
46
                    android:textColor="#FFFADD"
47
                    android:textSize="30sp" />
48
49
                <TextView
50
                    android:layout_width="wrap_content"
51
                    android:layout_height="wrap_content"
52
                    android:text="元"
53
                    android:textColor="#FFFADD"
54
                    android:textSize="12sp" />
55
            </LinearLayout>
56
57
            <TextView
58
                android:layout_width="wrap_content"
59
                android:layout_height="wrap_content"
60
                android:text="充电分享红包"
61
                android:textColor="#FFFADD"
62
                android:textSize="20sp" />
63
64
            <TextView
65
                android:layout_width="wrap_content"
66
                android:layout_height="wrap_content"
67
                android:text="充电满10元可抵扣"
68
                android:textColor="#FFFADD"
69
                android:textSize="12sp" />
70
71
        </LinearLayout>
72
    </android.support.constraint.ConstraintLayout>
21 73
22 74
    <ImageView
23 75
        android:id="@+id/dialog_close"