2023年12月25日16:08:58
备份一下代码
| | |
| | | minSdk 23 |
| | | targetSdk 30 |
| | | versionCode 1 |
| | | versionName "1.1.2"//版本规则1.1是产品功能迭代用的,最后一位1是我们修复bug用的 |
| | | versionName "1.1.3"//版本规则1.1是产品功能迭代用的,最后一位1是我们修复bug用的 |
| | | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| | | multiDexEnabled true |
| | | manifestPlaceholders = mfph |
| | |
| | | } |
| | | debug { |
| | | signingConfig signingConfigs.debug |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" |
| | | tools:ignore="ProtectedPermissions" /> <!-- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> --> |
| | | <uses-permission android:name="android.permission.VIBRATE" /> <!-- <uses-permission android:name="android.permission.INTERNET" /> --> |
| | | <!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> --> |
| | | <!-- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> --> |
| | | <!-- <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> --> |
| | | <!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> --> |
| | |
| | | <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <!-- <uses-permission android:name="android.permission.INTERNET" /> --> |
| | | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- bugly所需权限 start --> |
| | | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- <uses-permission android:name="android.permission.INTERNET" /> --> |
| | | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
| | | <!-- UNI相机和存储的权限 --> |
| | | <uses-feature android:name="android.hardware.camera" /> |
| | | <uses-feature android:name="android.hardware.camera.autofocus" /> |
| | |
| | | <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> |
| | | <uses-permission android:name="android.permission.FLASHLIGHT" /> |
| | | <uses-permission android:name="android.permission.WAKE_LOCK" /> |
| | | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
| | | <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> |
| | | |
| | | <uses-permission android:name="android.permission.CALL_PHONE" /> |
| | |
| | | |
| | | |
| | | /** |
| | | * 点击返回键的事件 |
| | | * 物理按键返回事件 |
| | | */ |
| | | @Override |
| | | public void onBackPressed() { |
| | |
| | | package com.hdl.photovoltaic.ui.adapter; |
| | | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | |
| | | public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { |
| | | |
| | | HouseIdBean houseIdBean = this.mList.get(position); |
| | | holder.homeNameTv.setText(houseIdBean.getHomeName().replace(" ", "")); |
| | | holder.homeNameTv.setText(houseIdBean.getHomeName().trim()); |
| | | //装机容量 |
| | | String capacity = mContext.getString(R.string.my_power_station_installed_capacity) + houseIdBean.getInstalledCapacity() + "kW"; |
| | | holder.capacityTv.setText(capacity); |
| | | String kw = "0.0"; |
| | | try { |
| | | double d = Double.parseDouble(houseIdBean.getPower()); |
| | | int intValue = (int) d; |
| | | int k = intValue / 1000; |
| | | int w = intValue % 1000; |
| | | kw = k + "." + w; |
| | | } catch (Exception ignored) { |
| | | } |
| | | //发电功率 |
| | | String power = mContext.getString(R.string.power_station_generated_power) + houseIdBean.getPower() + "kW"; |
| | | String power = mContext.getString(R.string.power_station_generated_power) + kw + "kW"; |
| | | holder.powerTv.setText(power); |
| | | setTextViewStyle(holder.stateTv, houseIdBean.getPowerStationStatus()); |
| | | GlideUtils.getRoundedCornersImage(mContext, houseIdBean.getPowerStationImage(), holder.homeIconIv, new RoundedCorners(4)); |
| | |
| | | } |
| | | |
| | | public String getPower() { |
| | | return power == null ? "" : power; |
| | | return power == null ? "0" : power; |
| | | } |
| | | |
| | | public void setPower(String power) { |
| | |
| | | public void setLocalSecret(String localSecret) { |
| | | this.localSecret = localSecret; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import android.os.Bundle; |
| | | import android.os.CountDownTimer; |
| | | import android.os.Process; |
| | | import android.text.TextUtils; |
| | | import android.view.View; |
| | | |
| | |
| | | import com.hdl.photovoltaic.other.HdlAccountLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.utils.AppManagerUtils; |
| | | import com.sahooz.library.countrypicker.Country; |
| | | import com.sahooz.library.countrypicker.CountryPickerFragment; |
| | | import com.sahooz.library.countrypicker.PickCountryCallback; |
| | |
| | | UserConfigManage.getInstance().setBingEmail(mailStr); |
| | | UserConfigManage.getInstance().Save(); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.set_bind_mail_succeed), 0); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | super.onDestroy(); |
| | | |
| | | if (countDownTimer != null) { |
| | | countDownTimer.cancel(); |
| | | countDownTimer = null; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 物理按键返回事件 |
| | | */ |
| | | @Override |
| | | public void onBackPressed() { |
| | | setResult(20); |
| | | super.onBackPressed(); |
| | | } |
| | | } |
| | |
| | | UserConfigManage.getInstance().setBingPhone(phoneStr); |
| | | UserConfigManage.getInstance().Save(); |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.set_bind_phone_succeed), 0); |
| | | finish(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | } |
| | | /** |
| | | * 物理按键返回事件 |
| | | */ |
| | | @Override |
| | | public void onBackPressed() { |
| | | setResult(20); |
| | | super.onBackPressed(); |
| | | } |
| | | } |
| | |
| | | viewBinding.homeAffirmTv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | String oldPsw = viewBinding.meChangePasswordOldIc.mePswEt.getText().toString().replaceAll(" ", ""); |
| | | String newPsw = viewBinding.meChangePasswordNewIc.mePswEt.getText().toString().replaceAll(" ", ""); |
| | | String affirmPsw = viewBinding.meChangePasswordAffirmIc.mePswEt.getText().toString().replaceAll(" ", ""); |
| | | if (!isEditTextPassword(oldPsw, newPsw, affirmPsw)) { |
| | | return; |
| | | } |
| | | // 二次确认提示框 |
| | | ConfirmationCancelDialog dialog = new ConfirmationCancelDialog(_mActivity); |
| | | dialog.setTitle(getString(R.string.loading_title_tip)); |
| | |
| | | dialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() { |
| | | @Override |
| | | public void Confirm() { |
| | | sendChangePassword(); |
| | | sendChangePassword(oldPsw, newPsw); |
| | | } |
| | | }); |
| | | dialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() { |
| | |
| | | |
| | | /** |
| | | * 发送更改个人密码指令 |
| | | * |
| | | * @param oldPsw 原来密码 |
| | | * @param newPsw 新密码 |
| | | */ |
| | | private void sendChangePassword() { |
| | | String oldPsw = viewBinding.meChangePasswordOldIc.mePswEt.getText().toString().replaceAll(" +", ""); |
| | | String newPsw = viewBinding.meChangePasswordNewIc.mePswEt.getText().toString().replaceAll(" +", ""); |
| | | String affirmPsw = viewBinding.meChangePasswordAffirmIc.mePswEt.getText().toString().replaceAll(" +", ""); |
| | | private void sendChangePassword(String oldPsw, String newPsw) { |
| | | |
| | | if (isEditTextPassword(oldPsw, newPsw) || isEditTextPassword(oldPsw, affirmPsw)) { |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, "原密码和新密码不能一样.", -1); |
| | | return; |
| | | } |
| | | |
| | | if (newPsw.length() < 6 || affirmPsw.length() < 6) { |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_least6), -1); |
| | | return; |
| | | } |
| | | if (!isEditTextPassword(newPsw, affirmPsw)) { |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_input_unlike_psw), -1); |
| | | return; |
| | | } |
| | | if (UserConfigManage.getInstance().isBAccount()) { |
| | | //B端更改个人密码 |
| | | HdlAccountLogic.getInstance().updatePassword_B(oldPsw, newPsw, new CloudCallBeak<String>() { |
| | |
| | | /** |
| | | * 本地校验密码是否正确 |
| | | * |
| | | * @param oldPsw 原来密码 |
| | | * @param newPsw 新密码 |
| | | * @param affirmPsw 再次确认新密码 |
| | | * @return 一样返回true,否者false |
| | | */ |
| | | private boolean isEditTextPassword(String newPsw, String affirmPsw) { |
| | | //新密码和确认密码不一样 |
| | | return newPsw.equals(affirmPsw); |
| | | private boolean isEditTextPassword(String oldPsw, String newPsw, String affirmPsw) { |
| | | if (newPsw.length() < 6 || affirmPsw.length() < 6) { |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_least6), -1); |
| | | return false; |
| | | } |
| | | if (!newPsw.equals(affirmPsw)) { |
| | | //新密码和确认密码不一样 |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, getString(R.string.home_login_input_unlike_psw), -1); |
| | | return false; |
| | | } |
| | | if (oldPsw.equals(newPsw)) { |
| | | HdlThreadLogic.tipFlashingBox(_mActivity, true, "原密码和新密码不能一样.", -1); |
| | | return false; |
| | | } |
| | | return true; |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | //怕其它不判断null |
| | | mC_UserInfo = new CUserInfo(); |
| | | // hideLoading(); |
| | | HdlThreadLogic.toast(_mActivity, e); |
| | | } |
| | |
| | | public void onClick(View v) { |
| | | Intent intent = new Intent(); |
| | | intent.setClass(_mActivity, PersonalDataActivity.class); |
| | | if (mC_UserInfo == null) { |
| | | mC_UserInfo = new CUserInfo(); |
| | | } |
| | | intent.putExtra("memberHeadIcon", mC_UserInfo.getMemberHeadIcon()); |
| | | startActivityForResult(intent, 10); |
| | | } |
| | |
| | | viewBinding.toolbarTopFragmentMeRl.topBackBtn.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | Intent intent = new Intent(); |
| | | intent.putExtra("memberHeadIcon", mMemberHeadIconUrl); |
| | | intent.putExtra("memberName", UserConfigManage.getInstance().getUserName()); |
| | | setResult(10, intent); |
| | | backPressedData(); |
| | | finish(); |
| | | } |
| | | }); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 物理按键返回事件 |
| | | */ |
| | | @Override |
| | | public void onBackPressed() { |
| | | backPressedData(); |
| | | super.onBackPressed(); |
| | | } |
| | | |
| | | /** |
| | | * 返回给上一级界面数据 |
| | | */ |
| | | private void backPressedData() { |
| | | Intent intent = new Intent(); |
| | | intent.putExtra("memberHeadIcon", mMemberHeadIconUrl); |
| | | intent.putExtra("memberName", UserConfigManage.getInstance().getUserName()); |
| | | setResult(10, intent); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | public static int getAuthorizeStaus(Activity activity, String authorize) { |
| | | int flag = ActivityCompat.checkSelfPermission(activity, authorize); |
| | | Boolean isShould = ActivityCompat.shouldShowRequestPermissionRationale(activity, authorize); |
| | | boolean isShould = ActivityCompat.shouldShowRequestPermissionRationale(activity, authorize); |
| | | if (isShould) { |
| | | return STATUS_REFUSE; |
| | | } |
New file |
| | |
| | | package com.hdl.photovoltaic.utils; |
| | | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 计量单位换算 |
| | | * |
| | | * @author XinLau |
| | | */ |
| | | public class UnitConversionUtils { |
| | | |
| | | |
| | | |
| | | } |