From 44ba605a4e850efa757020da5fb4cf02bdf6e3ab Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期一, 08 九月 2025 10:55:18 +0800
Subject: [PATCH] 2025年09月08日10:55:15
---
app/src/main/java/com/hdl/photovoltaic/ui/home/HomePageFragment.java | 702 +++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 569 insertions(+), 133 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 af3f440..96f9445 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,12 +1,21 @@
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.Manifest;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.location.LocationManager;
+import android.os.AsyncTask;
import android.os.Bundle;
+import android.provider.Settings;
import android.text.TextUtils;
import android.view.View;
+
+import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
@@ -15,16 +24,46 @@
import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartModel;
import com.github.AAChartModel.AAChartCore.AAChartCreator.AAChartView;
import com.github.AAChartModel.AAChartCore.AAChartCreator.AAMoveOverEventMessageModel;
+import com.hdl.linkpm.sdk.HDLLinkPMSdk;
+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.other.HdlDeviceLogic;
+import com.hdl.photovoltaic.enums.PowerStationStatus;
+import com.hdl.photovoltaic.enums.TimeType;
+import com.hdl.photovoltaic.enums.UnitType;
+import com.hdl.photovoltaic.listener.CloudCallBeak;
+import com.hdl.photovoltaic.listener.OnCallBeak;
+import com.hdl.photovoltaic.other.HdlCommonLogic;
+import com.hdl.photovoltaic.other.HdlDialogLogic;
import com.hdl.photovoltaic.other.HdlLogLogic;
+import com.hdl.photovoltaic.other.HdlPowerStationDataStatisticsLogic;
+import com.hdl.photovoltaic.other.HdlResidenceLogic;
import com.hdl.photovoltaic.other.HdlThreadLogic;
+import com.hdl.photovoltaic.other.HdlUniLogic;
+import com.hdl.photovoltaic.ui.StartActivity;
+import com.hdl.photovoltaic.ui.adapter.LanguageAdapter;
+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.bean.StatusOverviewBean;
+import com.hdl.photovoltaic.ui.home.aachart.BasicChartComposer;
+import com.hdl.photovoltaic.uni.HDLUniMP;
+import com.hdl.photovoltaic.utils.AppManagerUtils;
+import com.hdl.photovoltaic.utils.GPSManagerUtils;
+import com.hdl.photovoltaic.utils.PermissionUtils;
import com.hdl.photovoltaic.utils.TimeUtils;
+import com.hdl.photovoltaic.widget.AddPowerStationDialog;
+import com.hdl.photovoltaic.widget.ConfirmationCancelDialog;
+import com.hdl.photovoltaic.widget.FlashingBoxDialog;
+import com.hdl.photovoltaic.widget.adapter.ListDialogAdapter;
+import com.hdl.photovoltaic.widget.adapter.PowerStationDialogAdapter;
+import com.hdl.photovoltaic.widget.refreshlayout.BGARefreshLayout;
+import com.hdl.photovoltaic.widget.refreshlayout.HDLRefreshViewHolder;
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import org.greenrobot.eventbus.EventBus;
@@ -33,22 +72,28 @@
import java.util.Calendar;
import java.util.Date;
+import java.util.List;
/**
* 棣栭〉妯″潡
*/
-public class HomePageFragment extends CustomBaseFragment implements AAChartView.AAChartViewCallBack {
+public class HomePageFragment extends CustomBaseFragment implements AAChartView.AAChartViewCallBack, BGARefreshLayout.BGARefreshLayoutDelegate {
FragmentHomePageBinding viewBinding;
- AAChartView aaChartView;
+ AutoSizeMyAAChart aaChartView;
AAChartModel aaChartModel;
- private TimeType timeType = TimeType.day;//鏃堕棿绫诲瀷(榛樿锛氬ぉ)
+ private String[] fieldNames = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"};//鍥炬爣X杞村潗鏍囧�肩殑鏁扮粍
+ private Object[] fieldValues = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};//鍥炬爣Y杞村潗鏍囧�肩殑鏁扮粍
+
+
+ private String timeType = TimeType.day;//鏃堕棿绫诲瀷(榛樿锛氬ぉ)
+ private String debugging_str = "";//鏃堕棿绫诲瀷(榛樿锛氬ぉ)
@Override
@@ -63,11 +108,98 @@
initView();
//鍒濆鍖栫晫闈㈢洃鍚櫒
initEvent();
+ //璇诲彇鏁版嵁
+ readDate();
+ }
+ /**
+ * 璇诲彇鏁版嵁
+ */
+ private void readDate() {
+ HdlThreadLogic.runSubThread(new Runnable() {
+ @Override
+ public void run() {
+ getStatusOverview();
+ getDataOver();
+ getStatistics();
+ getSocialContribution();
+
+ }
+ });
}
private void initEvent() {
+ //鐢电珯娣诲姞
+ 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);
+// AddPowerStationDialog addPowerStationDialog = new AddPowerStationDialog(_mActivity);
+// addPowerStationDialog.show();
+// addPowerStationDialog.setCanceledOnTouchOutside(true);
+// addPowerStationDialog.setItemOnclickListener(new PowerStationDialogAdapter.OnclickListener() {
+// @Override
+// public void onClick(int position, String str) {
+//// debugging_str = str;
+// addPowerStationDialog.dismiss();
+//// UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1);
+//// if (_mActivity.getString(R.string.simple_debugging).equals(str)) {
+//// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION_SIMPLE, null);
+//// } else {
+//// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null);
+//// }
+//// requestPermissions(new OnCallBeak() {
+//// @Override
+//// public void onClickCallBeak() {
+////// UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1);
+////// HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null);
+//// }
+//// });
+// }
+// });
+
+
+ }
+ });
+ viewBinding.homePageStationAddIv.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1);
+ HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION_SIMPLE, null);
+ return true;
+ }
+ });
+
+ //鍏ㄩ儴
+ viewBinding.homeAllIl.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, ConstantManage.station_page, PowerStationStatus.All);
+ }
+ });
+ //鏁呴殰
+ viewBinding.homeFaultsIl.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, ConstantManage.station_page, PowerStationStatus.malfunction);
+ }
+ });
+ //绂荤嚎
+ viewBinding.homeOfflineIl.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, ConstantManage.station_page, PowerStationStatus.off);
+ }
+ });
+ //寰呮帴鍏�
+ viewBinding.homeConnectedIl.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ HdlCommonLogic.getInstance().postEventBusSticky(ConstantManage.homepage_title_tab_switch, ConstantManage.station_page, PowerStationStatus.connecting);
+ }
+ });
//鏃堕棿閫夋嫨鍣�
viewBinding.yearMonthDayTv.setOnClickListener(new View.OnClickListener() {
@Override
@@ -80,28 +212,33 @@
viewBinding.dayTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ if (timeType.equals(TimeType.day)) {
+ //鐐瑰嚮鍚屼竴涓被鍨�
+ return;
+ }
timeType = TimeType.day;
-
- viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494));
- viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_38C494));
+ viewBinding.unitTv.setText(UnitType.kW);
+ viewBinding.unitTextTv.setText(getString(R.string.pv_power));
+ viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_39383d));
+ viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_FFACACAC));
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_FF5B5B5B));
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_FF5B5B5B));
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_FF5B5B5B));
viewBinding.v1.setVisibility(View.GONE);
viewBinding.v2.setVisibility(View.VISIBLE);
viewBinding.v3.setVisibility(View.VISIBLE);
viewBinding.homePageStationSelectTimeLl.setVisibility(View.VISIBLE);
- String dataStr = TimeUtils.getDateTimestamp(getCurrentTimestamp(), getTimeDateFormat());
+ String dataStr = TimeUtils.getDateTimestamp(TimeUtils.getCurrentTimestamp(), TimeUtils.getTimeDateFormat(timeType));
viewBinding.yearMonthDayTv.setText(dataStr);
- setUpAAChartView();
+ getStatistics();
}
});
@@ -109,26 +246,32 @@
viewBinding.monthTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ if (timeType.equals(TimeType.month)) {
+ //鐐瑰嚮鍚屼竴涓被鍨�
+ return;
+ }
timeType = TimeType.month;
+ viewBinding.unitTv.setText(UnitType.kWh);
+ viewBinding.unitTextTv.setText(getString(R.string.generation));
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_FF5B5B5B));
- viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494));
- viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_38C494));
+ viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_39383d));
+ viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_FFACACAC));
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_FF5B5B5B));
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_FF5B5B5B));
viewBinding.v1.setVisibility(View.GONE);
viewBinding.v2.setVisibility(View.GONE);
viewBinding.v3.setVisibility(View.VISIBLE);
viewBinding.homePageStationSelectTimeLl.setVisibility(View.VISIBLE);
- String dataStr = TimeUtils.getDateTimestamp(getCurrentTimestamp(), getTimeDateFormat());
+ String dataStr = TimeUtils.getDateTimestamp(TimeUtils.getCurrentTimestamp(), TimeUtils.getTimeDateFormat(timeType));
viewBinding.yearMonthDayTv.setText(dataStr);
- setUpAAChartView();
+ getStatistics();
}
@@ -137,51 +280,62 @@
viewBinding.yearTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ if (timeType.equals(TimeType.year)) {
+ //鐐瑰嚮鍚屼竴涓被鍨�
+ return;
+ }
timeType = TimeType.year;
+ viewBinding.unitTv.setText(UnitType.kWh);
+ viewBinding.unitTextTv.setText(getString(R.string.generation));
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_FF5B5B5B));
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_FF5B5B5B));
- viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494));
- viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_38C494));
+ viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_39383d));
+ viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_FFACACAC));
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_FF5B5B5B));
viewBinding.v1.setVisibility(View.VISIBLE);
viewBinding.v2.setVisibility(View.GONE);
viewBinding.v3.setVisibility(View.GONE);
viewBinding.homePageStationSelectTimeLl.setVisibility(View.VISIBLE);
- String dataStr = TimeUtils.getDateTimestamp(getCurrentTimestamp(), getTimeDateFormat());
+ String dataStr = TimeUtils.getDateTimestamp(TimeUtils.getCurrentTimestamp(), TimeUtils.getTimeDateFormat(timeType));
viewBinding.yearMonthDayTv.setText(dataStr);
- setUpAAChartView();
+ getStatistics();
}
});
//鐢熷懡鏈�
viewBinding.lifeCycleTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- timeType = TimeType.lifecycle;
+ if (timeType.equals(TimeType.all)) {
+ //鐐瑰嚮鍚屼竴涓被鍨�
+ return;
+ }
+ timeType = TimeType.all;
+ viewBinding.unitTv.setText(UnitType.kWh);
+ viewBinding.unitTextTv.setText(getString(R.string.generation));
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_FF5B5B5B));
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_FF5B5B5B));
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_FF5B5B5B));
- viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_38c494));
- viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_38C494));
+ viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_39383d));
+ viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_FFACACAC));
viewBinding.v1.setVisibility(View.VISIBLE);
viewBinding.v2.setVisibility(View.VISIBLE);
viewBinding.v3.setVisibility(View.GONE);
viewBinding.homePageStationSelectTimeLl.setVisibility(View.GONE);
-
- setUpAAChartView();
+ getStatistics();
}
});
@@ -193,11 +347,12 @@
if (TextUtils.isEmpty(currDate)) {
return;
}
- String timeDateFormat = getTimeDateFormat();
+ String timeDateFormat = TimeUtils.getTimeDateFormat(timeType);
Calendar calendar = TimeUtils.stringToCalendar(currDate, timeDateFormat);
String time = TimeUtils.subtractDayMonthYearFromDate(calendar, 1, timeDateFormat, timeType);
+ //涓嶉渶瑕侀檺鍒舵渶灏忔棩鏈燂紝鍥犱负鏄煡璇㈣处鍙蜂笅鎵�鏈夌數绔欙紝鏃犳硶鐭ラ亾鏈�灏忓缓绔欐棩鏈�
viewBinding.yearMonthDayTv.setText(time);
-
+ getStatistics();
}
});
@@ -209,50 +364,30 @@
if (TextUtils.isEmpty(currDate)) {
return;
}
- String timeDateFormat = getTimeDateFormat();
+ String timeDateFormat = TimeUtils.getTimeDateFormat(timeType);
Calendar calendar = TimeUtils.stringToCalendar(currDate, timeDateFormat);
String time = TimeUtils.addDayMonthYearToDate(calendar, 1, timeDateFormat, timeType);
- if (TimeUtils.stringDateToTimestamp(time, timeDateFormat) > getCurrentTimestamp()) {
- HdlThreadLogic.toast(_mActivity, getString(R.string.the_query_date_is_exceeded));
+ if (TimeUtils.stringDateToTimestamp(time, timeDateFormat) > TimeUtils.getCurrentTimestamp()) {
+ FlashingBoxDialog flashingBoxDialog = new FlashingBoxDialog(_mActivity, 1500);
+ flashingBoxDialog.setContent(getString(R.string.the_query_date_is_exceeded));
+ flashingBoxDialog.show();
return;
}
viewBinding.yearMonthDayTv.setText(time);
+ getStatistics();
}
});
- }
+ //璁剧疆涓嬫媺绠ご棰滆壊
+// viewBinding.rsl.setColorSchemeResources(R.color.text_FF245EC3);
+// viewBinding.rsl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
+// @Override
+// public void onRefresh() {
+// viewBinding.rsl.setRefreshing(false);
+// readDate();
+// }
+// });
- private void initView() {
-
- String dataStr = TimeUtils.getDateTimestamp(getCurrentTimestamp(), getTimeDateFormat());
- viewBinding.yearMonthDayTv.setText(dataStr);
-
- String installed_capacity = getString(R.string.installed_capacity) + "(" + HdlDeviceLogic.kWp + ")";
- viewBinding.homePageStationInfoRl1Text2Tv.setText(installed_capacity);
- String generated_power = getString(R.string.generated_power) + "(" + HdlDeviceLogic.kW + ")";
- viewBinding.homePageStationInfoRl1Text4Tv.setText(generated_power);
- String generation = getString(R.string.generation) + "(" + HdlDeviceLogic.kWp + ")";
- viewBinding.homePageStationInfoRl1TitleTv.setText(generation);
-
- viewBinding.homePageStationInfoRl2DayIc.dataTypeTv.setText(R.string.day_power_generation);
- viewBinding.homePageStationInfoRl2MonIc.dataTypeTv.setText(R.string.month_power_generation);
- viewBinding.homePageStationInfoRl2YearIc.dataTypeTv.setText(R.string.year_power_generation);
- viewBinding.homePageStationInfoRl2CumulativeIc.dataTypeTv.setText(R.string.cumulative_power_generation);
-
-
- 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.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
- viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
- viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
- viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_40000000));
- viewBinding.v1.setVisibility(View.GONE);
- viewBinding.v2.setVisibility(View.VISIBLE);
- viewBinding.v3.setVisibility(View.VISIBLE);
- viewBinding.homePageStationSelectTimeLl.setVisibility(View.VISIBLE);
- setUpAAChartView();//鍥捐〃鍔犺浇
}
@@ -260,53 +395,56 @@
* 鏃堕棿閫夋嫨鍣�
*/
private void selectedTimePickerBuilder() {
+
String currDate = viewBinding.yearMonthDayTv.getText().toString();
- if (TextUtils.isEmpty(currDate)) {
- return;
- }
//鏃堕棿閫夋嫨鍣�
- Calendar selectedDate = TimeUtils.stringToCalendar(currDate, getTimeDateFormat());
+ Calendar selectedDate = TimeUtils.stringToCalendar(currDate, TimeUtils.getTimeDateFormat(timeType));
Calendar startDate = Calendar.getInstance();
- Calendar endDate = TimeUtils.timestampToCalendar(getCurrentTimestamp());
+ Calendar endDate = TimeUtils.timestampToCalendar(TimeUtils.getCurrentTimestamp());
//璁剧疆鏃ユ湡銆愬紑濮嬨�戝拰銆愮粨鏉熴��
startDate.set(2023, 1, 1);
endDate.set(endDate.get(Calendar.YEAR), endDate.get(Calendar.MONTH), endDate.get(Calendar.DAY_OF_MONTH));
boolean day = true;
boolean month = true;
boolean year = true;
- if (timeType == TimeType.month) {
+ if (timeType.equals(TimeType.month)) {
day = false;
- } else if (timeType == TimeType.year) {
+ } else if (timeType.equals(TimeType.year)) {
day = false;
month = false;
}
TimePickerView pvTime = new TimePickerBuilder(_mActivity, new OnTimeSelectListener() {
@Override
public void onTimeSelect(Date date, View v) {//閫変腑浜嬩欢鍥炶皟
- String timeDateFormat = getTimeDateFormat();
+ String timeDateFormat = TimeUtils.getTimeDateFormat(timeType);
String time = TimeUtils.dateToString(date, timeDateFormat);
+ if (viewBinding.yearMonthDayTv.getText().toString().equals(time)) {
+ //琛ㄧず鍚屼竴涓椂闂�
+ return;
+ }
viewBinding.yearMonthDayTv.setText(time);
+ getStatistics();
}
}).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_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)// 濡傛灉涓嶈缃殑璇濓紝榛樿鏄郴缁熸椂闂�*/
+// .setTitleColor(_mActivity.getColor(R.color.text_FFACACAC))//鏍囬鏂囧瓧棰滆壊
+ .setSubmitColor(_mActivity.getColor(R.color.text_FFACACAC))//纭畾鎸夐挳鏂囧瓧棰滆壊
+ .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_FFACACAC)).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();
}
@@ -314,19 +452,71 @@
/**
* 鍥捐〃鍔犺浇
*/
- private void setUpAAChartView() {
- aaChartView = viewBinding.AAChartView;
+ private void setUpAAChartView(boolean needDelay) {
+ aaChartView = viewBinding.autoSizeMyAAChart;
aaChartView.callBack = this;
- if (TimeType.day == timeType) {
- aaChartModel = BasicChartComposer.configureAreaChart();
- } else if (TimeType.month == timeType
- || TimeType.year == timeType
- || TimeType.lifecycle == timeType) {
- aaChartModel = configureColorfulColumnChart();
+ if (TimeType.day.equals(timeType)) {
+ aaChartModel = BasicChartComposer.configureAreaChart(getString(R.string.pv_power), fieldNames, fieldValues);
+ } else if (TimeType.month.equals(timeType) || TimeType.year.equals(timeType) || TimeType.all.equals(timeType)) {
+ aaChartModel = configureColorfulColumnChart(getString(R.string.generation), fieldNames, fieldValues);
}
- aaChartView.aa_drawChartWithChartModel(aaChartModel);
+ aaChartView.aa_drawChartWithChartOptions(aaChartModel.aa_toAAOptions());
}
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ }
+
+ private void initView() {
+
+ String dataStr = TimeUtils.getDateTimestamp(TimeUtils.getCurrentTimestamp(), TimeUtils.getTimeDateFormat(timeType));
+ viewBinding.yearMonthDayTv.setText(dataStr);
+
+// String installed_capacity = getString(R.string.string_capacity) + "(" + UnitType.kWp + ")";
+// viewBinding.infoRl1Text2Tv.setText(installed_capacity);
+// String generated_power = getString(R.string.generated_power) + "(" + UnitType.kW + ")";
+// viewBinding.infoRl1Text4Tv.setText(generated_power);
+// String generation = getString(R.string.generation) + "/" + UnitType.kWh;
+// viewBinding.homePageStationInfoRl1TitleTv.setText(generation);
+
+// viewBinding.day.setText(R.string.day_power_generation);
+// viewBinding.month.setText(R.string.month_power_generation);
+// viewBinding.year.setText(R.string.year_power_generation);
+// viewBinding.Total.setText(R.string.cumulative_power_generation);
+//
+ viewBinding.unitTv.setText(UnitType.kW);
+
+
+ viewBinding.dayTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.drawable.time_selected_39383d));
+ viewBinding.dayTv.setTextColor(_mActivity.getColor(R.color.text_FFACACAC));
+ viewBinding.monthTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+ viewBinding.monthTv.setTextColor(_mActivity.getColor(R.color.text_FF5B5B5B));
+ viewBinding.yearTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+ viewBinding.yearTv.setTextColor(_mActivity.getColor(R.color.text_FF5B5B5B));
+ viewBinding.lifeCycleTv.setBackground(AppCompatResources.getDrawable(_mActivity, R.color.text_00000000));
+ viewBinding.lifeCycleTv.setTextColor(_mActivity.getColor(R.color.text_FF5B5B5B));
+ viewBinding.v1.setVisibility(View.GONE);
+ 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);//鍥捐〃鍔犺浇
+ pullToRefresh();
+
+ }
+
+ /**
+ * 涓嬫媺鍒锋柊鐨勯�昏緫
+ */
+ protected void pullToRefresh() {
+ viewBinding.rsl.setDelegate(this);
+ HDLRefreshViewHolder hdlRefreshViewHolder = new HDLRefreshViewHolder(_mActivity, true);
+ hdlRefreshViewHolder.setPullDownImageResource(R.mipmap.loading_44);
+ hdlRefreshViewHolder.setChangeToReleaseRefreshAnimResId(R.drawable.loading_refresh);
+ hdlRefreshViewHolder.setRefreshingAnimResId(R.drawable.loading_refresh_end);
+ viewBinding.rsl.setRefreshViewHolder(hdlRefreshViewHolder);
+ }
@Override
public void chartViewDidFinishLoad(AAChartView aaChartView) {
@@ -351,59 +541,305 @@
// 鍙栨秷绮樻�т簨浠�
EventBus.getDefault().removeStickyEvent(eventBus);
HdlLogLogic.print("姝e湪鐐瑰嚮銆愰椤点��");
-
}
}
}
/**
- * 鑾峰彇褰撳墠绯荤粺鏃ユ湡鏃堕棿鎴�
- *
- * @return 鏃堕棿鎴�
+ * 鐢电珯鐘舵�佹瑙�
*/
- private long getCurrentTimestamp() {
- return new Date().getTime();
+ private void getStatusOverview() {
+ HdlResidenceLogic.getInstance().getStatusOverview("", "", "", new CloudCallBeak<StatusOverviewBean>() {
+ @Override
+ public void onSuccess(StatusOverviewBean statusOverviewBean) {
+ if (statusOverviewBean == null) {
+ return;
+ }
+ viewBinding.stationAllTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getTotal()));
+ viewBinding.stationFaultsTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getFault()));
+ viewBinding.stationOfflineTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getOffline()));
+ viewBinding.stationConnectedTotalTv.setText(HdlCommonLogic.convertString(statusOverviewBean.getConnecting()));
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+
+ }
+ });
+ }
+
+
+ /**
+ * 鑾峰彇缁熻姒傝鏁版嵁(鍏徃缁村害)
+ */
+ private void getDataOver() {
+
+ HdlPowerStationDataStatisticsLogic.getInstance().getDataOver(new CloudCallBeak<DataOverBean>() {
+ @Override
+ public void onSuccess(DataOverBean dataOverBean) {
+ HdlThreadLogic.runMainThread(new Runnable() {
+ @Override
+ public void run() {
+ if (dataOverBean == null) {
+ return;
+ }
+ String capacityValue = HdlCommonLogic.convertDoubleValue(dataOverBean.getInstalledCapacity(), UnitType.kWp);
+ viewBinding.infoRl1Text1Tv.setText(capacityValue);
+ viewBinding.kwpUnit.setText(HdlCommonLogic.convertKWPUnit(dataOverBean.getInstalledCapacity()));
+ viewBinding.infoRl1Text3Tv.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getPower(), UnitType.kW));
+ viewBinding.kwUnit.setText(HdlCommonLogic.convertKWUnit(dataOverBean.getPower()));
+
+// String str = dataOverBean.getPowerRatio() + "%";
+// int startIndex = str.lastIndexOf("%");
+// int endIndex = str.lastIndexOf("%") + 1;
+// SpannableString spannableString = new SpannableString(str);
+// //璁剧疆绗竴閮ㄥ垎鏂囧瓧鐨勫瓧浣撳ぇ灏�
+// spannableString.setSpan(new AbsoluteSizeSpan((int) UnitConversionUtils.dpToPx(HDLApp.getInstance(), 12)), startIndex, endIndex, 0);
+// // 鍒涘缓涓�涓狥oregroundColorSpan瀵硅薄锛屽弬鏁版槸棰滆壊鍊�
+// ForegroundColorSpan colorSpan = new ForegroundColorSpan(HDLApp.getInstance().getColor(R.color.text_FF5B5B5B));
+// spannableString.setSpan(colorSpan, startIndex, endIndex, 0);
+// viewBinding.infoRl1FText1Tv.setText(spannableString);
+ viewBinding.infoRl1FText1Tv.setText(dataOverBean.getPowerRatio());
+ try {
+ int progress = 0;
+ if (!TextUtils.isEmpty(dataOverBean.getPowerRatio())) {
+ progress = (int) Double.parseDouble(dataOverBean.getPowerRatio());
+ if (progress > 100) {
+ progress = 100;
+ }
+ if (progress < 0) {
+ progress = 0;
+ }
+ viewBinding.progressBar.setProgress(progress);
+ }
+
+ } catch (Exception ignored) {
+ }
+
+ viewBinding.day.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getTodayElectricity(), UnitType.kWh));
+ viewBinding.dayUnit.setText(HdlCommonLogic.convertKWHUnit(dataOverBean.getTodayElectricity()));
+ viewBinding.month.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getMonthElectricity(), UnitType.kWh));
+ viewBinding.monthUnit.setText(HdlCommonLogic.convertKWHUnit(dataOverBean.getMonthElectricity()));
+ viewBinding.year.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getYearElectricity(), UnitType.kWh));
+ viewBinding.yearUnit.setText(HdlCommonLogic.convertKWHUnit(dataOverBean.getYearElectricity()));
+ viewBinding.Total.setText(HdlCommonLogic.convertDoubleValue(dataOverBean.getTotalElectricity(), UnitType.kWh));
+ viewBinding.TotalUnit.setText(HdlCommonLogic.convertKWHUnit(dataOverBean.getTotalElectricity()));
+
+ }
+ });
+ }
+
+ @Override
+ public void onFailure(HDLException e) {
+
+ }
+ });
}
/**
- * 鑾峰彇鏃ユ湡鏍煎紡 (2024/2/09,yyyy/DD/dd)
- *
- * @return 鏃ユ湡鏍煎紡 (2024/2/09,yyyy/DD/dd)
+ * 鍙戠數閲忕粺璁�(鍏徃缁村害)
*/
- private String getTimeDateFormat() {
- String timeDateFormat = TimeUtils.zhDateYearMonthDayFormat;
- switch (timeType) {
- case day: {
- timeDateFormat = TimeUtils.zhDateYearMonthDayFormat;
- if (!UserConfigManage.getInstance().isZh()) {
- timeDateFormat = TimeUtils.enDateYearMonthDayFormat;
- }
+ private void getStatistics() {
+ String currDate = viewBinding.yearMonthDayTv.getText().toString();
+ HdlPowerStationDataStatisticsLogic.getInstance().getStatistics(timeType, currDate, new CloudCallBeak<List<StatisticsBean>>() {
+ @Override
+ public void onSuccess(List<StatisticsBean> list) {
+ HdlThreadLogic.runMainThread(new Runnable() {
+ @Override
+ public void run() {
+ if (list == null || list.isEmpty()) {
+ return;
+ }
+ String[] keys = new String[list.size()];
+ Object[] values = new Object[list.size()];
+ for (int i = 0; i < list.size(); i++) {
+ StatisticsBean statisticsBean = list.get(i);
+ keys[i] = statisticsBean.getFieldName();
+ if (TimeType.day.equals(timeType)) {
+ if (statisticsBean.isFuture()) {
+ //鏈潵鏃堕棿涓嶆樉绀�
+ values[i] = null;
+ } else {
+ values[i] = HdlCommonLogic.convertBigDecimal(statisticsBean.getFieldValue(), 1000);// HdlCommonLogic.getBigDecimal(list.get(i).getFieldValue()).intValue();//鑾峰彇鏁存暟閮ㄥ垎
+ }
+ } else {
+ if (statisticsBean.isFuture()) {
+ //鏈潵鏃堕棿涓嶆樉绀�
+ values[i] = null;
+ } else {
+ values[i] = HdlCommonLogic.getBigDecimal(statisticsBean.getFieldValue());
+ }
+ }
+ }
+ fieldNames = keys;
+ fieldValues = values;
+ setUpAAChartView(false);
+ }
+ });
+
}
- break;
- case month: {
- timeDateFormat = TimeUtils.zhDateYearMonthFormat;
- if (!UserConfigManage.getInstance().isZh()) {
- timeDateFormat = TimeUtils.enDateYearMonthFormat;
- }
+
+ @Override
+ public void onFailure(HDLException e) {
+
}
- break;
- case year:
- case lifecycle: {
- timeDateFormat = TimeUtils.zhDateYearFormat;
- if (!UserConfigManage.getInstance().isZh()) {
- timeDateFormat = TimeUtils.enDateYearFormat;
+ });
+ }
+
+ /**
+ * 绀句細璐$尞(鍏徃缁村害)
+ */
+ private void getSocialContribution() {
+ HdlPowerStationDataStatisticsLogic.getInstance().getSocialContribution(new CloudCallBeak<SocialContributionBean>() {
+ @Override
+ public void onSuccess(SocialContributionBean socialContributionBean) {
+ if (socialContributionBean == null) {
+ return;
}
+ viewBinding.socialContributionData1Tv.setText(HdlCommonLogic.convertString(HdlCommonLogic.getBigDecimal(socialContributionBean.getCoal())));
+ viewBinding.socialContributionData2Tv.setText(HdlCommonLogic.convertString(HdlCommonLogic.getBigDecimal(socialContributionBean.getCo2())));
+ viewBinding.socialContributionData3Tv.setText(HdlCommonLogic.convertString(socialContributionBean.getTreePlanting()));
}
- break;
+
+ @Override
+ public void onFailure(HDLException e) {
+
+ }
+ });
+ }
+
+ @Override
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
+ if (requestCode == PermissionUtils.STATUS_SUCCESS) {
+
+ for (int i = 0; i < permissions.length; i++) {
+ if (grantResults[i] == PackageManager.PERMISSION_GRANTED) {
+ switch (permissions[i]) {
+ case Manifest.permission.ACCESS_FINE_LOCATION: {
+ UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1);
+ if (_mActivity.getString(R.string.simple_debugging).equals(debugging_str)) {
+ HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION_SIMPLE, null);
+ } else {
+ HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null);
+ }
+ locationUpdates();
+ }
+ break;
+ }
+ } else {
+ HdlDialogLogic.getInstance().showSettingPermissionDialog(_mActivity, _mActivity.getString(R.string.set_location_permissions));
+ break;
+ }
+
+ }
+ }
+
+ }
+
+ public void requestPermissions(OnCallBeak onCallBeak) {
+
+ //ACCESS_FINE_LOCATION 鍏佽浣跨敤GPS瀹氫綅
+ //ACCESS_COARSE_LOCATION 鍏佽浣跨敤WIFI鐑偣鎴栧熀绔欐潵鑾峰彇绮楃暐鐨勫畾浣�
+ String[] ary = PermissionUtils.checkPermission(_mActivity, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION});
+ if (ary.length > 0) {
+ this.requestPermissions(ary, PermissionUtils.STATUS_SUCCESS);
+ } else {
+ //UserConfigManage.getInstance().setCurrentAppLanguage(itemData.getLanguage());
+ //UserConfigManage.getInstance().Save();
+ UserConfigManage.getInstance().setUniBottomSafeDistanceBackgroundColor(1);
+ if (_mActivity.getString(R.string.simple_debugging).equals(debugging_str)) {
+ HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION_SIMPLE, null);
+ } else {
+ HdlUniLogic.getInstance().openUniMP(HDLUniMP.UNI_EVENT_OPEN_HOME_CREATION, null);
+ }
+ locationUpdates();
}
- return timeDateFormat;
+// if (onCallBeak != null) {
+// onCallBeak.onClickCallBeak();
+// }
}
- public enum TimeType {
- day, month, year, lifecycle
+ /**
+ * 鍒濆鍖栥�愬紑鍚畾浣嶃�戝拰銆愪綅缃俊鎭�戞潈闄�
+ */
+ private void locationUpdates() {
+ // 鍒濆鍖朙ocationManager瀵硅薄
+ LocationManager locationManager = (LocationManager) _mActivity.getSystemService(Context.LOCATION_SERVICE);
+ GPSManagerUtils.getInstance().getLocation(_mActivity);
+ // 鍒ゆ柇璁惧鏄惁鏀寔瀹氫綅鍔熻兘
+ if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
+ // 鎻愮ず鐢ㄦ埛鎵撳紑瀹氫綅鍔熻兘鎴栬�呭紩瀵肩敤鎴峰幓绯荤粺璁剧疆椤甸潰鎵撳紑瀹氫綅鍔熻兘
+ ConfirmationCancelDialog confirmationCancelDialog = new ConfirmationCancelDialog(_mActivity);
+ confirmationCancelDialog.setContent(getString(R.string.system_positioning_switch));
+ confirmationCancelDialog.setConfirmation(getString(R.string.go_to_settings));
+ confirmationCancelDialog.show();
+ confirmationCancelDialog.isHideTitle(true);
+ confirmationCancelDialog.setYesOnclickListener(new ConfirmationCancelDialog.onYesOnclickListener() {
+ @Override
+ public void Confirm() {
+ confirmationCancelDialog.dismiss();
+ Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ HDLApp.getInstance().startActivity(intent);
+
+ }
+ });
+ confirmationCancelDialog.setNoOnclickListener(new ConfirmationCancelDialog.onNoOnclickListener() {
+ @Override
+ public void Cancel() {
+ confirmationCancelDialog.dismiss();
+ }
+ });
+
+ }
+
}
+ @Override
+ public void onBGARefreshLayoutBeginRefreshing(BGARefreshLayout refreshLayout) {
+ new AsyncTask<Void, Void, Void>() {
-}
\ No newline at end of file
+ @Override
+ protected Void doInBackground(Void... params) {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(Void aVoid) {
+ viewBinding.rsl.endRefreshing();
+ //鍔犺浇鏈�鏂版暟鎹畬鎴�
+ readDate();
+ }
+ }.execute();
+ }
+
+ @Override
+ public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout) {
+ new AsyncTask<Void, Void, Void>() {
+
+ @Override
+ protected Void doInBackground(Void... params) {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ protected void onPostExecute(Void aVoid) {
+ viewBinding.rsl.endLoadingMore();
+ }
+ }.execute();
+ return true;
+ }
+}
--
Gitblit v1.8.0