From cae6ff870b1e9f1278a8fa21ab1013e68569607a Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期三, 15 五月 2024 19:31:33 +0800 Subject: [PATCH] 2024年05月15日19:31:32 --- app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java | 68 ++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 28 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 474231d..0b72e9d 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 @@ -1,14 +1,15 @@ package com.hdl.photovoltaic.ui.home; -import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.configureColorfulColumnChart; +import static com.hdl.photovoltaic.ui.home.aachart.CustomStyleChartComposer.configureColorfulColumnChart; import android.os.Bundle; import android.text.TextUtils; import android.view.View; -import androidx.annotation.RequiresPermission; + import androidx.appcompat.content.res.AppCompatResources; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.bigkoo.pickerview.builder.TimePickerBuilder; import com.bigkoo.pickerview.listener.OnTimeSelectListener; @@ -17,7 +18,6 @@ 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; @@ -33,6 +33,7 @@ import com.hdl.photovoltaic.ui.bean.DataOverBean; import com.hdl.photovoltaic.ui.bean.SocialContributionBean; import com.hdl.photovoltaic.ui.bean.StatisticsBean; +import com.hdl.photovoltaic.ui.home.aachart.BasicChartComposer; import com.hdl.photovoltaic.utils.TimeUtils; import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; @@ -53,7 +54,7 @@ FragmentHomePageBinding viewBinding; - AAChartView aaChartView; + AutoSizeMyAAChart aaChartView; AAChartModel aaChartModel; @@ -73,14 +74,15 @@ @Override public void onBindView(Bundle savedInstanceState) { + //鍒濆鍖� initView(); //鍒濆鍖栫晫闈㈢洃鍚櫒 initEvent(); //璇诲彇鏁版嵁 readDate(); - } + /** * 璇诲彇鏁版嵁 @@ -120,13 +122,13 @@ viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_38C494)); viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.v1.setVisibility(View.GONE); viewBinding.v2.setVisibility(View.VISIBLE); @@ -149,16 +151,16 @@ } timeType = TimeType.month; viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494)); viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_38C494)); viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.v1.setVisibility(View.GONE); viewBinding.v2.setVisibility(View.GONE); @@ -181,16 +183,16 @@ } timeType = TimeType.year; viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494)); viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_38C494)); viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.v1.setVisibility(View.VISIBLE); viewBinding.v2.setVisibility(View.GONE); @@ -211,13 +213,13 @@ } timeType = TimeType.all; viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494)); viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_38C494)); @@ -265,7 +267,19 @@ viewBinding.yearMonthDayTv.setText(time); } }); + //璁剧疆涓嬫媺绠ご棰滆壊 + viewBinding.srl.setColorSchemeResources(R.color.text_FF245EC3); + viewBinding.srl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + viewBinding.srl.setRefreshing(false); + readDate(); + } + }); + + } + /** * 鏃堕棿閫夋嫨鍣� */ @@ -307,12 +321,12 @@ .setTitleText(_mActivity.getString(R.string.time_selectd))//鏍囬鏂囧瓧 .setOutSideCancelable(true)//鐐瑰嚮灞忓箷锛岀偣鍦ㄦ帶浠跺閮ㄨ寖鍥存椂锛屾槸鍚﹀彇娑堟樉绀� .isCyclic(false)//鏄惁寰幆婊氬姩 - .setTitleColor(_mActivity.getColor(R.color.text_90000000))//鏍囬鏂囧瓧棰滆壊 + .setTitleColor(_mActivity.getColor(R.color.text_E6000000))//鏍囬鏂囧瓧棰滆壊 .setSubmitColor(_mActivity.getColor(R.color.text_38C494))//纭畾鎸夐挳鏂囧瓧棰滆壊 - .setCancelColor(_mActivity.getColor(R.color.text_40000000))//鍙栨秷鎸夐挳鏂囧瓧棰滆壊 + .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_90000000)).setDate(selectedDate)// 濡傛灉涓嶈缃殑璇濓紝榛樿鏄郴缁熸椂闂�*/ + .setTextColorCenter(_mActivity.getColor(R.color.text_E6000000)).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銆� @@ -327,16 +341,17 @@ * 鍥捐〃鍔犺浇 */ private void setUpAAChartView() { - aaChartView = viewBinding.AAChartView; + aaChartView = viewBinding.autoSizeMyAAChart; aaChartView.callBack = this; if (TimeType.day.equals(timeType)) { aaChartModel = BasicChartComposer.configureAreaChart("Pv鍙戠數鍔熺巼", fieldNames, fieldValues); } else if (TimeType.month.equals(timeType) || TimeType.year.equals(timeType) || TimeType.all.equals(timeType)) { - aaChartModel = configureColorfulColumnChart(); + aaChartModel = configureColorfulColumnChart("Pv鍙戠數鍔熺巼", fieldNames, fieldValues); } aaChartView.aa_drawChartWithChartModel(aaChartModel); + } private void initView() { @@ -360,20 +375,17 @@ viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494)); viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_38C494)); viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000)); - viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000)); + viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_66000000)); viewBinding.v1.setVisibility(View.GONE); viewBinding.v2.setVisibility(View.VISIBLE); viewBinding.v3.setVisibility(View.VISIBLE); viewBinding.homePageStationSelectTimeLl.setVisibility(View.VISIBLE); setUpAAChartView();//鍥捐〃鍔犺浇 } - - - @Override -- Gitblit v1.8.0