Sfoglia il codice sorgente

红包需求开发

huyuguo 4 anni fa
parent
commit
e4c98644ca

+ 3 - 1
app/src/main/AndroidManifest.xml

@ -1,5 +1,6 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:tools="http://schemas.android.com/tools"
3 4
    package="com.electric.chargingpile"
4 5
    android:versionCode="88"
5 6
    android:versionName="3.5.0">
@ -11,7 +12,8 @@
11 12
        android:label="@string/app_name"
12 13
        android:largeHeap="true"
13 14
        android:resizeableActivity="true"
14
        android:theme="@style/AppTheme">
15
        android:theme="@style/AppTheme"
16
        tools:ignore="LockedOrientationActivity">
15 17
        <activity
16 18
            android:name=".activity.RecommendChargingStationActivity"
17 19
            android:screenOrientation="portrait"></activity>

+ 31 - 4
app/src/main/java/com/electric/chargingpile/activity/ChargingCommentActivity.java

@ -42,6 +42,7 @@ import android.widget.ScrollView;
42 42
import android.widget.TextView;
43 43
import android.widget.Toast;
44 44
45
import com.blankj.utilcode.util.CacheUtils;
45 46
import com.blankj.utilcode.util.EmptyUtils;
46 47
import com.blankj.utilcode.util.LogUtils;
47 48
import com.electric.chargingpile.R;
@ -63,6 +64,7 @@ import com.electric.chargingpile.util.StatusConstants;
63 64
import com.electric.chargingpile.util.ToastUtil;
64 65
import com.electric.chargingpile.util.UploadUtil;
65 66
import com.electric.chargingpile.view.HongBaoDialog;
67
import com.electric.chargingpile.view.HongBaoResultDialog;
66 68
import com.electric.chargingpile.view.REditText;
67 69
import com.electric.chargingpile.view.RatingBarView;
68 70
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
@ -151,6 +153,7 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
151 153
    private android.view.animation.Animation animation;
152 154
    private ChargingShareBean chargingShareBean;
153 155
    private String isShow = "0";
156
    private HongBaoDialog hongBaoDialog;
154 157
    private static final int RC_ALBUM_PERM = 123;
155 158
    //输入表情前EditText中的文本
156 159
//    private String inputAfterText;
@ -226,6 +229,17 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
226 229
        rl_huodong = (RelativeLayout) findViewById(R.id.rl_huodong);
227 230
        tv_grade = (TextView) findViewById(R.id.tv_grade);
228 231
        tv_huodong = (TextView) findViewById(R.id.tv_huodong);
232
233
        if (MainApplication.level_one.equals("")) {
234
            String levellabel = getResources().getString(R.string.app_level_label);
235
            CacheUtils.getInstance().put("levellabel", levellabel);
236
            MainApplication.level_one = JsonUtils.getKeyResult(levellabel, "1");
237
            MainApplication.level_two = JsonUtils.getKeyResult(levellabel, "2");
238
            MainApplication.level_three = JsonUtils.getKeyResult(levellabel, "3");
239
            MainApplication.level_four = JsonUtils.getKeyResult(levellabel, "4");
240
            MainApplication.level_five = JsonUtils.getKeyResult(levellabel, "5");
241
        }
242
229 243
        if (MainApplication.huodonglabel.equals("")) {
230 244
            tv_huodong.setVisibility(View.GONE);
231 245
        }
@ -869,7 +883,8 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
869 883
                            tv_zhan_name.setText("评价成功");
870 884
                            tv_make_sure.setVisibility(View.GONE);
