wjc
2025-04-09 6ae9f81d545f44a85c34dea1c11df8b70e3f940f
app/src/main/java/com/hdl/photovoltaic/ui/me/AsRegardsActivity.java
@@ -4,13 +4,11 @@
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.linkpm.sdk.user.bean.NewVersionBean;
import com.hdl.photovoltaic.R;
@@ -22,7 +20,8 @@
import com.hdl.photovoltaic.other.HdlAppUpdateLogic;
import com.hdl.photovoltaic.other.HdlCommonLogic;
import com.hdl.photovoltaic.other.HdlThreadLogic;
import com.hdl.photovoltaic.widget.apkwgtupload.ApkDownLoadService;
import com.hdl.photovoltaic.widget.FlashingBoxDialog;
import com.hdl.photovoltaic.widget.FlashingIconBoxDialog;
import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
import com.hdl.photovoltaic.widget.UpdateConfirmationCancelDialog;
@@ -46,8 +45,8 @@
    @Override
    public void onBindView(Bundle savedInstanceState) {
        setNotificationBarBackgroundColor(CustomColor.white);
        setStatusBarTextColor();
        setStatusBarTranslucent();
        getWindow().setNavigationBarColor(getColor(R.color.text_FF000000));
        //初始化
        initView();
        //初始化界面监听器
@@ -65,7 +64,7 @@
                if (newVersionBean != null) {
                    //todo 发现新版本,改变UI样式
                    viewBinding.asRegardsRlRightContentTv.setText(R.string.app_discover_new_version);
                    viewBinding.asRegardsRlRightContentTv.setTextColor(getResources().getColor(R.color.text_245EC3, null));
                    viewBinding.asRegardsRlRightContentTv.setTextColor(getResources().getColor(R.color.text_FFACACAC, null));
                }
            }
@@ -74,16 +73,20 @@
            }
        });
        //todo 等接口
        String content = "https://spark.appc02.com/ksgd1";
        Bitmap bitmap = HdlCommonLogic.getInstance().createQRCodeBitmap(content, 168, 168, "UTF-8", "H", "1", Color.BLACK, Color.WHITE);
        //正式环境
        String content = "https://developer.hdlcontrol.com/AppDownload/HDLPhotovoltaicDownload.html";
        if (!AppConfigManage.getOnlineServer()) {
            //测试环境
            content = "https://developer.hdlcontrol.com/AppDownload/HDLDebugerDownload.html";
        }
        Bitmap bitmap = HdlCommonLogic.getInstance().createQRCodeBitmap(content, 168, 168, "UTF-8", "H", "0", getColor(R.color.text_00000000), Color.WHITE);
        viewBinding.asRegardsQrCodeIv.setImageBitmap(bitmap);
    }
    private void initEvent() {
        viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setOnClickListener(new View.OnClickListener() {
        viewBinding.toolbarTopRl.topBackLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
@@ -117,14 +120,23 @@
            }
        });
        viewBinding.contactUsRl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(_mActivity, ContactUsActivity.class);
                startActivity(intent);
            }
        });
    }
    private void initView() {
        viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setText(R.string.me_regard);
        viewBinding.toolbarTopFragmentHouseListRl.topTitleTv.setTextColor(getResources().getColor(R.color.text_030D1C, null));
        viewBinding.toolbarTopFragmentHouseListRl.topBackBtn.setVisibility(View.VISIBLE);
        viewBinding.toolbarTopFragmentHouseListRl.topBarView.setBackgroundColor(getResources().getColor(R.color.text_FFFFFFFF, null));
        viewBinding.toolbarTopRl.topBarView.setBackgroundColor(getColor(R.color.text_00000000));
        viewBinding.asRegardsVersionUpdatingRl.setVisibility(View.GONE);
        viewBinding.toolbarTopRl.topTitleTv.setText(R.string.me_regard);
        viewBinding.toolbarTopRl.topBackLl.setVisibility(View.VISIBLE);
        String versionsStr = _mActivity.getResources().getString(R.string.app_version_number) + " " + AppConfigManage.getVersionName();
        viewBinding.asRegardsIconVersionsTv.setText(versionsStr);
@@ -138,7 +150,9 @@
            @Override
            public void run() {
                if (mNewVersionBean == null) {
                    HdlThreadLogic.toast(_mActivity, R.string.app_new_version);
                    FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(_mActivity, 1500);
                    flashingBoxDialog.setContent(getString(R.string.app_new_version));
                    flashingBoxDialog.show();
                    return;
                }
                String app_version = getString(R.string.app_version) + ":" + mNewVersionBean.getVersion();
@@ -154,11 +168,24 @@
                updateConfirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() {
                    @Override
                    public void Confirm() {
                        Intent intent = new Intent(_mActivity, ApkDownLoadService.class);
                        intent.putExtra("updateUrl", mNewVersionBean.getPackageUrl());
                        intent.putExtra("downLoadName", HdlAppUpdateLogic.getInstance().getApkFileName());
                        intent.putExtra("downLoadType", "0");
                        _mActivity.startService(intent);
                        FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(_mActivity, 1500);
                        flashingBoxDialog.setContent(getString(R.string.loading_not_supported));
                        flashingBoxDialog.show();
//                        try {
//                            PackageManager packageManager = getPackageManager();
//                            PackageInfo packageInfo = packageManager.getPackageInfo("com.android.vending", 0);
//                            String versionName = packageInfo.versionName; // 获取版本号
//                            int versionCode = packageInfo.versionCode; // 获取版本代码
//                            // 在此处处理版本信息
//                        } catch (PackageManager.NameNotFoundException e) {
//                            e.printStackTrace();
//                            // 处理异常,例如谷歌Play商店应用未安装
//                        }
//
//                        String packageName = "com.hdl.photovoltaic"; // 替换为你想跳转到的应用的包名
//                        Intent intent = new Intent(Intent.ACTION_VIEW);
//                        intent.setData(Uri.parse("market://details?id=" + packageName));
//                        startActivity(intent);
                        updateConfirmationCancelDialog.dismiss();
                    }