From 3e904bfa8a1bb53dcf461e5c717f9b808e179245 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期三, 08 一月 2025 16:27:48 +0800
Subject: [PATCH] 2025年01月08日16:27:46
---
app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java | 113 +++++++++++++++++++-------------------------------------
1 files changed, 38 insertions(+), 75 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
index 15db7ab..949d8ef 100644
--- a/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
+++ b/app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
@@ -4,21 +4,11 @@
import static com.hdl.photovoltaic.ui.home.aachart.CustomStyleChartComposer.configureColorfulColumnChart;
import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.os.SystemClock;
-import android.text.SpannableString;
-import android.text.Spanned;
import android.text.TextUtils;
-import android.text.style.AbsoluteSizeSpan;
-import android.text.style.ClickableSpan;
-import android.text.style.ForegroundColorSpan;
-import android.text.style.StyleSpan;
+import android.util.Log;
import android.view.View;
-import android.view.ViewGroup;
-import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
@@ -29,10 +19,10 @@
import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartView;
import com.github.AAChartModel.AAChartCore.AAChartCreator.AAMoveOverEventMessageModel;
import com.hdl.linkpm.sdk.core.exception.HDLException;
-import com.hdl.photovoltaic.HDLApp;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.base.CustomBaseFragment;
import com.hdl.photovoltaic.config.ConstantManage;
+import com.hdl.photovoltaic.config.UserConfigManage;
import com.hdl.photovoltaic.databinding.FragmentHomePageBinding;
import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch;
import com.hdl.photovoltaic.enums.PowerStationStatus;
@@ -40,7 +30,6 @@
import com.hdl.photovoltaic.enums.UnitType;
import com.hdl.photovoltaic.listener.CloudCallBeak;
import com.hdl.photovoltaic.other.HdlCommonLogic;
-import com.hdl.photovoltaic.other.HdlDeviceLogic;
import com.hdl.photovoltaic.other.HdlLogLogic;
import com.hdl.photovoltaic.other.HdlPowerStationDataStatisticsLogic;
import com.hdl.photovoltaic.other.HdlResidenceLogic;
@@ -53,14 +42,13 @@
import com.hdl.photovoltaic.ui.home.aachart.BasicChartComposer;
import com.hdl.photovoltaic.uni.HDLUniMP;
import com.hdl.photovoltaic.utils.TimeUtils;
-import com.hdl.photovoltaic.utils.UnitConversionUtils;
+import com.hdl.photovoltaic.widget.FlashingBoxDialog;
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
-import java.lang.ref.WeakReference;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@@ -124,6 +112,7 @@
viewBinding.homePageStationAddIv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1);
HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null);
}
});
@@ -176,7 +165,7 @@
timeType = TimeType.day;
viewBinding.unitTv.setText(UnitType.kW);
viewBinding.unitTextTv.setText(getString(R.string.pv_power));
- viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494));
+ viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_39383d));
viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_E6FFFFFF));
viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
@@ -213,7 +202,7 @@
viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_66FFFFFF));
- viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494));
+ viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_39383d));
viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_E6FFFFFF));
viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
@@ -250,7 +239,7 @@
viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_66FFFFFF));
- viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494));
+ viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_39383d));
viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_E6FFFFFF));
viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
@@ -285,7 +274,7 @@
viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_66FFFFFF));
- viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494));
+ viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_39383d));
viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_E6FFFFFF));
viewBinding.v1.setVisibility(View.VISIBLE);
@@ -325,7 +314,9 @@
Calendar calendar = TimeUtils.stringToCalendar(currDate, timeDateFormat);
String time = TimeUtils.addDayMonthYearToDate(calendar, 1, timeDateFormat, timeType);
if (TimeUtils.stringDateToTimestamp(time, timeDateFormat) > TimeUtils.getCurrentTimestamp()) {
- HdlThreadLogic.toast(_mActivity, getString(R.string.the_query_date_is_exceeded));
+ FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(_mActivity, 1500);
+ flashingBoxDialog.setContent(getString(R.string.the_query_date_is_exceeded));
+ flashingBoxDialog.show();
return;
}
@@ -383,23 +374,23 @@
}).setType(new boolean[]{year, month, day, false, false, false})// 榛樿鍏ㄩ儴鏄剧ず
.setCancelText(_mActivity.getString(R.string.loading_cancel))//鍙栨秷鎸夐挳鏂囧瓧
.setSubmitText(_mActivity.getString(R.string.loading_affirm))//纭鎸夐挳鏂囧瓧
- .setContentTextSize(18)//婊氳疆鏂囧瓧澶у皬
- .setTitleSize(18)//鏍囬鏂囧瓧澶у皬
- .setTitleText(_mActivity.getString(R.string.time_selectd))//鏍囬鏂囧瓧
+ .setContentTextSize(16)//婊氳疆鏂囧瓧澶у皬
+// .setTitleSize(18)//鏍囬鏂囧瓧澶у皬
+// .setTitleText(_mActivity.getString(R.string.time_selectd))//鏍囬鏂囧瓧
.setOutSideCancelable(true)//鐐瑰嚮灞忓箷锛岀偣鍦ㄦ帶浠跺閮ㄨ寖鍥存椂锛屾槸鍚﹀彇娑堟樉绀�
.isCyclic(false)//鏄惁寰幆婊氬姩
- .setTitleColor(_mActivity.getColor(R.color.text_E6000000))//鏍囬鏂囧瓧棰滆壊
- .setSubmitColor(_mActivity.getColor(R.color.text_38C494))//纭畾鎸夐挳鏂囧瓧棰滆壊
- .setCancelColor(_mActivity.getColor(R.color.text_66000000))//鍙栨秷鎸夐挳鏂囧瓧棰滆壊
- .setTitleBgColor(_mActivity.getColor(R.color.text_FFFFFFFF))//鏍囬鑳屾櫙棰滆壊 Night mode
- .setBgColor(_mActivity.getColor(R.color.text_FFFFFFFF))//婊氳疆鑳屾櫙棰滆壊 Night mode
- .setTextColorCenter(_mActivity.getColor(R.color.text_E6000000)).setDate(selectedDate)// 濡傛灉涓嶈缃殑璇濓紝榛樿鏄郴缁熸椂闂�*/
+// .setTitleColor(_mActivity.getColor(R.color.text_E6FFFFFF))//鏍囬鏂囧瓧棰滆壊
+ .setSubmitColor(_mActivity.getColor(R.color.text_E6FFFFFF))//纭畾鎸夐挳鏂囧瓧棰滆壊
+ .setCancelColor(_mActivity.getColor(R.color.text_FF8E8E8E))//鍙栨秷鎸夐挳鏂囧瓧棰滆壊
+ .setTitleBgColor(_mActivity.getColor(R.color.text_FF222222))//鏍囬鑳屾櫙棰滆壊 Night mode
+ .setBgColor(_mActivity.getColor(R.color.text_FF222222))//婊氳疆鑳屾櫙棰滆壊 Night mode
+ .setTextColorCenter(_mActivity.getColor(R.color.text_E6FFFFFF)).setDate(selectedDate)// 濡傛灉涓嶈缃殑璇濓紝榛樿鏄郴缁熸椂闂�*/
.setRangDate(startDate, endDate)//璧峰缁堟骞存湀鏃ヨ瀹�
.setLabel(_mActivity.getString(R.string.year), _mActivity.getString(R.string.month), _mActivity.getString(R.string.day), _mActivity.getString(R.string.hour), _mActivity.getString(R.string.minute), _mActivity.getString(R.string.seconds))//榛樿璁剧疆涓哄勾鏈堟棩鏃跺垎绉�
.isCenterLabel(false) //鏄惁鍙樉绀轰腑闂撮�変腑椤圭殑label鏂囧瓧锛宖alse鍒欐瘡椤筰tem鍏ㄩ儴閮藉甫鏈塴abel銆�
.isDialog(false)//鏄惁鏄剧ず涓哄璇濇鏍峰紡
.setItemVisibleCount(7)//瀵硅瘽妗嗛珮搴�
- .setDividerColor(_mActivity.getColor(R.color.text_E1E1E1)).setLineSpacingMultiplier(3f)//
+ .setDividerColor(_mActivity.getColor(R.color.text_1AFFFFFF)).setLineSpacingMultiplier(3f)//
.build();
pvTime.show();
}
@@ -415,46 +406,12 @@
} else if (TimeType.month.equals(timeType) || TimeType.year.equals(timeType) || TimeType.all.equals(timeType)) {
aaChartModel = configureColorfulColumnChart(getString(R.string.generation), fieldNames, fieldValues);
}
-
- if(needDelay) {
- viewBinding.autoSizeMyAAChart.setX(10000);//鐩存帴鎵撳紑鏈夐棯灞忥紝鍦ㄤ笉鏄剧ず鐨勫湴鏂瑰厛鏄剧ず锛屽啀绉诲姩鍒版甯哥殑浣嶇疆銆俆ODO 鍚庣画鎵惧埌鏍规簮闂鍚庡幓鎺夎繖涓敤娉�
- aaChartView.aa_drawChartWithChartModel(aaChartModel);
- mHandler.sendEmptyMessageDelayed(100,800);
- }
- else{
- aaChartView.aa_drawChartWithChartModel(aaChartModel);
- }
- }
-
- FHandler mHandler=new FHandler(this);
-
- private static class FHandler extends Handler{
- //瀹氫箟寮卞紩鐢ㄥ疄渚�
- private WeakReference<HomePageFragment> reference;
-
- //鍦ㄦ瀯閫犳柟娉曚腑浼犲叆闇�瑕佹寔鏈夌殑fragment瀹炰緥
- public FHandler(HomePageFragment fragment) {
- reference = new WeakReference<HomePageFragment>(fragment); }
-
- //閫氳繃澶嶅啓handlerMessage()浠庤�屽喅瀹氬浣曡繘琛屾洿鏂癠I鎿嶄綔
- @Override
- public void handleMessage(Message msg) {
- //鐪佺暐浠g爜
-
- switch (msg.what){
- case 100:
- if(reference.get()!=null) {
- reference.get().viewBinding.autoSizeMyAAChart.setX(0);//绉诲姩鍒版纭殑浣嶇疆
- }
- break;
- }
- }
+ aaChartView.aa_drawChartWithChartOptions(aaChartModel.aa_toAAOptions());
}
@Override
public void onDestroy() {
super.onDestroy();
- mHandler.removeCallbacksAndMessages(null);
}
private void initView() {
@@ -477,7 +434,7 @@
viewBinding.unitTv.setText(UnitType.kW);
- viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494));
+ viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_39383d));
viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_E6FFFFFF));
viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_66FFFFFF));
@@ -489,6 +446,7 @@
viewBinding.v2.setVisibility(View.VISIBLE);
viewBinding.v3.setVisibility(View.VISIBLE);
viewBinding.homePageStationSelectTimeLl.setVisibility(View.VISIBLE);
+ viewBinding.autoSizeMyAAChart.setBackgroundColor(_mActivity.getColor(R.color.text_FF1C1C1E));
setUpAAChartView(true);//鍥捐〃鍔犺浇
}
@@ -533,7 +491,7 @@
}
viewBinding.stationAllTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getTotal()));
viewBinding.stationFaultsTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getFault()));
- viewBinding.stationOfflineTitleTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline()));
+ viewBinding.stationOfflineTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline()));
viewBinding.stationConnectedTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getConnecting()));
}
@@ -559,8 +517,9 @@
if (dataOverBean == null) {
return;
}
- viewBinding.infoRl1Text1Tv.setText(HdlCommonLogic.getConvertDoubleUnit(dataOverBean.getInstalledCapacity()));
- viewBinding.infoRl1Text3Tv.setText(HdlCommonLogic.getConvertDoubleUnit(dataOverBean.getPower(), UnitType.kW, false));
+ String capacityValue = HdlCommonLogic.getBigDecimal(dataOverBean.getInstalledCapacity()).toString();
+ viewBinding.infoRl1Text1Tv.setText(capacityValue);
+ viewBinding.infoRl1Text3Tv.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getPower()));
// String str = dataOverBean.getPowerRatio() + "%";
// int startIndex = str.lastIndexOf("%");
@@ -589,10 +548,14 @@
} catch (Exception ignored) {
}
- viewBinding.day.setText(HdlCommonLogic.getConvertDoubleUnit(dataOverBean.getTodayElectricity()));
- viewBinding.month.setText(HdlCommonLogic.getConvertDoubleUnit(dataOverBean.getMonthElectricity()));
- viewBinding.year.setText(HdlCommonLogic.getConvertDoubleUnit(dataOverBean.getYearElectricity()));
- viewBinding.Total.setText(HdlCommonLogic.getConvertDoubleUnit(dataOverBean.getTotalElectricity()));
+ viewBinding.day.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getTodayElectricity()));
+ viewBinding.dayUnit.setText(HdlCommonLogic.convertUnit(dataOverBean.getTodayElectricity(), UnitType.kWh));
+ viewBinding.month.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getMonthElectricity()));
+ viewBinding.monthUnit.setText(HdlCommonLogic.convertUnit(dataOverBean.getMonthElectricity(), UnitType.kWh));
+ viewBinding.year.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getYearElectricity()));
+ viewBinding.yearUnit.setText(HdlCommonLogic.convertUnit(dataOverBean.getYearElectricity(), UnitType.kWh));
+ viewBinding.Total.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getTotalElectricity()));
+ viewBinding.TotalUnit.setText(HdlCommonLogic.convertUnit(dataOverBean.getTotalElectricity(), UnitType.kWh));
}
});
@@ -624,7 +587,7 @@
for (int i = 0; i < list.size(); i++) {
keys[i] = list.get(i).getFieldName();
if (TimeType.day.equals(timeType)) {
- values[i] = HdlCommonLogic.divideByOneThousandAndFormat(list.get(i).getFieldValue());// HdlCommonLogic.getBigDecimal(list.get(i).getFieldValue()).intValue();//鑾峰彇鏁存暟閮ㄥ垎
+ values[i] = HdlCommonLogic.convertBigDecimal(list.get(i).getFieldValue(), 1000);// HdlCommonLogic.getBigDecimal(list.get(i).getFieldValue()).intValue();//鑾峰彇鏁存暟閮ㄥ垎
} else {
values[i] = HdlCommonLogic.getBigDecimal(list.get(i).getFieldValue());
}
@@ -667,4 +630,4 @@
}
-}
\ No newline at end of file
+}
--
Gitblit v1.8.0