871 885
                            if ("1".equals(isShow)) {
872
                                new HongBaoDialog(ChargingCommentActivity.this).builder().setCancelable(true).show(new View.OnClickListener() {
886
                                hongBaoDialog = new HongBaoDialog(ChargingCommentActivity.this).builder();
887
                                hongBaoDialog.setCancelable(true).show(new View.OnClickListener() {
873 888
                                    @Override
874 889
                                    public void onClick(View v) {
875 890
                                        showSimpleBottomSheetGrid(chargingShareBean);
@ -886,6 +901,7 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
886 901
    }
887 902
888 903
    private void showSimpleBottomSheetGrid(final ChargingShareBean chargingShareBean) {
904
889 905
        final int TAG_SHARE_WECHAT_FRIEND = 0;
890 906
        final int TAG_SHARE_WECHAT_MOMENT = 1;
891 907
        final int TAG_SHARE_QQ = 2;
@ -911,7 +927,6 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
911 927
                        }
912 928
                    }
913 929
                }).build();
914
//        build.
915 930
        build.show();
916 931
    }
917 932
@ -927,6 +942,15 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
927 942
        platform.setPlatformActionListener(new PlatformActionListener() {
928 943
            @Override
929 944
            public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
945
                try {
946
                    if (hongBaoDialog != null) {
947
                        hongBaoDialog.dismiss();
948
                        hongBaoDialog = null;
949
                    }
950
                } catch (Exception e) {
951
                    e.printStackTrace();
952
                }
953
930 954
                getShareIntegral();
931 955
//                ToastUtil.showToast(getApplicationContext(),"分享成功",Toast.LENGTH_SHORT);
932 956
            }
@ -1432,14 +1456,14 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1432 1456
        OkHttpUtils.get().url(url).build().execute(new StringCallback() {
1433 1457
            @Override
1434 1458
            public void onError(Call call, Exception e) {
1435
1459
                e.printStackTrace();
1436 1460
            }
1437 1461
1438 1462
            @Override
1439 1463
            public void onResponse(String response) {
1440 1464
                LogUtils.e(response);
1441 1465
                String rtnCode = JsonUtils.getKeyResult(response, "rtnCode");
1442
                if ("01".equals(rtnCode)) {
1466
                if ("01".equals(rtnCode)) { // 成功
1443 1467
                    String plusScore = JsonUtils.getKeyResult(response, "plusScore");
1444 1468
                    if (!plusScore.equals("")) {
1445 1469
                        tv_point.setText(plusScore);
@ -1452,6 +1476,9 @@ public class ChargingCommentActivity extends Activity implements View.OnClickLis
1452 1476
                        }, 1500);
1453 1477
                    }
1454 1478
1479
                    String redMoney = JsonUtils.getKeyResult(response, "red_money");
1480
                    System.out.println("dsssssssss");
1481
1455 1482
                } else {
1456 1483
                    ToastUtil.showToast(getApplicationContext(), "分享成功", Toast.LENGTH_SHORT);
1457 1484
                }

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

@ -993,8 +993,16 @@ 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");
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
998 1006
                break;
999 1007
1000 1008
            case R.id.chat_share_bar: // 聊聊入口

+ 12 - 0
app/src/main/java/com/electric/chargingpile/activity/ZhanCommentActivity.java

@ -42,6 +42,7 @@ import android.widget.RelativeLayout;
42 42
import android.widget.TextView;
43 43
import android.widget.Toast;
44 44
45
import com.blankj.utilcode.util.CacheUtils;
45 46
import com.electric.chargingpile.R;
46 47
import com.electric.chargingpile.application.MainApplication;
47 48
import com.electric.chargingpile.data.CommentsBean;
@ -231,6 +232,17 @@ public class ZhanCommentActivity extends Activity implements View.OnClickListene
231 232
        rl_huodong = (RelativeLayout) findViewById(R.id.rl_huodong);
232 233
        tv_grade = (TextView) findViewById(R.id.tv_grade);
233 234
        tv_huodong = (TextView) findViewById(R.id.tv_huodong);
235
236
        if (MainApplication.level_one.equals("")) {
237
            String levellabel = getResources().getString(R.string.app_level_label);
238
            CacheUtils.getInstance().put("levellabel", levellabel);
239
            MainApplication.level_one = JsonUtils.getKeyResult(levellabel, "1");
240
            MainApplication.level_two = JsonUtils.getKeyResult(levellabel, "2");
241
            MainApplication.level_three = JsonUtils.getKeyResult(levellabel, "3");
242
            MainApplication.level_four = JsonUtils.getKeyResult(levellabel, "4");
243
            MainApplication.level_five = JsonUtils.getKeyResult(levellabel, "5");
244
        }
245
234 246
        if (MainApplication.huodonglabel.equals("")) {
235 247
            tv_huodong.setVisibility(View.GONE);
236 248
        }

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

@ -77,8 +77,8 @@ public class MainApplication extends MultiDexApplication {
77 77
    public static String firstPoint = "";
78 78
    public static Boolean firstSsyd;
79 79
    public static String password = "";
80
    public static String url = "http://59.110.68.162";// 充电桩测试环境
81
//        public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
80
//    public static String url = "http://59.110.68.162";// 充电桩测试环境
81
        public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
82 82
//    public static String urlNew = "http://123.56.67.7:83/api/0300";// 一电测试环境
83 83
    public static String urlNew = "https://api.touchev.com:83/api/0300";// 一电正式环境
84 84
    public static String pic_url = "http://cdz.evcharge.cc/zhannew/uploadfile/";

+ 3 - 0
app/src/main/java/com/electric/chargingpile/view/HongBaoDialog.java

@ -83,4 +83,7 @@ public class HongBaoDialog {
83 83
        dialog.show();
84 84
    }
85 85
86
    public void dismiss() {
87
        dialog.dismiss();
88
    }
86 89
}

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

@ -0,0 +1,76 @@
1
package com.electric.chargingpile.view;
2
3
import android.content.Context;
4
import android.view.Display;
5
import android.view.LayoutInflater;
6
import android.view.View;
7
import android.view.WindowManager;
8
import android.widget.FrameLayout;
9
import android.widget.ImageView;
10
import android.widget.LinearLayout;
11
import android.widget.TextView;
12
13
import com.electric.chargingpile.R;
14
15
/**
16
 * Created by demon on 2017/5/25.
17
 */
18
19
public class HongBaoResultDialog {
20
    private Context context;
21
    private android.app.Dialog dialog;
22
    private Display display;
23
    private ImageView dialog_close;
24
    private LinearLayout dialog_bg;
25
26
    public HongBaoResultDialog(Context context) {
27
        this.context = context;
28
        WindowManager windowManager = (WindowManager) context
29
                .getSystemService(Context.WINDOW_SERVICE);
30
        display = windowManager.getDefaultDisplay();
31
    }
32
33
    public HongBaoResultDialog builder() {
34
        // 获取Dialog布局
35
        View view = LayoutInflater.from(context).inflate(
36
                R.layout.dialog_hongbao_result, null);
37
38
        // 获取自定义Dialog布局中的控件
39
        dialog_bg = (LinearLayout) view.findViewById(R.id.dialog_bg);
40
        dialog_close = (ImageView) view.findViewById(R.id.dialog_close);
41
42
        // 定义Dialog布局和参数
43
        dialog = new android.app.Dialog(context, R.style.AlertDialogStyle);
44
        dialog.setContentView(view);
45
46
        // 调整dialog背景大小
47
        dialog_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
48
                .getWidth() * 0.85), LinearLayout.LayoutParams.WRAP_CONTENT));
49
50
        return this;
51
    }
52
53
    public HongBaoResultDialog setCancelable(boolean cancel) {
54
        dialog.setCancelable(cancel);
55
        dialog.setCanceledOnTouchOutside(cancel);
56
        return this;
57
    }
58
59
    public void show() {
60
        dialog_close.setOnClickListener(new View.OnClickListener() {
61
            @Override
62
            public void onClick(View view) {
63
                try {
64
                    dialog.dismiss();
65
                } catch (Exception e) {
66
                    e.printStackTrace();
67
                }
68
            }
69
        });
70
        dialog.show();
71
    }
72
73
    public void dismiss() {
74
        dialog.dismiss();
75
    }
76
}

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


+ 3 - 11
app/src/main/res/layout/activity_charging_comment.xml

@ -145,14 +145,13 @@
145 145
                android:layout_height="wrap_content">
146 146
147 147
                <TextView
148
                    android:id="@+id/tv_huodong"
148 149
                    android:layout_width="wrap_content"
149 150
                    android:layout_height="wrap_content"
150
                    android:layout_centerVertical="true"
151
                    android:textColor="@color/ui_62"
152
                    android:textSize="14sp"
153 151
                    android:layout_marginLeft="15dp"
154 152
                    android:text="活动标签"
155
                    android:id="@+id/tv_huodong"/>
153
                    android:textColor="@color/ui_62"
154
                    android:textSize="14sp" />
156 155
157 156
                <com.zhy.view.flowlayout.TagFlowLayout
158 157
                    android:id="@+id/id_flowlayout_activity"
@ -300,11 +299,4 @@
300 299
301 300
    </RelativeLayout>
302 301
303
304
305
306
307
308
309
310 302
</com.zhy.autolayout.AutoRelativeLayout>

+ 14 - 5
app/src/main/res/layout/dialog_hongbao.xml

@ -17,19 +17,28 @@
17 17
            android:layout_gravity="center_horizontal"
18 18
            android:textSize="18sp"
19 19
            android:textColor="@color/ui_62"
20
            android:text="恭喜您获得红包!"
20
            android:text="分享领红包"
21 21
            android:layout_marginTop="45dp"/>
22 22
23 23
        <TextView
24 24
            android:layout_width="wrap_content"
25 25
            android:layout_height="wrap_content"
26 26
            android:layout_gravity="center_horizontal"
27
            android:layout_marginTop="10dp"
28
            android:layout_marginBottom="5dp"
27 29
            android:gravity="center_horizontal"
28
            android:textSize="15sp"
30
            android:text="分享红包给其他小伙伴吧"
29 31
            android:textColor="@color/ui_65"
30
            android:text="分享红包给小伙伴一起抢"
31
            android:layout_marginTop="10dp"
32
            android:layout_marginBottom="37dp"/>
32
            android:textSize="15sp" />
33
        <TextView
34
            android:layout_width="wrap_content"
35
            android:layout_height="wrap_content"
36
            android:layout_gravity="center_horizontal"
37
            android:layout_marginBottom="37dp"
38
            android:gravity="center_horizontal"
39
            android:text="分享成功后您可自动领取随机红包哦"
40
            android:textColor="@color/ui_65"
41
            android:textSize="15sp" />
33 42
34 43
        <ImageView
35 44
            android:layout_width="wrap_content"

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

@ -0,0 +1,30 @@
1
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
    xmlns:tools="http://schemas.android.com/tools"
3
    android:id="@+id/dialog_bg"
4
    android:layout_width="match_parent"
5
    android:layout_height="match_parent"
6
    android:orientation="vertical">
7
8
    <LinearLayout
9
        android:id="@+id/dialog_layout"
10
        android:layout_width="290dp"
11
        android:layout_height="290dp"
12
        android:layout_gravity="center_horizontal"
13
        android:gravity="center"
14
        android:orientation="vertical">
15
16
        <ImageView
17
            android:layout_width="wrap_content"
18
            android:layout_height="wrap_content"
19
            android:src="@drawable/icon_hongbao_result" />
20
    </LinearLayout>
21
22
    <ImageView
23
        android:id="@+id/dialog_close"
24
        android:layout_width="wrap_content"
25
        android:layout_height="wrap_content"
26
        android:layout_gravity="center_horizontal"
27
        android:layout_marginTop="44dp"
28
        android:src="@drawable/icon_dialog_close" />
29
30
</LinearLayout>