From 90d5f028ccdaaaf64286f9d632cb335a4d0544b9 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期二, 07 一月 2025 09:40:52 +0800 Subject: [PATCH] Merge branch '1.5.1' --- app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java | 70 ++++++++++++++++++---------------- 1 files changed, 37 insertions(+), 33 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 5fd99bc..6102fc9 100644 --- a/app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java +++ b/app/src/main/java/com/hdl/photovoltaic/widget/DefaultFilteringDialog.java @@ -1,18 +1,26 @@ package com.hdl.photovoltaic.widget; +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.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.GridType; +import com.hdl.photovoltaic.enums.UnitType; import com.hdl.photovoltaic.other.HdlThreadLogic; public class DefaultFilteringDialog extends BaseDialog { @@ -35,23 +43,29 @@ private String mStateValue = GridType.All; public DefaultFilteringDialog(@NonNull Context context) { - super(context, R.style.Custom_Dialog); + super(context, R.style.DefaultFilteringDialog); this.mContext = context; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + 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(); //鍒濆鍖栫晫闈㈡暟鎹� // initData(mMinValue, mMaxValue, mStateValue); //鍒濆鍖栫晫闈㈡帶浠剁殑浜嬩欢 initEvent(); + + } private void initEvent() { @@ -97,11 +111,13 @@ } }); - viewBinding.resetTv.setOnClickListener(new View.OnClickListener() { + viewBinding.resetRl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setBackgroundColor(null, TitleType.string_capacity); setSelectedText(""); + setBackgroundColor(viewBinding.allTv, TitleType.GridConnectedState); + mStateValue = GridType.All; } }); viewBinding.text1Tv.setOnClickListener(new View.OnClickListener() { @@ -167,7 +183,7 @@ @Override public void onClick(View v) { setBackgroundColor(viewBinding.allTv, TitleType.GridConnectedState); - setSelectedText(viewBinding.allTv.getTag().toString()); + mStateValue = GridType.All; } }); viewBinding.gridConnectedTv.setOnClickListener(new View.OnClickListener() { @@ -175,7 +191,7 @@ @Override public void onClick(View v) { setBackgroundColor(viewBinding.gridConnectedTv, TitleType.GridConnectedState); - setSelectedText(viewBinding.gridConnectedTv.getTag().toString()); + mStateValue = GridType.FULL_GRID; } }); viewBinding.offNetworkTv.setOnClickListener(new View.OnClickListener() { @@ -183,7 +199,7 @@ @Override public void onClick(View v) { setBackgroundColor(viewBinding.offNetworkTv, TitleType.GridConnectedState); - setSelectedText(viewBinding.offNetworkTv.getTag().toString()); + mStateValue = GridType.OFFLINE; } }); @@ -207,8 +223,6 @@ minValue = min_max[0]; maxValue = min_max[1]; } - } else { - mStateValue = value; } viewBinding.minEt.setText(minValue); @@ -224,33 +238,21 @@ */ 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_90000000)); - viewBinding.text2Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000)); - viewBinding.text2Tv.setTextColor(mContext.getColor(R.color.text_90000000)); - viewBinding.text3Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000)); - viewBinding.text3Tv.setTextColor(mContext.getColor(R.color.text_90000000)); - viewBinding.text4Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000)); - viewBinding.text4Tv.setTextColor(mContext.getColor(R.color.text_90000000)); - viewBinding.text5Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000)); - viewBinding.text5Tv.setTextColor(mContext.getColor(R.color.text_90000000)); - viewBinding.text6Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000)); - viewBinding.text6Tv.setTextColor(mContext.getColor(R.color.text_90000000)); - viewBinding.text7Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000)); - viewBinding.text7Tv.setTextColor(mContext.getColor(R.color.text_90000000)); - viewBinding.text8Tv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000)); - viewBinding.text8Tv.setTextColor(mContext.getColor(R.color.text_90000000)); + 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 { - viewBinding.allTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000)); - viewBinding.allTv.setTextColor(mContext.getColor(R.color.text_90000000)); - viewBinding.gridConnectedTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000)); - viewBinding.gridConnectedTv.setTextColor(mContext.getColor(R.color.text_90000000)); - viewBinding.offNetworkTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.search_bj_ff05000000)); - viewBinding.offNetworkTv.setTextColor(mContext.getColor(R.color.text_90000000)); + viewBinding.allTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129)); + viewBinding.gridConnectedTv.setBackground(AppCompatResources.getDrawable(mContext, R.drawable.config_129)); + viewBinding.offNetworkTv.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)); } } @@ -304,6 +306,8 @@ private void initView() { + String s = mContext.getString(R.string.string_capacity) + "(" + UnitType.kWp + ")"; + viewBinding.capacityTv.setText(s); viewBinding.text1Tv.setTag(text1); viewBinding.text2Tv.setTag(text2); viewBinding.text3Tv.setTag(text3); -- Gitblit v1.8.0