From b63ff58e2c415bae2fb4741aebe710fa3576ff66 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期一, 23 三月 2026 13:11:47 +0800
Subject: [PATCH] 2026年03月23日13:11:38 备份代码
---
app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java | 213 ++++++++++++++++++++++++++++++++++++----------------
1 files changed, 146 insertions(+), 67 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java b/app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java
index 2b997a1..994b3e8 100644
--- a/app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java
+++ b/app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java
@@ -1,27 +1,28 @@
package com.hdl.photovoltaic.widget;
-import android.annotation.SuppressLint;
-import android.app.Dialog;
+import android.app.Activity;
import android.content.Context;
+import android.graphics.Color;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
-import android.view.WindowManager;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
+import androidx.core.content.ContextCompat;
+import com.hdl.photovoltaic.HDLApp;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.base.BaseDialog;
import com.hdl.photovoltaic.databinding.DialogDefaultFilteringBinding;
+import com.hdl.photovoltaic.enums.DebugStatus;
import com.hdl.photovoltaic.enums.GridType;
+import com.hdl.photovoltaic.enums.PowerStationType;
import com.hdl.photovoltaic.enums.UnitType;
-import com.hdl.photovoltaic.other.HdlCommonLogic;
-import com.hdl.photovoltaic.other.HdlDeviceLogic;
import com.hdl.photovoltaic.other.HdlThreadLogic;
public class DefaultFilteringDialog extends BaseDialog {
@@ -41,7 +42,11 @@
final String text8 = "500+";
- private String mStateValue = GridType.All;
+ private String mGridType = GridType.All;
+ /**
+ * 鐢电珯绫诲瀷(INV = 閫嗗彉鍣ㄧ數绔�;BMS = BMS鐢电珯)
+ */
+ private String mPowerStationType = PowerStationType.All;
public DefaultFilteringDialog(@NonNull Context context) {
super(context, R.style.Custom_Dialog);
@@ -51,13 +56,14 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ viewBinding = DialogDefaultFilteringBinding.inflate(getLayoutInflater());
+ setContentView(viewBinding.getRoot());
Window window = getWindow();
if (window != null) {
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
window.setGravity(Gravity.BOTTOM);
}
- viewBinding = DialogDefaultFilteringBinding.inflate(getLayoutInflater());
- setContentView(viewBinding.getRoot());
+// setCanceledOnTouchOutside(false);
//鍒濆鍖栫晫闈㈡帶浠�
initView();
//鍒濆鍖栫晫闈㈡暟鎹�
@@ -69,12 +75,6 @@
}
private void initEvent() {
- viewBinding.clickRl.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- dismiss();
- }
- });
viewBinding.affirmLl.setOnClickListener(new View.OnClickListener() {
@Override
@@ -86,15 +86,15 @@
if (Integer.parseInt(minValue) > Integer.parseInt(maxValue)) {
//鏈�灏忓�煎湪鍓嶉潰
if (mOnClickListener != null) {
- mOnClickListener.confirm(maxValue, minValue, mStateValue);
+ mOnClickListener.confirm(maxValue, minValue, mGridType, mPowerStationType);
}
} else {
if (mOnClickListener != null) {
- mOnClickListener.confirm(minValue, maxValue, mStateValue);
+ mOnClickListener.confirm(minValue, maxValue, mGridType, mPowerStationType);
}
}
} catch (Exception e) {
- //寮哄埗杞崲鍥犺緭鍏ュ�艰秴鍑篿nt鍊煎煙鑼冨洿鎶ュ嚭寮傚父
+// //寮哄埗杞崲鍥犺緭鍏ュ�艰秴鍑篿nt鍊煎煙鑼冨洿鎶ュ嚭寮傚父
int maxValueInt = Integer.MAX_VALUE;
HdlThreadLogic.toast(mContext, mContext.getString(R.string.the_input_value_has_been_exceeded) + "(" + maxValueInt + ").");
return;
@@ -102,7 +102,7 @@
} else {
if (mOnClickListener != null) {
- mOnClickListener.confirm(minValue, maxValue, mStateValue);
+ mOnClickListener.confirm(minValue, maxValue, mGridType, mPowerStationType);
}
}
dismiss();
@@ -122,8 +122,10 @@
public void onClick(View v) {
setBackgroundColor(null, TitleType.string_capacity);
setSelectedText("");
- setBackgroundColor(viewBinding.allTv, TitleType.GridConnectedState);
- mStateValue = GridType.All;
+ setBackgroundColor(viewBinding.allTv, TitleType.debuggingState);
+ setBackgroundColor(viewBinding.powerStationTypeAllTv, TitleType.powerStationType);
+ mGridType = DebugStatus.All;
+ mPowerStationType = PowerStationType.All;
}
});
viewBinding.text1Tv.setOnClickListener(new View.OnClickListener() {
@@ -183,29 +185,78 @@
setSelectedText(viewBinding.text8Tv.getTag().toString());
}
});
-
+ //鍏ㄩ儴
viewBinding.allTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- setBackgroundColor(viewBinding.allTv, TitleType.GridConnectedState);
- mStateValue = GridType.All;
+ setBackgroundColor(viewBinding.allTv, TitleType.debuggingState);
+ mGridType = DebugStatus.All;
}
});
- viewBinding.gridConnectedTv.setOnClickListener(new View.OnClickListener() {
+ //璋冭瘯涓�
+ viewBinding.beDebuggingTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- setBackgroundColor(viewBinding.gridConnectedTv, TitleType.GridConnectedState);
- mStateValue = GridType.FULL_GRID;
+ setBackgroundColor(viewBinding.beDebuggingTv, TitleType.debuggingState);
+ mGridType = DebugStatus.Debugging;
}
});
- viewBinding.offNetworkTv.setOnClickListener(new View.OnClickListener() {
+ //璋冭瘯瀹屾垚
+ viewBinding.debuggingcOmpletedTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- setBackgroundColor(viewBinding.offNetworkTv, TitleType.GridConnectedState);
- mStateValue = GridType.OFFLINE;
+ setBackgroundColor(viewBinding.debuggingcOmpletedTv, TitleType.debuggingState);
+ mGridType = DebugStatus.WAIT_DELIVERED;
+ }
+ });
+ //宸蹭氦浠�
+ viewBinding.deliveredTv.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ setBackgroundColor(viewBinding.deliveredTv, TitleType.debuggingState);
+ mGridType = DebugStatus.Delivered;
+ }
+ });
+ //鎺堟潈璋冭瘯
+ viewBinding.authorizationDebuggingTv.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ setBackgroundColor(viewBinding.authorizationDebuggingTv, TitleType.debuggingState);
+ mGridType = DebugStatus.SECONDARY_DEBUGGIN;
+ }
+ });
+ //鐢电珯绫诲瀷--鍏ㄩ儴
+ viewBinding.powerStationTypeAllTv.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ setBackgroundColor(viewBinding.powerStationTypeAllTv, TitleType.powerStationType);
+ mPowerStationType = PowerStationType.All;
+ }
+ });
+
+ //鐢电珯绫诲瀷--閫嗗彉鍣�
+ viewBinding.powerStationTypeInvTv.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ setBackgroundColor(viewBinding.powerStationTypeInvTv, TitleType.powerStationType);
+ mPowerStationType = PowerStationType.INV;
+ }
+ });
+
+ //鐢电珯绫诲瀷--BMS
+ viewBinding.powerStationTypeBmsTv.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ setBackgroundColor(viewBinding.powerStationTypeBmsTv, TitleType.powerStationType);
+ mPowerStationType = PowerStationType.BMS;
}
});
@@ -244,40 +295,35 @@
*/
private void setBackgroundColor(TextView textView, TitleType titleType) {
if (titleType == TitleType.string_capacity) {
- viewBinding.text1Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.text1Tv.setTextColor(mContext.getColor(R.color.text_E6000000));
- viewBinding.text2Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.text2Tv.setTextColor(mContext.getColor(R.color.text_E6000000));
- viewBinding.text3Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.text3Tv.setTextColor(mContext.getColor(R.color.text_E6000000));
- viewBinding.text4Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.text4Tv.setTextColor(mContext.getColor(R.color.text_E6000000));
- viewBinding.text5Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.text5Tv.setTextColor(mContext.getColor(R.color.text_E6000000));
- viewBinding.text6Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.text6Tv.setTextColor(mContext.getColor(R.color.text_E6000000));
- viewBinding.text7Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.text7Tv.setTextColor(mContext.getColor(R.color.text_E6000000));
- viewBinding.text8Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.text8Tv.setTextColor(mContext.getColor(R.color.text_E6000000));
+ viewBinding.text1Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.text2Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.text3Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.text4Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.text5Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.text6Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.text7Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.text8Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ } else if (titleType == TitleType.powerStationType) {
+ viewBinding.powerStationTypeAllTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.powerStationTypeInvTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.powerStationTypeBmsTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
} else {
- viewBinding.allTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.allTv.setTextColor(mContext.getColor(R.color.text_E6000000));
- viewBinding.gridConnectedTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.gridConnectedTv.setTextColor(mContext.getColor(R.color.text_E6000000));
- viewBinding.offNetworkTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000));
- viewBinding.offNetworkTv.setTextColor(mContext.getColor(R.color.text_E6000000));
+ viewBinding.allTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.beDebuggingTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.debuggingcOmpletedTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.deliveredTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
+ viewBinding.authorizationDebuggingTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129));
}
if (textView != null) {
- textView.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.selected_38c494));
- textView.setTextColor(mContext.getColor(R.color.text_FFFFFFFF));
+ textView.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_yes_129));
}
}
- public void initState(String min, String max, String stateValue) {
+ public void initState(String min, String max, String stateValue, String powerStationTypeValue) {
try {
- mStateValue = stateValue;
+ mPowerStationType = powerStationTypeValue;
+ mGridType = stateValue;
viewBinding.minEt.setText(min);
viewBinding.maxEt.setText(max);
@@ -310,12 +356,41 @@
break;
}
}
- if (TextUtils.isEmpty(stateValue)) {
- setBackgroundColor(viewBinding.allTv, TitleType.GridConnectedState);
- } else if (stateValue.equals(GridType.FULL_GRID)) {
- setBackgroundColor(viewBinding.gridConnectedTv, TitleType.GridConnectedState);
- } else {
- setBackgroundColor(viewBinding.offNetworkTv, TitleType.GridConnectedState);
+ switch (stateValue) {
+ case DebugStatus.All:
+ setBackgroundColor(viewBinding.allTv, TitleType.debuggingState);
+ break;
+ case DebugStatus.Debugging:
+ setBackgroundColor(viewBinding.beDebuggingTv, TitleType.debuggingState);
+ break;
+ case DebugStatus.WAIT_DELIVERED:
+ setBackgroundColor(viewBinding.debuggingcOmpletedTv, TitleType.debuggingState);
+ break;
+ case DebugStatus.Delivered:
+ setBackgroundColor(viewBinding.deliveredTv, TitleType.debuggingState);
+ break;
+ case DebugStatus.SECONDARY_DEBUGGIN:
+ setBackgroundColor(viewBinding.authorizationDebuggingTv, TitleType.debuggingState);
+ break;
+ default: {
+ setBackgroundColor(viewBinding.allTv, TitleType.debuggingState);
+ break;
+ }
+ }
+ switch (powerStationTypeValue) {
+ case PowerStationType.All:
+ setBackgroundColor(viewBinding.powerStationTypeAllTv, TitleType.powerStationType);
+ break;
+ case PowerStationType.INV:
+ setBackgroundColor(viewBinding.powerStationTypeInvTv, TitleType.powerStationType);
+ break;
+ case PowerStationType.BMS:
+ setBackgroundColor(viewBinding.powerStationTypeBmsTv, TitleType.powerStationType);
+ break;
+ default: {
+ setBackgroundColor(viewBinding.powerStationTypeAllTv, TitleType.powerStationType);
+ break;
+ }
}
} catch (Exception ignored) {
}
@@ -335,11 +410,14 @@
viewBinding.text7Tv.setTag(text7);
viewBinding.text8Tv.setTag(text8);
- viewBinding.allTv.setTag(GridType.All);
- viewBinding.gridConnectedTv.setTag(GridType.FULL_GRID);
- viewBinding.offNetworkTv.setTag(GridType.OFFLINE);
+ viewBinding.allTv.setTag(DebugStatus.All);
+ viewBinding.beDebuggingTv.setTag(DebugStatus.Debugging);
+ viewBinding.debuggingcOmpletedTv.setTag(DebugStatus.WAIT_DELIVERED);
+ viewBinding.deliveredTv.setTag(DebugStatus.Delivered);
+ viewBinding.authorizationDebuggingTv.setTag(DebugStatus.SECONDARY_DEBUGGIN);
setBackgroundColor(null, TitleType.string_capacity);
- setBackgroundColor(viewBinding.allTv, TitleType.GridConnectedState);
+ setBackgroundColor(viewBinding.allTv, TitleType.debuggingState);
+ setBackgroundColor(viewBinding.powerStationTypeAllTv, TitleType.powerStationType);
}
public void setOnClickListener(OnClickListener onClickListener) {
@@ -350,12 +428,13 @@
public interface OnClickListener {
- void confirm(String min, String max, String state);
+ void confirm(String min, String max, String state, String powerStationType);
}
public enum TitleType {
string_capacity,//缁勪覆瀹归噺
- GridConnectedState//骞剁綉鐘舵��
+ debuggingState,//璋冭瘯鐘舵��
+ powerStationType//鐢电珯绫诲瀷
}
--
Gitblit v1.8.0