| | |
| | | import static com.hdl.photovoltaic.ui.home.CustomStyleChartComposer.upsideDownPyramidChart; |
| | | |
| | | import android.content.Intent; |
| | | import android.graphics.Color; |
| | | import android.os.Bundle; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.view.WindowManager; |
| | | import android.widget.Toast; |
| | | |
| | | import com.bigkoo.pickerview.builder.TimePickerBuilder; |
| | | import com.bigkoo.pickerview.listener.OnTimeSelectListener; |
| | | import com.bigkoo.pickerview.view.TimePickerView; |
| | | import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartModel; |
| | | import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartView; |
| | | import com.github.AAChartModel.AAChartCore.AAChartCreator.AAMoveOverEventMessageModel; |
| | | import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartType; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.CustomBaseFragment; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.databinding.FragmentHomePageBinding; |
| | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.greenrobot.eventbus.Subscribe; |
| | | import org.greenrobot.eventbus.ThreadMode; |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | |
| | | import io.dcloud.common.util.DensityUtils; |
| | | |
| | | /** |
| | | * 首页模块 |
| | |
| | | AAChartView aaChartView2; |
| | | |
| | | AAChartModel aaChartModel2; |
| | | AAChartView aaChartView3; |
| | | |
| | | AAChartModel aaChartModel3; |
| | | |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | viewBinding.test1.setOnClickListener(new View.OnClickListener() { |
| | | viewBinding.homePageStationDataTitleTv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | setUpAAChartView(1); |
| | | } |
| | | }); |
| | | viewBinding.test2.setOnClickListener(new View.OnClickListener() { |
| | | viewBinding.yearMonthDayTv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | setUpAAChartView(2); |
| | | timeSelectedView(); |
| | | |
| | | } |
| | | }); |
| | | viewBinding.test3.setOnClickListener(new View.OnClickListener() { |
| | | timeSelectedView(); |
| | | // viewBinding.test2.setOnClickListener(new View.OnClickListener() { |
| | | // @Override |
| | | // public void onClick(View v) { |
| | | // setUpAAChartView(2); |
| | | // } |
| | | // }); |
| | | |
| | | } |
| | | |
| | | private void timeSelectedView(){ |
| | | //时间选择器 |
| | | Calendar selectedDate = Calendar.getInstance(); |
| | | Calendar startDate = Calendar.getInstance(); |
| | | //startDate.set(2013,1,1); |
| | | Calendar endDate = Calendar.getInstance(); |
| | | //endDate.set(2020,1,1); |
| | | |
| | | //正确设置方式 |
| | | startDate.set(2024, 1, 1); |
| | | endDate.set(2025, 4, 25); |
| | | |
| | | TimePickerView pvTime = new TimePickerBuilder(_mActivity, new OnTimeSelectListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | setUpAAChartView(3); |
| | | public void onTimeSelect(Date date, View v) {//选中事件回调 |
| | | // tvTime.setText(getTime(date)); |
| | | } |
| | | }); |
| | | }) |
| | | .setType(new boolean[]{true, false, false, false, false, false})// 默认全部显示 |
| | | .setCancelText("取消")//取消按钮文字 |
| | | .setSubmitText("确定")//确认按钮文字 |
| | | .setContentTextSize(18)//滚轮文字大小 |
| | | .setTitleSize(18)//标题文字大小 |
| | | .setTitleText("时间选择")//标题文字 |
| | | .setOutSideCancelable(true)//点击屏幕,点在控件外部范围时,是否取消显示 |
| | | .isCyclic(false)//是否循环滚动 |
| | | .setTitleColor(_mActivity.getColor(R.color.text_90000000))//标题文字颜色 |
| | | .setSubmitColor(_mActivity.getColor(R.color.text_38C494))//确定按钮文字颜色 |
| | | .setCancelColor(_mActivity.getColor(R.color.text_40000000))//取消按钮文字颜色 |
| | | .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)// 如果不设置的话,默认是系统时间*/ |
| | | .setRangDate(startDate, endDate)//起始终止年月日设定 |
| | | .setLabel("年", "月", "日", "时", "分", "秒")//默认设置为年月日时分秒 |
| | | .isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。 |
| | | .isDialog(false)//是否显示为对话框样式 |
| | | .setItemVisibleCount(17)//对话框高度 |
| | | .setDividerColor(_mActivity.getColor(R.color.text_E1E1E1)) |
| | | .setDecorView(viewBinding.wwwwww) |
| | | // .setLineSpacingMultiplier(3f)// |
| | | .build(); |
| | | pvTime.show(); |
| | | } |
| | | |
| | | private void setUpAAChartView(int value) { |
| | | if (value == 1) { |
| | | aaChartView1 = viewBinding.AAChartView1; |
| | | aaChartView1 = viewBinding.AAChartView; |
| | | aaChartView1.callBack = this; |
| | | aaChartModel1 = configureAAChartModel(); |
| | | aaChartView1.aa_drawChartWithChartModel(aaChartModel1); |
| | | } else if (value == 2) { |
| | | aaChartView2 = viewBinding.AAChartView2; |
| | | // aaChartView2 = viewBinding.AAChartView2; |
| | | aaChartView2.callBack = this; |
| | | aaChartModel2 = configureColorfulColumnChart();// configureTheAAChartModel("colorfulColumnChart"); |
| | | aaChartView2.aa_drawChartWithChartModel(aaChartModel2); |
| | | } else if (value == 3) { |
| | | aaChartView3 = viewBinding.AAChartView3; |
| | | aaChartView3.callBack = this; |
| | | aaChartModel3 = configureAAChartModel(); |
| | | aaChartView3.aa_drawChartWithChartModel(aaChartModel3); |
| | | } |
| | | } |
| | | |