Browse Source

扫码充电图标更新

huyuguo 3 years ago
parent
commit
b967a6bcb0

+ 35 - 26
app/src/main/java/com/electric/chargingpile/activity/NewZhanDetailsActivity.java

399
        addDetailsFragment.setOnUpdateScanChargeFragmentListener(new DetailsFragment.OnDetailsFragmentListener() {
399
        addDetailsFragment.setOnUpdateScanChargeFragmentListener(new DetailsFragment.OnDetailsFragmentListener() {
400
            @Override
400
            @Override
401
            public void updateScanCharge(String ownPay) {
401
            public void updateScanCharge(String ownPay) {
402
                rl_detail_scan.setVisibility("1".equals(ownPay) ? View.VISIBLE : View.GONE);
402
//                rl_detail_scan.setVisibility("1".equals(ownPay) ? View.VISIBLE : View.GONE);
403
            }
404
405
            @Override
406
            public void scanCharge() {
407
                scanChargeFunc();
403
            }
408
            }
404
        });
409
        });
405
        addZhanCommentFragment = new ZhanCommentFragment();
410
        addZhanCommentFragment = new ZhanCommentFragment();
849
                break;
854
                break;
850
855
851
            case R.id.rl_detail_scan:
856
            case R.id.rl_detail_scan:
852
                MobclickAgent.onEvent(getApplicationContext(), "1124");
853
                if (!MainApplication.isLogin()) {
854
                    startActivity(new Intent(getApplication(), LoginActivity.class));
855
                } else if (!cameraTask()) {
856
                    EasyPermissions.requestPermissions(
857
                            this,
858
                            "该功能需要开启摄像头权限,是否前往开启?",
859
                            RC_CAMERA_PERM,
860
                            Manifest.permission.CAMERA);
861
                } else {
862
                    Intent iintent = new Intent(getApplicationContext(), com.google.zxing.client.android.CaptureActivity.class);
863
                    iintent.putExtra("url", MainApplication.url);
864
                    iintent.putExtra("user_id", MainApplication.userId);
865
                    iintent.putExtra("user_password", MainApplication.userPassword);
866
                    iintent.putExtra("user_phone", ProfileManager.getInstance().getUsername(getApplicationContext()));
867
                    LogUtils.e(ProfileManager.getInstance().getUsername(getApplicationContext()));
868
                    iintent.putExtra("cha", MainMapActivity.cha);
869
                    iintent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
870
                    startActivity(iintent);
871
                    overridePendingTransition(0, 0);
872
                    if (count == 1) {
873
                        MobclickAgent.onEvent(getApplicationContext(), "0104");
874
                        count = 2;
875
                    }
876
                }
857
                scanChargeFunc();
877
                break;
858
                break;
878
859
879
            case R.id.iv_share:
860
            case R.id.iv_share:
939
        }
920
        }
940
    }
921
    }
941
922
923
    private void scanChargeFunc() {
924
        MobclickAgent.onEvent(getApplicationContext(), "1124");
925
        if (!MainApplication.isLogin()) {
926
            startActivity(new Intent(getApplication(), LoginActivity.class));
927
        } else if (!cameraTask()) {
928
            EasyPermissions.requestPermissions(
929
                    this,
930
                    "该功能需要开启摄像头权限,是否前往开启?",
931
                    RC_CAMERA_PERM,
932
                    Manifest.permission.CAMERA);
933
        } else {
934
            Intent iintent = new Intent(getApplicationContext(), com.google.zxing.client.android.CaptureActivity.class);
935
            iintent.putExtra("url", MainApplication.url);
936
            iintent.putExtra("user_id", MainApplication.userId);
937
            iintent.putExtra("user_password", MainApplication.userPassword);
938
            iintent.putExtra("user_phone", ProfileManager.getInstance().getUsername(getApplicationContext()));
939
            LogUtils.e(ProfileManager.getInstance().getUsername(getApplicationContext()));
940
            iintent.putExtra("cha", MainMapActivity.cha);
941
            iintent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
942
            startActivity(iintent);
943
            overridePendingTransition(0, 0);
944
            if (count == 1) {
945
                MobclickAgent.onEvent(getApplicationContext(), "0104");
946
                count = 2;
947
            }
948
        }
949
    }
950
942
    @AfterPermissionGranted(RC_CAMERA_PERM)
951
    @AfterPermissionGranted(RC_CAMERA_PERM)
