mac
2024-05-30 2b805d413e924bc0a8e80e1280208d9af8d93cb1
2024年05月30日21:11:54

备份代码
5个文件已修改
168 ■■■■■ 已修改文件
aa_chart_core/src/main/java/com/github/AAChartModel/AAChartCore/AAChartCreator/AAOptionsConstructor.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/BasicChartComposer.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/CustomStyleChartComposer.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
aa_chart_core/src/main/java/com/github/AAChartModel/AAChartCore/AAChartCreator/AAOptionsConstructor.java
@@ -1,20 +1,35 @@
/**
 //  AAOptionsConstructor.java
 //  AAChartCore
 //
 //  Created by AnAn on 2018/12/08.
 //  Copyright © 2018年 An An. All rights reserved.
 /**
 * //  AAOptionsConstructor.java
 * //  AAChartCore
 * //
 * //  Created by AnAn on 2018/12/08.
 * //  Copyright © 2018年 An An. All rights reserved.
 * /**
 * ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
 * ◉◉◉...................................................       ◉◉◉
 * ◉◉◉   https://github.com/AAChartModel/AAChartCore            ◉◉◉
 * ◉◉◉   https://github.com/AAChartModel/AAChartCore-Kotlin     ◉◉◉
 * ◉◉◉...................................................       ◉◉◉
 * ◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉ ...... SOURCE CODE ......◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉◉
 * <p>
 * <p>
 * -------------------------------------------------------------------------------
 * <p>
 * 🌕 🌖 🌗 🌘  ❀❀❀   WARM TIPS!!!   ❀❀❀ 🌑 🌒 🌓 🌔
 * <p>
 * Please contact me on GitHub,if there are any problems encountered in use.
 * GitHub Issues : https://github.com/AAChartModel/AAChartCore/issues
 * -------------------------------------------------------------------------------
 * And if you want to contribute for this project, please contact me as well
 * GitHub        : https://github.com/AAChartModel
 * StackOverflow : https://stackoverflow.com/users/7842508/codeforu
 * JianShu       : http://www.jianshu.com/u/f1e6753d4254
 * SegmentFault  : https://segmentfault.com/u/huanghunbieguan
 * <p>
 * -------------------------------------------------------------------------------
 */
