| | |
| | | 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 androidx.appcompat.content.res.AppCompatResources; |
| | | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; |
| | | |
| | | import com.bigkoo.pickerview.builder.TimePickerBuilder; |
| | | import com.bigkoo.pickerview.listener.OnTimeSelectListener; |
| | |
| | | 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; |
| | | |
| | |
| | | |
| | | FragmentHomePageBinding viewBinding; |
| | | |
| | | AAChartView aaChartView; |
| | | AutoSizeMyAAChart aaChartView; |
| | | |
| | | AAChartModel aaChartModel; |
| | | |
| | |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | |
| | | //初始化 |
| | | initView(); |
| | | //初始化界面监听器 |
| | | initEvent(); |
| | | //读取数据 |
| | | readDate(); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 读取数据 |
| | |
| | | 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); |
| | |
| | | } |
| | | 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); |
| | |
| | | } |
| | | 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); |
| | |
| | | } |
| | | 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)); |
| | |
| | | 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(); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | .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文字,false则每项item全部都带有label。 |
| | |
| | | * 图表加载 |
| | | */ |
| | | private void setUpAAChartView() { |
| | | aaChartView = viewBinding.AAChartView; |
| | | aaChartView = viewBinding.autoSizeMyAAChart; |
| | | aaChartView.callBack = this; |
| | | if (TimeType.day.equals(timeType)) { |
| | | aaChartModel = BasicChartComposer.configureAreaChart("Pv发电功率", fieldNames, fieldValues); |
| | |
| | | aaChartModel = configureColorfulColumnChart("Pv发电功率", fieldNames, fieldValues); |
| | | } |
| | | aaChartView.aa_drawChartWithChartModel(aaChartModel); |
| | | |
| | | } |
| | | |
| | | private void initView() { |
| | |
| | | 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); |