943
    public boolean cameraTask() {
952
    public boolean cameraTask() {
944
        if (hasCameraPermission()) {
953
        if (hasCameraPermission()) {

+ 24 - 13
app/src/main/java/com/electric/chargingpile/fragment/DetailsFragment.java

11
import android.os.Bundle;
11
import android.os.Bundle;
12
import android.os.Handler;
12
import android.os.Handler;
13
import android.os.Message;
13
import android.os.Message;
14
15
import androidx.fragment.app.Fragment;
16
17
import android.text.SpannableString;
14
import android.text.SpannableString;
18
import android.text.Spanned;
15
import android.text.Spanned;
19
import android.text.style.ForegroundColorSpan;
16
import android.text.style.ForegroundColorSpan;
25
import android.widget.ImageView;
22
import android.widget.ImageView;
26
import android.widget.LinearLayout;
23
import android.widget.LinearLayout;
27
import android.widget.RelativeLayout;
24
import android.widget.RelativeLayout;
25
import android.widget.Space;
28
import android.widget.TextView;
26
import android.widget.TextView;
29
import android.widget.Toast;
27
import android.widget.Toast;
30
28
29
import androidx.fragment.app.Fragment;
30
31
import com.amap.api.maps.AMapUtils;
31
import com.amap.api.maps.AMapUtils;
32
import com.amap.api.maps.model.LatLng;
32
import com.amap.api.maps.model.LatLng;
33
import com.electric.chargingpile.R;
33
import com.electric.chargingpile.R;
44
import com.electric.chargingpile.data.PileData;
44
import com.electric.chargingpile.data.PileData;
45
import com.electric.chargingpile.data.RankinglistRefreshEvent;
45
import com.electric.chargingpile.data.RankinglistRefreshEvent;
46
import com.electric.chargingpile.data.Zhan;
46
import com.electric.chargingpile.data.Zhan;
47
import com.electric.chargingpile.util.CommonParams;
48
import com.electric.chargingpile.util.DES;
47
import com.electric.chargingpile.util.DES;
49
import com.electric.chargingpile.util.DES3;
48
import com.electric.chargingpile.util.DES3;
50
import com.electric.chargingpile.util.DES3S;
49
import com.electric.chargingpile.util.DES3S;
51
import com.electric.chargingpile.util.DateUtils;
52
import com.electric.chargingpile.util.JsonUtils;
50
import com.electric.chargingpile.util.JsonUtils;
53
import com.electric.chargingpile.util.LoadingDialog;
51
import com.electric.chargingpile.util.LoadingDialog;
54
import com.electric.chargingpile.util.Md5Util;
52
import com.electric.chargingpile.util.Md5Util;
55
import com.electric.chargingpile.util.OkHttpUtil;
53
import com.electric.chargingpile.util.OkHttpUtil;
56
import com.electric.chargingpile.util.ToastUtil;
57
import com.electric.chargingpile.util.Util;
54
import com.electric.chargingpile.util.Util;
58
import com.electric.chargingpile.view.CircleImageView;
55
import com.electric.chargingpile.view.CircleImageView;
59
import com.electric.chargingpile.view.CustomProgressDialog;
56
import com.electric.chargingpile.view.CustomProgressDialog;
90
import java.io.InputStreamReader;
87
import java.io.InputStreamReader;
91
import java.io.OutputStreamWriter;
88
import java.io.OutputStreamWriter;
92
import java.io.PrintWriter;
89
import java.io.PrintWriter;
93
import java.math.BigDecimal;
94
import java.net.Socket;
90
import java.net.Socket;
95
import java.net.URLEncoder;
91
import java.net.URLEncoder;
96
import java.security.MessageDigest;
92
import java.security.MessageDigest;
97
import java.text.SimpleDateFormat;
98
import java.util.ArrayList;
93
import java.util.ArrayList;
99
import java.util.Calendar;
94
import java.util.Calendar;
100
import java.util.Date;
101
import java.util.HashMap;
102
import java.util.List;
95
import java.util.List;
103
import java.util.Map;
104
import java.util.regex.Matcher;
96
import java.util.regex.Matcher;
105
import java.util.regex.Pattern;
97
import java.util.regex.Pattern;
106
import java.util.regex.PatternSyntaxException;
98
import java.util.regex.PatternSyntaxException;
269
                        if (detailsFragmentListener != null) {
261
                        if (detailsFragmentListener != null) {
270
                            detailsFragmentListener.updateScanCharge(own_pay);
262
                            detailsFragmentListener.updateScanCharge(own_pay);
271
                        }
263
                        }
264
265
                        if ("1".equals(own_pay)) {
266
                            scan_charge_btn.setVisibility(View.VISIBLE);
267
                            scan_charge_space.setVisibility(View.VISIBLE);
268
                        } else {
269
                            scan_charge_btn.setVisibility(View.GONE);
270
                            scan_charge_space.setVisibility(View.GONE);
271
                        }
272
272
                        String fenshi_info = JsonUtils.getKeyResult(info_decode, "fenshi_info");
273
                        String fenshi_info = JsonUtils.getKeyResult(info_decode, "fenshi_info");
273
                        String fenshi_is = JsonUtils.getKeyResult(info_decode, "fenshi_is");
274
                        String fenshi_is = JsonUtils.getKeyResult(info_decode, "fenshi_is");
274
275
789
        }
790
        }
790
    };
791
    };