/**
 * -------------------------------------------------------------------------------
 *
 *  🌕 🌖 🌗 🌘  ❀❀❀   WARM TIPS!!!   ❀❀❀ 🌑 🌒 🌓 🌔
@@ -60,9 +75,8 @@
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAYAxis;
import com.github.AAChartModel.AAChartCore.AATools.AAColor;
public class AAOptionsConstructor
{
    public static AAOptions configureChartOptions (
public class AAOptionsConstructor {
    public static AAOptions configureChartOptions(
            AAChartModel aaChartModel
    ) {
        AAChart aaChart = new AAChart()
@@ -73,19 +87,16 @@
                .panning(true) //设置手势缩放后是否可平移
                .polar(aaChartModel.polar) //是否极化图表(开启极坐标模式)
                .margin(aaChartModel.margin) //图表边距
                .scrollablePlotArea(aaChartModel.scrollablePlotArea)
                ;
                .scrollablePlotArea(aaChartModel.scrollablePlotArea);
        AATitle aaTitle = new AATitle()
                .text(aaChartModel.title) //标题文本内容
                .style(aaChartModel.titleStyle)
                ;
                .style(aaChartModel.titleStyle);
        AASubtitle aaSubtitle = new AASubtitle()
                .text(aaChartModel.subtitle) //副标题内容
                .align(aaChartModel.subtitleAlign) //图表副标题文本水平对齐方式。可选的值有 “left”,”center“和“right”。 默认是:center.
                .style(aaChartModel.subtitleStyle)
                ;
                .style(aaChartModel.subtitleStyle);
        AATooltip aaTooltip = new AATooltip()
                .enabled(aaChartModel.tooltipEnabled) //启用浮动提示框
@@ -96,8 +107,7 @@
        AAPlotOptions aaPlotOptions = new AAPlotOptions()
                .series(new AASeries()
                        .stacking(aaChartModel.stacking) //设置是否百分比堆叠显示图形
                )
                ;
                );
        if (!aaChartModel.animationType.equals(AAChartAnimationType.Linear)) {
            aaPlotOptions.series.animation((new AAAnimation()
@@ -106,14 +116,13 @@
            ));
        }
        configureAAPlotOptionsMarkerStyle(aaChartModel,aaPlotOptions);
        configureAAPlotOptionsDataLabels(aaPlotOptions,aaChartModel);
        configureAAPlotOptionsMarkerStyle(aaChartModel, aaPlotOptions);
        configureAAPlotOptionsDataLabels(aaPlotOptions, aaChartModel);
        AALegend aaLegend = new AALegend()
                .enabled(aaChartModel.legendEnabled) //是否显示 legend
                .itemStyle(new AAItemStyle()
                        .color(aaChartModel.axesTextColor))
                ;
                        .color(aaChartModel.axesTextColor));
        AAOptions aaOptions = new AAOptions()
                .chart(aaChart)
@@ -127,12 +136,12 @@
                .touchEventEnabled(aaChartModel.touchEventEnabled) //是否支持点击事件
                ;
        configureAxisContentAndStyle(aaOptions,aaChartModel);
        configureAxisContentAndStyle(aaOptions, aaChartModel);
        return aaOptions;
    }
    private static void configureAAPlotOptionsMarkerStyle (
    private static void configureAAPlotOptionsMarkerStyle(
            AAChartModel aaChartModel,
            AAPlotOptions aaPlotOptions
    ) {
@@ -167,7 +176,7 @@
    }
    private static void configureAAPlotOptionsDataLabels (
    private static void configureAAPlotOptionsDataLabels(
            AAPlotOptions aaPlotOptions,
            AAChartModel aaChartModel
    ) {
@@ -194,8 +203,7 @@
            case AAChartType.Bar:
                AABar aaBar = new AABar()
                        .borderWidth(0f)
                        .borderRadius(aaChartModel.borderRadius)
                        ;
                        .borderRadius(aaChartModel.borderRadius);
                if (aaChartModel.polar) {
                    aaBar.pointPadding(0f)
                            .groupPadding(0.005f);
@@ -224,7 +232,7 @@
    }
    private static void configureAxisContentAndStyle (
    private static void configureAxisContentAndStyle(
            AAOptions aaOptions,
            AAChartModel aaChartModel
    ) {
app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java
@@ -548,7 +548,11 @@
                        Object[] values = new Object[list.size()];
                        for (int i = 0; i < list.size(); i++) {
                            keys[i] = list.get(i).getFieldName();
                            values[i] = HdlCommonLogic.getBigDecimal(list.get(i).getFieldValue()).intValue();//获取整数部分
                            if (TimeType.day.equals(timeType)) {
                                values[i] = HdlCommonLogic.divideByOneThousandAndFormat(list.get(i).getFieldValue());// HdlCommonLogic.getBigDecimal(list.get(i).getFieldValue()).intValue();//获取整数部分
                            } else {
                                values[i] = HdlCommonLogic.getBigDecimal(list.get(i).getFieldValue());
                            }
                        }
                        fieldNames = keys;
                        fieldValues = values;
app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/BasicChartComposer.java
@@ -10,6 +10,7 @@
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartType;
import com.github.AAChartModel.AAChartCore.AAChartEnum.AAChartZoomType;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AAStyle;
import com.github.AAChartModel.AAChartCore.AAOptionsModel.AATooltip;
import com.github.AAChartModel.AAChartCore.AATools.AAColor;
import com.github.AAChartModel.AAChartCore.AATools.AAGradientColor;
import com.github.AAChartModel.AAChartCore.AATools.AALinearGradientDirection;
@@ -68,6 +69,9 @@
                "rgba(56,196,148,0.5)",//深粉色, alpha 透明度1
                "rgba(255,255,255,0)"//热情的粉红, alpha 透明度 0.1
        );//颜色字符串设置支持十六进制类型和 rgba 类型
        AATooltip aaTooltip = new AATooltip()
                .enabled(true)
                .valueDecimals(2);
        AASeriesElement element1 = new AASeriesElement()
                .name(tipSuspendName)
//                .colorByPoint(true)
@@ -76,17 +80,12 @@
//                .borderColor(AARgba(255,255,255,1.0f))
                .fillColor(linearGradientColor)
//                .fillOpacity(0.5)//区域背景透明度,设置0的话看不到区域背景
                .tooltip(aaTooltip)
                .data(data);
//        AASeriesElement element2 = new AASeriesElement()
//                .name("NewYork")
//                .data(new Object[]{0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5});
//        AASeriesElement element3 = new AASeriesElement()
//                .name("London")
//                .data(new Object[]{0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0});
//        AASeriesElement element4 = new AASeriesElement()
//                .name("Berlin")
//                .data(new Object[]{3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8});
//                .data(new Object[]{0.45, 0.43, 0.50, 0.55, 0.58, 0.62, 0.83, 0.39, 0.56, 0.67, 0.50, 0.34, 0.50, 0.67, 0.58, 0.29, 0.46, 0.23, 0.47, 0.46, 0.38, 0.56, 0.48, 0.36});
        return configureBasicOptions()
                .backgroundColor("#EDEFF2")
                .legendEnabled(false)
@@ -96,7 +95,7 @@
                .chartType(AAChartType.Area)
                .categories(categories)
                .zoomType(AAChartZoomType.None)//手势缩放
//                .yAxisMax(500)
//                .yAxisMax(100)
                .yAxisMin(0)
                .series(new AASeriesElement[]{element1});
    }
app/src/main/java/com/hdl/photovoltaic/ui/home/aachart/CustomStyleChartComposer.java
@@ -36,6 +36,9 @@
import java.util.ArrayList;
import java.util.Map;
/**
 * 图表数据渲染
 */
