Quellcode durchsuchen

扫码充电图标更新

huyuguo vor 3 Jahren
Ursprung
Commit
b967a6bcb0

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

@ -399,7 +399,12 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
399 399
        addDetailsFragment.setOnUpdateScanChargeFragmentListener(new DetailsFragment.OnDetailsFragmentListener() {
400 400
            @Override
401 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 410
        addZhanCommentFragment = new ZhanCommentFragment();
@ -849,31 +854,7 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
849 854
                break;
850 855
851 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 858
                break;
878 859
879 860
            case R.id.iv_share:
@ -939,6 +920,34 @@ public class NewZhanDetailsActivity extends AppCompatActivity implements View.On
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 951
    @AfterPermissionGranted(RC_CAMERA_PERM)
943 952
    public boolean cameraTask() {
944 953
        if (hasCameraPermission()) {

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

@ -11,9 +11,6 @@ import android.os.Build;
11 11
import android.os.Bundle;
12 12
import android.os.Handler;
13 13
import android.os.Message;
14
15
import androidx.fragment.app.Fragment;
16
17 14
import android.text.SpannableString;
18 15
import android.text.Spanned;
19 16
import android.text.style.ForegroundColorSpan;
@ -25,9 +22,12 @@ import android.view.ViewTreeObserver;
25 22
import android.widget.ImageView;
26 23
import android.widget.LinearLayout;
27 24
import android.widget.RelativeLayout;
25
import android.widget.Space;
28 26
import android.widget.TextView;
29 27
import android.widget.Toast;
30 28
29
import androidx.fragment.app.Fragment;
30
31 31
import com.amap.api.maps.AMapUtils;
32 32
import com.amap.api.maps.model.LatLng;
33 33
import com.electric.chargingpile.R;
@ -44,16 +44,13 @@ import com.electric.chargingpile.data.MyOtto;
44 44
import com.electric.chargingpile.data.PileData;
45 45
import com.electric.chargingpile.data.RankinglistRefreshEvent;
46 46
import com.electric.chargingpile.data.Zhan;
47
import com.electric.chargingpile.util.CommonParams;
48 47
import com.electric.chargingpile.util.DES;
49 48
import com.electric.chargingpile.util.DES3;
50 49
import com.electric.chargingpile.util.DES3S;
51
import com.electric.chargingpile.util.DateUtils;
52 50
import com.electric.chargingpile.util.JsonUtils;
53 51
import com.electric.chargingpile.util.LoadingDialog;
54 52
import com.electric.chargingpile.util.Md5Util;
55 53
import com.electric.chargingpile.util.OkHttpUtil;
56
import com.electric.chargingpile.util.ToastUtil;
57 54
import com.electric.chargingpile.util.Util;
58 55
import com.electric.chargingpile.view.CircleImageView;
59 56
import com.electric.chargingpile.view.CustomProgressDialog;
@ -90,17 +87,12 @@ import java.io.BufferedWriter;
90 87
import java.io.InputStreamReader;
91 88
import java.io.OutputStreamWriter;
92 89
import java.io.PrintWriter;
93
import java.math.BigDecimal;
94 90
import java.net.Socket;
95 91
import java.net.URLEncoder;
96 92
import java.security.MessageDigest;
97
import java.text.SimpleDateFormat;
98 93
import java.util.ArrayList;
99 94
import java.util.Calendar;
100
import java.util.Date;
101
import java.util.HashMap;
102 95
import java.util.List;
103
import java.util.Map;
104 96
import java.util.regex.Matcher;
105 97
import java.util.regex.Pattern;
106 98
import java.util.regex.PatternSyntaxException;
@ -269,6 +261,15 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
269 261
                        if (detailsFragmentListener != null) {
270 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 273
                        String fenshi_info = JsonUtils.getKeyResult(info_decode, "fenshi_info");
273 274
                        String fenshi_is = JsonUtils.getKeyResult(info_decode, "fenshi_is");
274 275
@ -789,6 +790,8 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
789 790
        }
790 791
    };
791 792
    private String zongjia;
793
    private ImageView scan_charge_btn;
794
    private Space scan_charge_space;
792 795
793 796
    @Override
794 797
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -891,8 +894,6 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
891 894
        detail_zhan_pic = (ImageView) v.findViewById(R.id.detail_zhan_pic);
892 895
893 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 897
        red_paper_bag_top = v.findViewById(R.id.red_paper_bag_top);
897 898
        detail_grade = (TextView) v.findViewById(R.id.detail_grade);
898 899
        detail_picnum = (TextView) v.findViewById(R.id.detail_picnum);
@ -931,6 +932,9 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
931 932
        iv_new_icon = (CircleImageView) v.findViewById(R.id.iv_new_icon);
932 933
        ll_yunyingshang = (LinearLayout) v.findViewById(R.id.ll_yunyingshang);
933 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 940
    @Override
@ -969,6 +973,11 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
969 973
                MobclickAgent.onEvent(getActivity(), "0209");
970 974
                startActivity(new Intent(getActivity(), ChargingQianDaoActivity.class));
971 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,6 +1510,8 @@ public class DetailsFragment extends Fragment implements View.OnClickListener, O
1501 1510
1502 1511
    public interface OnDetailsFragmentListener {
1503 1512
        void updateScanCharge(String ownPay);
1513
1514
        void scanCharge();
1504 1515
    }
1505 1516
1506 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,6 +827,24 @@
827 827
828 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 836
        </LinearLayout>
831 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 850
</androidx.constraintlayout.widget.ConstraintLayout>