791
    private String zongjia;
792
    private String zongjia;
793
    private ImageView scan_charge_btn;
794
    private Space scan_charge_space;
792
795
793
    @Override
796
    @Override
794
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
797
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
891
        detail_zhan_pic = (ImageView) v.findViewById(R.id.detail_zhan_pic);
894
        detail_zhan_pic = (ImageView) v.findViewById(R.id.detail_zhan_pic);
892
895
893
        detail_zhan_name = (AlignTextView) v.findViewById(R.id.detail_zhan_name);
896
        detail_zhan_name = (AlignTextView) v.findViewById(R.id.detail_zhan_name);
894
//        chat_share_bar = v.findViewById(R.id.chat_share_bar);
895
//        chat_share_bar.setOnClickListener(this);
896
        red_paper_bag_top = v.findViewById(R.id.red_paper_bag_top);
897
        red_paper_bag_top = v.findViewById(R.id.red_paper_bag_top);
897
        detail_grade = (TextView) v.findViewById(R.id.detail_grade);
898
        detail_grade = (TextView) v.findViewById(R.id.detail_grade);
898
        detail_picnum = (TextView) v.findViewById(R.id.detail_picnum);
899
        detail_picnum = (TextView) v.findViewById(R.id.detail_picnum);
931
        iv_new_icon = (CircleImageView) v.findViewById(R.id.iv_new_icon);
932
        iv_new_icon = (CircleImageView) v.findViewById(R.id.iv_new_icon);
932
        ll_yunyingshang = (LinearLayout) v.findViewById(R.id.ll_yunyingshang);
933
        ll_yunyingshang = (LinearLayout) v.findViewById(R.id.ll_yunyingshang);
933
        view_789 = v.findViewById(R.id.view_789);
934
        view_789 = v.findViewById(R.id.view_789);
935
        scan_charge_btn = v.findViewById(R.id.scan_charge_btn);
936
        scan_charge_btn.setOnClickListener(this);
937
        scan_charge_space = v.findViewById(R.id.scan_charge_space);
934
    }
938
    }
935
939
936
    @Override
940
    @Override
969
                MobclickAgent.onEvent(getActivity(), "0209");
973
                MobclickAgent.onEvent(getActivity(), "0209");
970
                startActivity(new Intent(getActivity(), ChargingQianDaoActivity.class));
974
                startActivity(new Intent(getActivity(), ChargingQianDaoActivity.class));
971
                break;
975
                break;
976
            case R.id.scan_charge_btn:
977
                if (detailsFragmentListener != null) {
978
                    detailsFragmentListener.scanCharge();
979
                }
980
                break;
972
        }
981
        }
973
    }
982
    }
974
983
1501
1510
1502
    public interface OnDetailsFragmentListener {
1511
    public interface OnDetailsFragmentListener {
1503
        void updateScanCharge(String ownPay);
1512
        void updateScanCharge(String ownPay);
1513
1514
        void scanCharge();
1504
    }
1515
    }
1505
1516
1506
    public void setOnUpdateScanChargeFragmentListener(OnDetailsFragmentListener listener) {
1517
    public void setOnUpdateScanChargeFragmentListener(OnDetailsFragmentListener listener) {

BIN
app/src/main/res/drawable-hdpi/scan_charge_btn.png


BIN
app/src/main/res/drawable-mdpi/scan_charge_btn.png


BIN
app/src/main/res/drawable-xhdpi/scan_charge_btn.png


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


BIN
app/src/main/res/drawable-xxxhdpi/scan_charge_btn.png


+ 18 - 0
app/src/main/res/layout/fragmen_details_new.xml

827
827
828
            </RelativeLayout>
828
            </RelativeLayout>
829
829
830
            <Space
831
                android:id="@+id/scan_charge_space"
832
                android:layout_width="match_parent"
833
                android:layout_height="110dp"
834
                android:visibility="gone"
835
                tools:visibility="visible" />
830
        </LinearLayout>
836
        </LinearLayout>
831
    </com.electric.chargingpile.view.CustomScrollView>
837
    </com.electric.chargingpile.view.CustomScrollView>
838
839
    <ImageView
840
        android:id="@+id/scan_charge_btn"
841
        android:layout_width="wrap_content"
842
        android:layout_height="wrap_content"
843
        android:layout_marginRight="15dp"
844
        android:layout_marginBottom="15dp"
845
        android:src="@drawable/scan_charge_btn"
846
        android:visibility="gone"
847
        app:layout_constraintBottom_toBottomOf="parent"
848
        app:layout_constraintRight_toRightOf="parent"
849
        tools:visibility="visible" />
832
</androidx.constraintlayout.widget.ConstraintLayout>
850
</androidx.constraintlayout.widget.ConstraintLayout>