public class CustomStyleChartComposer {
    public static AAChartModel configureColorfulChart() {
@@ -189,6 +192,9 @@
                AALinearGradientDirection.ToBottom,
                stopsArr
        );
        AATooltip aaTooltip = new AATooltip()
                .enabled(true)
                .valueDecimals(2);
        return new AAChartModel()
                .chartType(AAChartType.Column)
                .backgroundColor("#EDEFF2")
@@ -203,7 +209,7 @@
                                .name(tipSuspendName)
                                .data(data)
//                                .colorByPoint(true)
                                .tooltip(new AATooltip().style(new AAStyle().backgroundColor("#FFFFFF").fontSize(25)))
                                .tooltip(aaTooltip)
                });
    }
app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseAndDeviceFragment.java
@@ -118,17 +118,10 @@
                    return;
                }
                isClickPowerStationLabel = true;
                viewBinding.powerStationLabel.setTextAppearance(R.style.Text20Style);
                viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style);
                viewBinding.editIv.setVisibility(View.VISIBLE);//编辑图标隐藏
                viewBinding.addIv.setVisibility(View.VISIBLE);//添加图标隐藏
                viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//电站标签【父容器】显示
                viewBinding.deviceLabelParent.setVisibility(View.GONE);//设备标签【父容器】隐藏
                if (viewBinding.deviceNullDataIc.getRoot().getVisibility() == View.VISIBLE) {
                    viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE);
                }
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
                selectedTitleLabelStyle();
                getStatusOverview();
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
        });
        //设备标签
@@ -139,15 +132,7 @@
                    return;
                }
                isClickPowerStationLabel = false;
                viewBinding.deviceLabel.setTextAppearance(R.style.Text20Style);
                viewBinding.powerStationLabel.setTextAppearance(R.style.Text16Style);
                viewBinding.editIv.setVisibility(View.GONE);//编辑图标隐藏
                viewBinding.addIv.setVisibility(View.GONE);//添加图标隐藏
                viewBinding.powerStationLabelParent.setVisibility(View.GONE);//电站标签【父容器】隐藏
                viewBinding.deviceLabelParent.setVisibility(View.VISIBLE);//设备标签【父容器】显示
                if (viewBinding.homeNullDataIc.getRoot().getVisibility() == View.VISIBLE) {
                    viewBinding.homeNullDataIc.getRoot().setVisibility(View.GONE);
                }
                selectedTitleLabelStyle();
                loadNextPageDeviceList(true, 1, true);
            }
        });
@@ -156,7 +141,7 @@
            @Override
            public void onClick(View v) {
                powerStationStatusValue = PowerStationStatus.All;
                selectedStationStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true);
                selectedStationStateStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
        });
@@ -165,7 +150,7 @@
            @Override
            public void onClick(View v) {
                powerStationStatusValue = PowerStationStatus.malfunction;
                selectedStationStyle(viewBinding.powerStationFaultsIl.parentLl, viewBinding.powerStationFaultsIl.stationTotalTv, viewBinding.powerStationFaultsIl.stationTitleTv, true);
                selectedStationStateStyle(viewBinding.powerStationFaultsIl.parentLl, viewBinding.powerStationFaultsIl.stationTotalTv, viewBinding.powerStationFaultsIl.stationTitleTv, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
        });
@@ -174,7 +159,7 @@
            @Override
            public void onClick(View v) {
                powerStationStatusValue = PowerStationStatus.off;
                selectedStationStyle(viewBinding.powerStationOfflineIl.parentLl, viewBinding.powerStationOfflineIl.stationTotalTv, viewBinding.powerStationOfflineIl.stationTitleTv, true);
                selectedStationStateStyle(viewBinding.powerStationOfflineIl.parentLl, viewBinding.powerStationOfflineIl.stationTotalTv, viewBinding.powerStationOfflineIl.stationTitleTv, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
        });
@@ -183,7 +168,7 @@
            @Override
            public void onClick(View v) {
                powerStationStatusValue = PowerStationStatus.connecting;
                selectedStationStyle(viewBinding.powerStationConnectedIl.parentLl, viewBinding.powerStationConnectedIl.stationTotalTv, viewBinding.powerStationConnectedIl.stationTitleTv, true);
                selectedStationStateStyle(viewBinding.powerStationConnectedIl.parentLl, viewBinding.powerStationConnectedIl.stationTotalTv, viewBinding.powerStationConnectedIl.stationTitleTv, true);
                loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
            }
        });
@@ -506,7 +491,7 @@
        viewBinding.powerStationOfflineIl.stationTitleTv.setText(getString(R.string.my_power_station_off_line));
        viewBinding.powerStationConnectedIl.stationTitleTv.setText(getString(R.string.to_be_added));
        selectedStationStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true);
        selectedStationStateStyle(viewBinding.powerStationAllIl.parentLl, viewBinding.powerStationAllIl.stationTotalTv, viewBinding.powerStationAllIl.stationTitleTv, true);
        //电站标签
        houseInfoAdapter = new HouseInfoAdapter(_mActivity);
        viewBinding.fragmentHouseSrlListRc.setLayoutManager(new LinearLayoutManager(_mActivity));
@@ -523,6 +508,34 @@
    }
    /**
     * 电站和设备标签样式
     */
    private void selectedTitleLabelStyle() {
        if (isClickPowerStationLabel) {
            viewBinding.powerStationLabel.setTextAppearance(R.style.Text20Style);
            viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style);
            viewBinding.editIv.setVisibility(View.VISIBLE);//编辑图标隐藏
            viewBinding.addIv.setVisibility(View.VISIBLE);//添加图标隐藏
            viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//电站标签【父容器】显示
            viewBinding.deviceLabelParent.setVisibility(View.GONE);//设备标签【父容器】隐藏
            if (viewBinding.deviceNullDataIc.getRoot().getVisibility() == View.VISIBLE) {
                viewBinding.deviceNullDataIc.getRoot().setVisibility(View.GONE);
            }
        } else {
            viewBinding.deviceLabel.setTextAppearance(R.style.Text20Style);
            viewBinding.powerStationLabel.setTextAppearance(R.style.Text16Style);
            viewBinding.editIv.setVisibility(View.GONE);//编辑图标隐藏
            viewBinding.addIv.setVisibility(View.GONE);//添加图标隐藏
            viewBinding.powerStationLabelParent.setVisibility(View.GONE);//电站标签【父容器】隐藏
            viewBinding.deviceLabelParent.setVisibility(View.VISIBLE);//设备标签【父容器】显示
            if (viewBinding.homeNullDataIc.getRoot().getVisibility() == View.VISIBLE) {
                viewBinding.homeNullDataIc.getRoot().setVisibility(View.GONE);
            }
        }
    }
    /**
     * 显示选中状态样式
     *
     * @param linearLayout         组件
@@ -530,7 +543,7 @@
     * @param titleTv              组件
     * @param isShowSelectedStatus 是否显示状态样式
     */
    private void selectedStationStyle(LinearLayout linearLayout, TextView numberTv, TextView titleTv, boolean isShowSelectedStatus) {
    private void selectedStationStateStyle(LinearLayout linearLayout, TextView numberTv, TextView titleTv, boolean isShowSelectedStatus) {
        viewBinding.powerStationAllIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
        viewBinding.powerStationFaultsIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
        viewBinding.powerStationOfflineIl.parentLl.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.station_status_no_ffffff));
@@ -651,17 +664,25 @@
                HdlLogLogic.print("正在点击【电站】");
                if (!isReadData) {
                    //1,从首页-故障-进来-电站(不读取)
                    //1,从电站-进来-电站(读取一次,后面进来不在读取)
                    //2,从电站-进来-电站(读取一次,后面进来不在读取)
                    loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true);
                    getStatusOverview();
                }
            } else if (eventBus.getType().equals(PowerStationStatus.All)) {
                isClickPowerStationLabel = true;
                selectedTitleLabelStyle();
                viewBinding.powerStationAllIl.parentLl.performClick();
            } else if (eventBus.getType().equals(PowerStationStatus.malfunction)) {
                isClickPowerStationLabel = true;
                selectedTitleLabelStyle();
                viewBinding.powerStationFaultsIl.parentLl.performClick();
            } else if (eventBus.getType().equals(PowerStationStatus.off)) {
                isClickPowerStationLabel = true;
                selectedTitleLabelStyle();
                viewBinding.powerStationOfflineIl.parentLl.performClick();
            } else if (eventBus.getType().equals(PowerStationStatus.connecting)) {
                isClickPowerStationLabel = true;
                selectedTitleLabelStyle();
                viewBinding.powerStationConnectedIl.parentLl.performClick();
            } else if (eventBus.getType().equals(ConstantManage.station_edit)) {
                //编辑后更新一下住宅列表