app/src/main/java/com/hdl/photovoltaic/other/HdlMessageLogic.java
@@ -11,6 +11,7 @@ import com.hdl.photovoltaic.internet.api.HttpApi; import com.hdl.photovoltaic.listener.CloudCallBeak; import com.hdl.photovoltaic.ui.bean.MessageBean; import com.hdl.photovoltaic.ui.bean.UnCountBean; import java.util.ArrayList; import java.util.Comparator; @@ -309,7 +310,7 @@ * * @param cloudCallBeak - */ public void getMessageUntreatedCount(String homeId, CloudCallBeak<String> cloudCallBeak) { public void getMessageUntreatedCount(String homeId, CloudCallBeak<UnCountBean> cloudCallBeak) { String requestUrl = HttpApi.POST_Message_UntreatedCount; JsonObject json = new JsonObject(); if (!TextUtils.isEmpty(homeId)) { @@ -318,8 +319,16 @@ HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { @Override public void onSuccess(String str) { if (TextUtils.isEmpty(str)) { if (cloudCallBeak != null) { cloudCallBeak.onSuccess(new UnCountBean()); } return; } UnCountBean unCountBean = new Gson().fromJson(str, UnCountBean.class); if (cloudCallBeak != null) { cloudCallBeak.onSuccess(str); cloudCallBeak.onSuccess(unCountBean); } } @@ -491,9 +500,9 @@ } /** * 获取指定页的获取消息列表(用于C端) * 获取指定页的获取消息列表 * * @param homeId 电站id * @param homeId 电站id(填""默认账号下所有消息) * @param pageNo 页码 * @param messageStateType all:全部,UNTREATED:未处理,PROCESSED:已处理; * @param deviceType_filter_key 类型(设备,等级,时间) @@ -502,7 +511,7 @@ * timeType(TODAY :今天;LAST_3_DAYS: 近3天;LAST_7_DAYS :近7天;LAST_30_DAYS :近30天); * @param cloudCallBeak - */ public void getPageNoMessageList_C(String homeId, int pageNo, String messageStateType, String deviceType_filter_key, String deviceType_filter_value, String type_filter_key, String type_filter_value, String timeType_filter_key, String timeType_filter_value, CloudCallBeak<MessageListClass> cloudCallBeak) { public void getPageNoMessageList(String homeId, int pageNo, String messageStateType, String deviceType_filter_key, String deviceType_filter_value, String type_filter_key, String type_filter_value, String timeType_filter_key, String timeType_filter_value, CloudCallBeak<MessageListClass> cloudCallBeak) { String requestUrl = HttpApi.POST_Message_List; JsonObject json = new JsonObject(); if (!TextUtils.isEmpty(homeId)) { @@ -619,13 +628,15 @@ /** * 消息全部已读 * * @param homeId 消息id * @param homeId 消息id(不传已读所有电站的,传值已读指定电站的) * @param cloudCallBeak - */ public void messageAllRead(String homeId, CloudCallBeak<Boolean> cloudCallBeak) { String requestUrl = HttpApi.POST_Message_AllRead; JsonObject json = new JsonObject(); json.addProperty("homeId", homeId); if (!TextUtils.isEmpty(homeId)) { json.addProperty("homeId", homeId); } HttpClient.getInstance().requestHttp(requestUrl, json.toString(), new CloudCallBeak<String>() { @Override public void onSuccess(String str) { app/src/main/java/com/hdl/photovoltaic/other/HdlOtaLogic.java
@@ -536,12 +536,10 @@ //-100:没有数据;-101:没有md5秘钥;-102:md5秘钥不对;-103:有异常; if (zipData == null) { this.eventBusPost(fileFullPath, driver, -100, HDLApp.getInstance().getString(R.string.exception_unable_to_pull_up_the_cloud_upgrade_file_data)); // HdlLogLogic.print("拉不到云端升级文件数据(-100)", true); return false; } if (TextUtils.isEmpty(md5)) { this.eventBusPost(fileFullPath, driver, -101, HDLApp.getInstance().getString(R.string.exception_failed_to_obtain_the_md5_key_of_the_upgrade_file_on_the_cloud)); // HdlLogLogic.print("拿不到云端上升级文件md5秘钥(-101)", true); return false; } InputStream is = null; @@ -555,7 +553,6 @@ long total = zipData.contentLength(); if (total == 0) { this.eventBusPost(fileFullPath, driver, -102, HDLApp.getInstance().getString(R.string.exception_unable_to_pull_up_the_cloud_upgrade_file_data)); // HdlLogLogic.print("拉不到云端升级文件数据(-102)", true); return false; } fos = new FileOutputStream(file); @@ -563,7 +560,6 @@ while ((len = is.read(buf)) != -1) { if (this.stopDownload) { this.eventBusPost(fileFullPath, driver, -108, HDLApp.getInstance().getString(R.string.exception_the_user_cancels_downloading_the_upgrade_file)); // HdlLogLogic.print("用户取消下载升级文件(-108)", true); fos.flush(); fos.close(); is.close(); @@ -577,7 +573,6 @@ if (sum != total) { //不等于100都要报,等于100处理整块逻辑完之后再报100; this.eventBusPost(fileFullPath, driver, progress, "正常上报进度值--->" + progress); // HdlLogLogic.print("正常上报进度值--->" + progress, true); } } fos.flush(); @@ -589,18 +584,15 @@ byte[] decrypt = AesUtils.decrypt(bytes); if (decrypt == null) { this.eventBusPost(fileFullPath, driver, -105, HDLApp.getInstance().getString(R.string.exception_failed_to_decrypt_the_upgrade_aes_file)); // HdlLogLogic.print("升级文件aes解密失败(-105)", true); return false; } String fileMD5 = Md5Utils.encodeMD5(decrypt); if (TextUtils.isEmpty(fileMD5)) { this.eventBusPost(fileFullPath, driver, -106, HDLApp.getInstance().getString(R.string.exception_failed_to_generate_md5_for_the_upgrade_file)); // HdlLogLogic.print("升级文件生成md5失败失败(-106)", true); return false; } if (!md5.equals(fileMD5)) { this.eventBusPost(fileFullPath, driver, -107, HDLApp.getInstance().getString(R.string.exception_description_failed_to_compare_the_md5_of_the_upgrade_file)); // HdlLogLogic.print("升级文件md5比对失败(-107)", true); return false; } //todo 注意:解密之后,要重新写数据; app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -43,6 +43,7 @@ import com.hdl.photovoltaic.ui.bean.Geolocation; import com.hdl.photovoltaic.ui.bean.LinkBean; import com.hdl.photovoltaic.ui.bean.OidBean; import com.hdl.photovoltaic.ui.bean.UnCountBean; import com.hdl.photovoltaic.ui.me.AsRegardsActivity; import com.hdl.photovoltaic.ui.me.PersonalDataActivity; import com.hdl.photovoltaic.ui.me.SetActivity; @@ -1265,9 +1266,9 @@ */ private void uniGetMessageNumber(String type, Object data, DCUniMPJSCallback callback) { String homeId = getKeyValue("homeId", getKeyValue("data", data)); HdlMessageLogic.getInstance().getMessageUntreatedCount(homeId, new CloudCallBeak<String>() { HdlMessageLogic.getInstance().getMessageUntreatedCount(homeId, new CloudCallBeak<UnCountBean>() { @Override public void onSuccess(String data) { public void onSuccess(UnCountBean data) { uniCallbackData(type, data, callback); } app/src/main/java/com/hdl/photovoltaic/ui/MyPowerStationActivity.java
@@ -208,6 +208,9 @@ viewBinding.myPowerStationBottomIl0.clickTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (currentFragmentIndex == 0) { return; } currentFragmentIndex = 0; bottomViewChangeOfStyle(); postEventBus(HomepageTitleTabSwitch.homepage); @@ -216,6 +219,9 @@ viewBinding.myPowerStationBottomIl1.clickTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (currentFragmentIndex == 1) { return; } currentFragmentIndex = 1; bottomViewChangeOfStyle(); postEventBus(HomepageTitleTabSwitch.powerstation); @@ -224,6 +230,9 @@ viewBinding.myMessageBottomIl2.clickTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (currentFragmentIndex == 2) { return; } currentFragmentIndex = 2; bottomViewChangeOfStyle(); postEventBus(HomepageTitleTabSwitch.message); @@ -232,6 +241,9 @@ viewBinding.myMeBottomIl3.clickTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (currentFragmentIndex == 3) { return; } currentFragmentIndex = 3; bottomViewChangeOfStyle(); postEventBus(HomepageTitleTabSwitch.me); app/src/main/java/com/hdl/photovoltaic/ui/adapter/MessageAdapter.java
@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.hdl.photovoltaic.R; import com.hdl.photovoltaic.enums.DeviceType; import com.hdl.photovoltaic.enums.MessageAlarmStateType; import com.hdl.photovoltaic.ui.bean.MessageBean; import com.hdl.photovoltaic.utils.TimeUtils; @@ -24,10 +25,9 @@ private List<MessageBean> mList; private final Context mContext; private MessageAdapter.OnclickListener noOnclickListener;//点击了的监听器 private OnClickListener mOnclickListener;//点击了的监听器 public MessageAdapter(List<MessageBean> list, Context context) { mList = list; public MessageAdapter(Context context) { this.mContext = context; } @@ -41,11 +41,12 @@ @Override public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { MessageBean messageBean = this.mList.get(position); // String strName = getDeviceTypeStr(messageBean.getDeviceType()) + "(" + messageBean.getTitle() + ")"; holder.item_content_tv.setText(messageBean.getTitle()); holder.item_home_name_tv.setText(messageBean.getHomeName()); String date = TimeUtils.getTimeFromTimestamp(messageBean.getCreateTime()); holder.item_time_tv.setText(date); String type = "";//FAULT:故障,WARN:告警,EVENT:事件 String type = "";//FAULT:故障,WARN:告警,EVENT:提示 Drawable drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300); if (messageBean.getType().equals(MessageAlarmStateType.fault)) { type = mContext.getString(R.string.my_power_station_malfunction); @@ -54,8 +55,8 @@ type = mContext.getString(R.string.message_alarm); drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300); } else if (messageBean.getType().equals(MessageAlarmStateType.event)) { type =mContext.getString(R.string.event); drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_ffb300); type = mContext.getString(R.string.loading_title_tip); drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_b9b9b9); } holder.item_estate_tv.setText(type); holder.item_estate_tv.setBackground(drawable); @@ -69,8 +70,8 @@ @Override public void onClick(View v) { try { if (noOnclickListener != null) { noOnclickListener.onClick((int) holder.itemView.getTag(), messageBean); if (mOnclickListener != null) { mOnclickListener.onClick((int) holder.itemView.getTag(), messageBean); } } catch (Exception ignored) { } @@ -85,12 +86,19 @@ } public void setList(List<MessageBean> list) { this.mList = list; public void setList(List<MessageBean> newData) { if (this.mList == null) { this.mList = new ArrayList<>(); } else { this.mList.clear(); } this.mList.addAll(newData); notifyDataSetChanged(); } public void setNoOnclickListener(MessageAdapter.OnclickListener onclickListener) { this.noOnclickListener = onclickListener; public void setOnclickListener(OnClickListener onClickListener) { this.mOnclickListener = onClickListener; } /** @@ -113,8 +121,27 @@ } } public interface OnclickListener { public interface OnClickListener { void onClick(int position, MessageBean messageBean); } /** * 通过枚举转换设备类型的字符 * * @param deviceType //设备类型(INV : 逆变器, BMS : BMS控制盒, BATTERY : 电池单元) * @return 设备类型 */ private String getDeviceTypeStr(String deviceType) { switch (deviceType) { case DeviceType.inv: return mContext.getString(R.string.alarm_all_device_inverter); case DeviceType.bms: return mContext.getString(R.string.alarm_all_device_bms); case DeviceType.battery: return mContext.getString(R.string.alarm_all_device_battery_cell); default: return ""; } } } app/src/main/java/com/hdl/photovoltaic/ui/bean/UnCountBean.java
New file @@ -0,0 +1,36 @@ package com.hdl.photovoltaic.ui.bean; import java.io.Serializable; public class UnCountBean implements Serializable { private int untreatedCount;//未处理数量 private int processedCount;//已处理数 private int unreadCount;//未读数量 public int getUntreatedCount() { return untreatedCount; } public void setUntreatedCount(int untreatedCount) { this.untreatedCount = untreatedCount; } public int getProcessedCount() { return processedCount; } public void setProcessedCount(int processedCount) { this.processedCount = processedCount; } public int getUnreadCount() { return unreadCount; } public void setUnreadCount(int unreadCount) { this.unreadCount = unreadCount; } } app/src/main/java/com/hdl/photovoltaic/ui/message/AllMessageFragment.java
File was deleted app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java
@@ -1,20 +1,34 @@ package com.hdl.photovoltaic.ui.message; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.TextView; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.hdl.linkpm.sdk.core.exception.HDLException; import com.hdl.photovoltaic.R; import com.hdl.photovoltaic.base.CustomBaseFragment; import com.hdl.photovoltaic.config.ConstantManage; import com.hdl.photovoltaic.databinding.FragmentMessageBinding; import com.hdl.photovoltaic.enums.FilterType; import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch; import com.hdl.photovoltaic.enums.MessageFunctionTabSwitch; import com.hdl.photovoltaic.enums.MessageStateType; import com.hdl.photovoltaic.listener.CloudCallBeak; import com.hdl.photovoltaic.other.HdlCommonLogic; import com.hdl.photovoltaic.other.HdlLogLogic; import com.hdl.photovoltaic.other.HdlMessageLogic; import com.hdl.photovoltaic.other.HdlThreadLogic; import com.hdl.photovoltaic.ui.adapter.MessageAdapter; import com.hdl.photovoltaic.ui.bean.MessageBean; import com.hdl.photovoltaic.ui.bean.UnCountBean; import com.hdl.photovoltaic.widget.TypeTitleListDialog; import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; import org.greenrobot.eventbus.EventBus; @@ -22,7 +36,9 @@ import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 消息 @@ -31,12 +47,23 @@ private FragmentMessageBinding viewBinding; //当前显示的fragment private static final String CURRENT_FRAGMENT = "state_fragment_show"; private FragmentManager mFragmentManager; private Fragment currentFragment = new Fragment(); private final List<Fragment> fragmentList = new ArrayList<>(); private int currentIndex = 0; private MessageAdapter mMessageAdapter; private boolean isAlarmDeviceClick = true;//true表示告警设备被选中,则false表示报警记录被选中 private final List<MessageBean> mList = new ArrayList<>(); private int mCurrentPage = 0; // 当前页码 private int mCurrentTotal = 0; // 总页码 private String mDeviceTypeFilterKye = FilterType.deviceType;//过滤类型 deviceType(INV :逆变器;BMS :BMS控制盒;BATTERY :电池单元) private String mDeviceTypeFilterValue = FilterType.all;//过滤类型值 deviceType(INV :逆变器;BMS :BMS控制盒;BATTERY :电池单元) private String mTypeFilterKye = FilterType.all;//过滤类型 type(FAULT :故障; WARN :告警; EVENT :事件(提示)); private String mTypeFilterValue = FilterType.all;//过滤类型值 type(FAULT :故障; WARN :告警; EVENT :事件(提示)); private String mTimeTypeFilterKye = FilterType.all;//过滤类型 timeType(TODAY :今天;LAST_3_DAYS: 近3天;LAST_7_DAYS :近7天;LAST_30_DAYS :近30天); private String mTimeTypeFilterValue = FilterType.all;//过滤类型值 timeType(TODAY :今天;LAST_3_DAYS: 近3天;LAST_7_DAYS :近7天;LAST_30_DAYS :近30天); private boolean isLoadingMore = false; // 标记正在加载更多数据 @Override public Object getContentView() { @@ -46,165 +73,200 @@ @Override public void onBindView(Bundle savedInstanceState) { //初始化碎片 initFragment(savedInstanceState); //初始化界面 initView(); //初始化监听器 initEvent(); //初始化数据 initData(); } private void initEvent() { //发生中 viewBinding.messageTabNascentCl.setOnClickListener(new View.OnClickListener() { viewBinding.messageTabNascentTitleTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentIndex = 0; initView(); showFragment(); postEventBus(MessageFunctionTabSwitch.nascent); if (isAlarmDeviceClick) { return; } isAlarmDeviceClick = true; viewBinding.messageTabNascentTitleTv.setTextAppearance(R.style.Text20Style); viewBinding.messageTabRecoverTitleTv.setTextAppearance(R.style.Text16Style); viewBinding.allClearTv.setVisibility(View.VISIBLE); loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); } }); //已恢复 viewBinding.messageTabRecoverCl.setOnClickListener(new View.OnClickListener() { //报警记录 viewBinding.messageTabRecoverTitleTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentIndex = 1; initView(); showFragment(); postEventBus(MessageFunctionTabSwitch.recover); if (!isAlarmDeviceClick) { return; } isAlarmDeviceClick = false; viewBinding.messageTabNascentTitleTv.setTextAppearance(R.style.Text16Style); viewBinding.messageTabRecoverTitleTv.setTextAppearance(R.style.Text20Style); viewBinding.allClearTv.setVisibility(View.GONE); loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); } }); //全部 viewBinding.messageTabAllCl.setOnClickListener(new View.OnClickListener() { //清空所有未读按钮 viewBinding.allClearTv.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentIndex = 2; initView(); showFragment(); postEventBus(MessageFunctionTabSwitch.all); showLoading(); HdlMessageLogic.getInstance().messageAllRead("", new CloudCallBeak<Boolean>() { @Override public void onSuccess(Boolean obj) { hideLoading(); loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); } @Override public void onFailure(HDLException e) { hideLoading(); HdlThreadLogic.toast(_mActivity, e); } }); } }); //全部设备(全部设备、逆变器、BMS控制盒、电池单元)按钮 viewBinding.messageTabAllDeviceCl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.up); viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down); viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down); List<String> stringList = getTypeList(FilterType.deviceType); TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList); typeTitleListDialog.show(); typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() { @Override public void onClick(int position, String title) { viewBinding.allDeviceTitleTv.setText(title); mDeviceTypeFilterKye = FilterType.deviceType; mDeviceTypeFilterValue = findFilterValueString(title); loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); } }); } }); //全部等级(故障、警告、提示)按钮 viewBinding.messageTabAllGradeCl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down); viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.up); viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.down); List<String> stringList = getTypeList(FilterType.type); TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList); typeTitleListDialog.show(); typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() { @Override public void onClick(int position, String title) { viewBinding.allGradeTitleTv.setText(title); mTypeFilterKye = FilterType.type; mTypeFilterValue = findFilterValueString(title); loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); } }); } }); //全部时间(当天、近3天、近7天、近30天)按钮 viewBinding.messageTabAllTimeCl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { viewBinding.allDeviceTitleIv.setBackgroundResource(R.drawable.down); viewBinding.allGradeTitleIv.setBackgroundResource(R.drawable.down); viewBinding.allTimeTitleIv.setBackgroundResource(R.drawable.up); List<String> stringList = getTypeList(FilterType.timeType); TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList); typeTitleListDialog.show(); typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() { @Override public void onClick(int position, String title) { viewBinding.allTimeTitleTv.setText(title); mTimeTypeFilterKye = FilterType.timeType; mTimeTypeFilterValue = findFilterValueString(title); loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); } }); } }); //下拉按钮 viewBinding.messageSrl.setColorSchemeResources(R.color.text_FF245EC3); viewBinding.messageSrl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { viewBinding.messageSrl.setRefreshing(false); loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); } }); //上拉按钮 viewBinding.messageRcv.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { // super.onScrolled(recyclerView, dx, dy); LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager(); if (layoutManager == null) { return; } int visibleItemCount = layoutManager.getChildCount(); int totalItemCount = layoutManager.getItemCount(); int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition(); if (visibleItemCount > 0 && visibleItemCount + firstVisibleItemPosition == totalItemCount) { if (!isLoadingMore) { // 滑动到了底部,执行相应的操作 HdlLogLogic.print("--->滑动到了底部"); loadNextPageMessageList(++mCurrentPage, false, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, false); } } } }); if (mMessageAdapter != null) { mMessageAdapter.setOnclickListener(new MessageAdapter.OnClickListener() { @Override public void onClick(int position, MessageBean messageBean) { Intent intent = new Intent(); intent.putExtra("msgId", messageBean.getMsgId().toString()); intent.setClass(_mActivity, MessageInfoActivity.class); startActivity(intent); } }); } } private void initView() { if (this.currentIndex == 0) { viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null)); viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null)); viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null)); viewBinding.line1V.setVisibility(View.VISIBLE); viewBinding.line2V.setVisibility(View.GONE); viewBinding.line3V.setVisibility(View.GONE); } else if (this.currentIndex == 1) { viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null)); viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null)); viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null)); viewBinding.line1V.setVisibility(View.GONE); viewBinding.line2V.setVisibility(View.VISIBLE); viewBinding.line3V.setVisibility(View.GONE); } else if (this.currentIndex == 2) { viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null)); viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null)); viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null)); viewBinding.line1V.setVisibility(View.GONE); viewBinding.line2V.setVisibility(View.GONE); viewBinding.line3V.setVisibility(View.VISIBLE); if (isAlarmDeviceClick) { viewBinding.messageTabNascentTitleTv.setTextAppearance(R.style.Text20Style); viewBinding.messageTabRecoverTitleTv.setTextAppearance(R.style.Text16Style); } else { viewBinding.messageTabNascentTitleTv.setTextAppearance(R.style.Text16Style); viewBinding.messageTabRecoverTitleTv.setTextAppearance(R.style.Text20Style); } mMessageAdapter = new MessageAdapter(_mActivity); viewBinding.messageRcv.setLayoutManager(new LinearLayoutManager(_mActivity)); viewBinding.messageRcv.setAdapter(mMessageAdapter); } private void initData() { //进来读取一次数据(为了更新currentPage,currentTotal这个值),app启动时候读取,为了刷新消息模块的角标 loadNextPageMessageList(1, true, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, true); } /** * 发布点击事件 * * @param tabSwitch - */ private void postEventBus(MessageFunctionTabSwitch tabSwitch) { BaseEventBus baseEventBus = new BaseEventBus(); baseEventBus.setTopic(ConstantManage.message_function_tab_switch); baseEventBus.setType(tabSwitch.toString()); //发送粘性事件(如果不发粘性事件会遇到一个没有加载出来的碎片接收不到信息) EventBus.getDefault().postSticky(baseEventBus); } /** * 初始化Fragment * * @param savedInstanceState - */ private void initFragment(Bundle savedInstanceState) { mFragmentManager = _mActivity.getSupportFragmentManager(); //碎片初始化 NascentMessageFragment mNascentMessageFragment = new NascentMessageFragment(); RecoverMessageFragment mRecoverMessageFragment = new RecoverMessageFragment(); AllMessageFragment mAllMessageFragment = new AllMessageFragment(); if (savedInstanceState != null) { //“内存重启”时调用 获取“内存重启”时保存的索引下标 currentIndex = savedInstanceState.getInt(CURRENT_FRAGMENT, 0); if (fragmentList.size() != 0) { fragmentList.clear(); } fragmentList.add(mFragmentManager.findFragmentByTag(0 + "")); fragmentList.add(mFragmentManager.findFragmentByTag(1 + "")); fragmentList.add(mFragmentManager.findFragmentByTag(2 + "")); restoreFragment();//恢复fragment页面 } else { //正常启动时调用 fragmentList.add(mNascentMessageFragment); fragmentList.add(mRecoverMessageFragment); fragmentList.add(mAllMessageFragment); showFragment(); } } /** * 使用show() hide()切换页面 * 显示fragment */ private void showFragment() { FragmentTransaction ft = mFragmentManager.beginTransaction(); //如果之前没有添加过 if (!fragmentList.get(currentIndex).isAdded()) { //第三个参数为添加当前的fragment时绑定一个tag ft.hide(currentFragment).add(R.id.message_fcv, fragmentList.get(currentIndex), currentIndex + ""); } else { ft.hide(currentFragment).show(fragmentList.get(currentIndex)); } currentFragment = fragmentList.get(currentIndex); ft.commit(); //把当前显示的fragment记录下来 currentFragment = fragmentList.get(currentIndex); } /** * 恢复fragment */ private void restoreFragment() { FragmentTransaction ft = mFragmentManager.beginTransaction(); for (int i = 0; i < fragmentList.size(); i++) { if (i == currentIndex) { ft.show(fragmentList.get(i)); } else { ft.hide(fragmentList.get(i)); } } ft.commit(); } @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) public void onEventMessage(BaseEventBus eventBus) { @@ -217,10 +279,297 @@ if (eventBus.getType().equals(HomepageTitleTabSwitch.message.toString())) { // 取消粘性事件 EventBus.getDefault().removeStickyEvent(eventBus); postEventBus(MessageFunctionTabSwitch.nascent); //进来读取一次数据(为了更新currentPage,currentTotal这个值) initData(); HdlLogLogic.print("正在点击【消息】"); } } } /** * 加载一页数据 * * @param pageNo 页数 * @param isShowLoading 是否启动加载框 true启动 * @param deviceType_filter_key 类型(设备,等级,时间) * @param deviceType_filter_value deviceType(INV :逆变器;BMS :BMS控制盒;BATTERY :电池单元); * type(FAULT :故障; WARN :告警; EVENT :事件(提示)); * timeType(TODAY :今天;LAST_3_DAYS: 近3天;LAST_7_DAYS :近7天;LAST_30_DAYS :近30天); * @param isClear true表示清空缓存 */ private void loadNextPageMessageList( int pageNo, boolean isShowLoading, String deviceType_filter_key, String deviceType_filter_value, String type_filter_key, String type_filter_value, String timeType_filter_key, String timeType_filter_value, boolean isClear) { if (isClear) { //表示从第一页可以读取,默认清空所有缓存数据; clearCacheData(); } //第一页读取数据强制读 if (pageNo > 1 && mCurrentPage > mCurrentTotal) { --mCurrentPage; //当前页不能大于总页数 return; } isLoadingMore = true;//标记读取状态 if (isShowLoading) { showLoading(); } String messageStateType; if (isAlarmDeviceClick) { messageStateType = MessageStateType.untreated; } else { messageStateType = MessageStateType.processed; } HdlMessageLogic.getInstance().getPageNoMessageList("", pageNo, messageStateType, deviceType_filter_key, deviceType_filter_value, type_filter_key, type_filter_value, timeType_filter_key, timeType_filter_value, new CloudCallBeak<HdlMessageLogic.MessageListClass>() { @Override public void onSuccess(HdlMessageLogic.MessageListClass messageListClass) { if (messageListClass != null) { mCurrentTotal = (int) messageListClass.getTotalPage(); mCurrentPage = (int) messageListClass.getPageNo(); updateListData(); } isLoadingMore = false; if (isShowLoading) { hideLoading(); } } @Override public void onFailure(HDLException e) { if (mCurrentPage > 1) { --mCurrentPage; } isLoadingMore = false; if (isShowLoading) { hideLoading(); } } }); } /** * 刷新列表数据 */ private void updateListData() { HdlThreadLogic.runMainThread(new Runnable() { @Override public void run() { //读取缓存数据 updateCacheData(); //刷新列表 updateRecyclerViewList(); //显示未读信息总数量 getUnreadCount(); //显示没数据Ui样式 nullDataUpdateUi(); } }); } /** * 刷新信息数量总数 * * @param nascentTotalCount 发送中消息总数量 * @param recoverTotalCount 报警记录消息总数量 */ private void refreshAascentAndRecoverTotalCount(int nascentTotalCount, int recoverTotalCount) { HdlThreadLogic.runMainThread(new Runnable() { @Override public void run() { //设备报警总数量 TextView nascentTv = _mActivity.findViewById(R.id.message_tab_nascent_title_tv); if (nascentTv != null) { nascentTv.setText(getText(R.string.message_nascent)); if (nascentTotalCount > 0) { String s = getText(R.string.message_nascent) + "(" + nascentTotalCount + ")"; nascentTv.setText(s); } } //报警记录总数量 TextView recoverTV = _mActivity.findViewById(R.id.message_tab_recover_title_tv); if (recoverTV != null) { recoverTV.setText(getText(R.string.alarm_record)); if (recoverTotalCount > 0) { String s = getText(R.string.alarm_record) + "(" + recoverTotalCount + ")"; recoverTV.setText(s); } } } }); } /** * 刷新【消息模块】下角标数值 * * @param unreadCount 未读信息数量总数 */ private void refreshUnreadCount(int unreadCount) { HdlThreadLogic.runMainThread(new Runnable() { @SuppressLint("SetTextI18n") @Override public void run() { TextView textView = _mActivity.findViewById(R.id.my_message_bottom_il2).findViewById(R.id.red_count_tv); if (textView != null) { if (unreadCount == 0) { textView.setVisibility(View.GONE); } else { textView.setVisibility(View.VISIBLE); if (unreadCount > 99) { textView.setText("99+"); } else { textView.setText(unreadCount + ""); } } } } }); } /** * 重新更新列表数据 */ private void updateRecyclerViewList() { if (mMessageAdapter == null) { return; } mMessageAdapter.setList(mList); } /** * 清空所有缓存数据(获取第一页之前要清空所有缓存数据) */ private void clearCacheData() { mList.clear(); HdlMessageLogic.getInstance().clearListMessage();//表示强制清空所有缓存信息 } /** * 更新缓存数据 */ private void updateCacheData() { mList.clear(); if (isAlarmDeviceClick) { //设备报警 mList.addAll(HdlMessageLogic.getInstance().getNascentMessageMemoryList()); } else { //报警记录 mList.addAll(HdlMessageLogic.getInstance().getRecoverMessageMemoryList()); } } /** * 读取消息【未读数量,未处理总数量,已处理总数量】 */ private void getUnreadCount() { HdlMessageLogic.getInstance().getMessageUntreatedCount("", new CloudCallBeak<UnCountBean>() { @Override public void onSuccess(UnCountBean unCountBean) { HdlThreadLogic.runMainThread(new Runnable() { @Override public void run() { if (unCountBean == null) { return; } refreshAascentAndRecoverTotalCount(unCountBean.getUntreatedCount(), unCountBean.getProcessedCount()); refreshUnreadCount(unCountBean.getUnreadCount()); } }); } @Override public void onFailure(HDLException e) { TextView textView = _mActivity.findViewById(R.id.my_message_bottom_il2).findViewById(R.id.red_count_tv); if (textView != null) { textView.setVisibility(View.GONE); } } }); } /** * 没有消息列表的样式 */ private void nullDataUpdateUi() { HdlCommonLogic.getInstance().nullDataUpdateUi(_mActivity, viewBinding.nullDataIc.getRoot(), viewBinding.nullDataIc.nullDataGifAnimationIv, viewBinding.nullDataIc.nullDataTv, getString(R.string.message_alarm_data_null), mList.size() > 0); } /** * 查找过滤值 * * @param title 标题 * @return 过滤值 */ public String findFilterValueString(String title) { Map<String, String> map = new HashMap<>(); map.put(getString(R.string.alarm_all_device), "");//设备全部 map.put(getString(R.string.alarm_all_device_inverter), "INV"); map.put(getString(R.string.alarm_all_device_bms), "BMS"); map.put(getString(R.string.alarm_all_device_battery_cell), "BATTERY"); map.put(getString(R.string.alarm_all_grade), "");//设等级全部 map.put(getString(R.string.alarm_all_grade_malfunction), "FAULT"); map.put(getString(R.string.alarm_all_grade_warning), "WARN"); map.put(getString(R.string.alarm_all_grade_tip), "EVENT"); map.put(getString(R.string.alarm_all_time), "");//时间全部 map.put(getString(R.string.alarm_all_time_same_day), "TODAY"); map.put(getString(R.string.alarm_all_time_3), "LAST_3_DAYS"); map.put(getString(R.string.alarm_all_time_7), "LAST_7_DAYS"); map.put(getString(R.string.alarm_all_time_30), "LAST_30_DAYS"); for (Map.Entry<String, String> entry : map.entrySet()) { if (title.equals(entry.getKey())) { return entry.getValue(); } } return ""; } /** * 获取类型列表 * * @param filterType 过滤类型 * @return 返回类型列表 */ private List<String> getTypeList(String filterType) { List<String> stringList = new ArrayList<>(); switch (filterType) { case FilterType.deviceType: { stringList.add(getString(R.string.alarm_all_device)); stringList.add(getString(R.string.alarm_all_device_inverter)); stringList.add(getString(R.string.alarm_all_device_bms)); stringList.add(getString(R.string.alarm_all_device_battery_cell)); } break; case FilterType.type: { stringList.add(getString(R.string.alarm_all_grade)); stringList.add(getString(R.string.alarm_all_grade_malfunction)); stringList.add(getString(R.string.alarm_all_grade_warning)); stringList.add(getString(R.string.alarm_all_grade_tip)); } break; case FilterType.timeType: { stringList.add(getString(R.string.alarm_all_time)); stringList.add(getString(R.string.alarm_all_time_same_day)); stringList.add(getString(R.string.alarm_all_time_3)); stringList.add(getString(R.string.alarm_all_time_7)); stringList.add(getString(R.string.alarm_all_time_30)); } break; } return stringList; } } app/src/main/java/com/hdl/photovoltaic/ui/message/NascentMessageFragment.java
File was deleted app/src/main/java/com/hdl/photovoltaic/ui/message/RecoverMessageFragment.java
@@ -88,18 +88,18 @@ loadNextPageRecoverMessageList(1, true); } }); messageRecoverAdapter.setNoOnclickListener(new MessageAdapter.OnclickListener() { @Override public void onClick(int position, MessageBean item) { if (position < 0 || position > mList.size()) { return; } Intent intent = new Intent(); intent.putExtra("msgId", item.getMsgId().toString()); intent.setClass(_mActivity, MessageInfoActivity.class); startActivity(intent); } }); // messageRecoverAdapter.setNoOnclickListener(new MessageAdapter.OnclickListener() { // @Override // public void onClick(int position, MessageBean item) { // if (position < 0 || position > mList.size()) { // return; // } // Intent intent = new Intent(); // intent.putExtra("msgId", item.getMsgId().toString()); // intent.setClass(_mActivity, MessageInfoActivity.class); // startActivity(intent); // } // }); viewBinding.messageRecoverRecyclerview.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override @@ -127,7 +127,7 @@ private void initView() { viewBinding.messageRecoverRecyclerview.setLayoutManager(new LinearLayoutManager(_mActivity)); messageRecoverAdapter = new MessageAdapter(this.mList, _mActivity); messageRecoverAdapter = new MessageAdapter(_mActivity); viewBinding.messageRecoverRecyclerview.setAdapter(messageRecoverAdapter); } app/src/main/java/com/hdl/photovoltaic/ui/newC/MessageCenterList.java
@@ -336,7 +336,7 @@ } else { messageStateType = MessageStateType.processed; } HdlMessageLogic.getInstance().getPageNoMessageList_C(UserConfigManage.getInstance().getHomeId(), pageNo, messageStateType, HdlMessageLogic.getInstance().getPageNoMessageList(UserConfigManage.getInstance().getHomeId(), pageNo, messageStateType, deviceType_filter_key, deviceType_filter_value, type_filter_key, type_filter_value, timeType_filter_key, timeType_filter_value, app/src/main/java/com/hdl/photovoltaic/ui/powerstation/HouseListFragment.java
@@ -106,8 +106,8 @@ isClickPowerStationLabel = true; viewBinding.powerStationLabel.setTextAppearance(R.style.Text20Style); viewBinding.deviceLabel.setTextAppearance(R.style.Text16Style); viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE); viewBinding.deviceLabelParent.setVisibility(View.GONE);//设备标签隐藏 viewBinding.powerStationLabelParent.setVisibility(View.VISIBLE);//电站标签【父容器】显示 viewBinding.deviceLabelParent.setVisibility(View.GONE);//设备标签【父容器】隐藏 loadNextPageHouseList(true, key, value, installedCapacityMinValue, installedCapacityMaxValue, gridTypeValue, powerStationStatusValue, 1, true); } }); @@ -123,8 +123,8 @@ 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); viewBinding.powerStationLabelParent.setVisibility(View.GONE);//电站标签【父容器】隐藏 viewBinding.deviceLabelParent.setVisibility(View.VISIBLE);//设备标签【父容器】显示 loadNextPageDeviceList(true, 1, true); } }); app/src/main/res/drawable/house_list_line_parent_bg.xml
@@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="@color/text_FFFFFFFF" /> <corners android:radius="@dimen/dp_4" /> <corners android:radius="@dimen/dp_13" /> </shape> app/src/main/res/layout/fragment_message.xml
@@ -3,134 +3,266 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/message_parent" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/text_F5F7FA"> android:layout_height="match_parent"> <!--头部标签--> <RelativeLayout android:id="@+id/message_rl" android:layout_width="0dp" android:layout_height="@dimen/dp_52" android:background="@color/text_245EC3" android:layout_width="match_parent" android:layout_height="@dimen/dp_31" android:layout_marginStart="@dimen/dp_16" android:layout_marginTop="@dimen/dp_44" android:layout_marginEnd="@dimen/dp_16" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <LinearLayout android:id="@+id/message_tab_ll" android:layout_width="match_parent" <TextView android:id="@+id/message_tab_nascent_title_tv" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginStart="@dimen/dp_17" android:layout_marginEnd="@dimen/dp_16" android:orientation="horizontal"> <!--发生中--> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/message_tab_nascent_cl" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"> android:layout_centerVertical="true" android:gravity="center_vertical" android:text="@string/message_nascent" android:textColor="@color/text_90000000" android:textSize="@dimen/text_20" android:textStyle="bold" /> <TextView android:id="@+id/message_tab_nascent_title_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_23" android:layout_marginTop="@dimen/dp_16" android:gravity="center" android:text="@string/message_nascent" android:textColor="@color/text_FFFFFFFF" android:textSize="@dimen/text_16" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <TextView android:id="@+id/message_tab_recover_title_tv" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_centerVertical="true" android:layout_marginStart="@dimen/dp_21" android:layout_marginEnd="@dimen/dp_4" android:layout_toStartOf="@+id/all_clear_tv" android:layout_toEndOf="@+id/message_tab_nascent_title_tv" android:gravity="start|center_vertical" android:text="@string/alarm_record" android:textColor="@color/text_40000000" android:textSize="@dimen/text_16" <View android:id="@+id/line1_v" android:layout_width="0dp" android:layout_height="3dp" android:layout_marginTop="@dimen/dp_11" android:background="@color/text_FFFFFFFF" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@+id/message_tab_nascent_title_tv" app:layout_constraintStart_toStartOf="@+id/message_tab_nascent_title_tv" /> /> <TextView android:id="@+id/all_clear_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_31" android:layout_alignParentEnd="true" android:gravity="center" android:text="@string/all_read" android:textColor="@color/text_38C494" android:textSize="@dimen/dp_16" /> </androidx.constraintlayout.widget.ConstraintLayout> <!--已恢复--> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/message_tab_recover_cl" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"> <TextView android:id="@+id/message_tab_recover_title_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_23" android:layout_marginTop="@dimen/dp_16" android:gravity="center" android:text="@string/message_recover" android:textColor="@color/text_FFFFFFFF" android:textSize="@dimen/text_16" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <View android:id="@+id/line2_v" android:layout_width="0dp" android:layout_height="3dp" android:layout_marginTop="@dimen/dp_11" android:background="@color/text_FFFFFFFF" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@+id/message_tab_recover_title_tv" app:layout_constraintStart_toStartOf="@+id/message_tab_recover_title_tv" /> </androidx.constraintlayout.widget.ConstraintLayout> <!--全部 2023年12月29日09:49:59阿廖要求先隐藏--> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/message_tab_all_cl" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:visibility="gone"> <TextView android:id="@+id/message_tab_all_title_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_23" android:layout_marginTop="@dimen/dp_16" android:gravity="center" android:text="@string/message_all" android:textColor="@color/text_FFFFFFFF" android:textSize="@dimen/text_16" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <View android:id="@+id/line3_v" android:layout_width="0dp" android:layout_height="3dp" android:layout_marginTop="@dimen/dp_11" android:background="@color/text_FFFFFFFF" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="@+id/message_tab_all_title_tv" app:layout_constraintStart_toStartOf="@+id/message_tab_all_title_tv" /> </androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout> </RelativeLayout> <!--Fragment--> <androidx.fragment.app.FragmentContainerView android:id="@+id/message_fcv" android:layout_width="0dp" <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/message_cl" android:layout_width="match_parent" android:layout_height="98dp" android:layout_marginTop="@dimen/dp_21" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/message_rl"> <!--搜索--> <RelativeLayout android:id="@+id/message_search_cl" android:layout_width="match_parent" android:layout_height="@dimen/dp_35" android:layout_marginStart="@dimen/dp_13" android:layout_marginEnd="@dimen/dp_16" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <RelativeLayout android:id="@+id/message_search_click_cl" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentEnd="true" android:layout_marginEnd="@dimen/dp_17" android:background="@drawable/search_bj_ff05000000"> <ImageView android:id="@+id/power_station_search_iv" android:layout_width="@dimen/dp_18" android:layout_height="@dimen/dp_18" android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginStart="@dimen/dp_13" android:src="@drawable/search_path" /> <TextView android:id="@+id/power_station_search_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_17" android:layout_centerVertical="true" android:layout_marginStart="@dimen/dp_11" android:layout_toEndOf="@+id/power_station_search_iv" android:text="Search the message" android:textColor="@color/text_40000000" android:textSize="@dimen/text_14" /> </RelativeLayout> </RelativeLayout> <!--条件筛选--> <RelativeLayout android:id="@+id/message_condition_screening_rl" android:layout_width="0dp" android:layout_height="@dimen/dp_62" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/message_search_cl"> <LinearLayout android:id="@+id/message_tab_ll" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginStart="@dimen/dp_16" android:layout_marginEnd="@dimen/dp_16" android:orientation="horizontal"> <!--全部设备--> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/message_tab_all_device_cl" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="horizontal"> <TextView android:id="@+id/all_device_title_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_20" android:text="@string/alarm_all_device" android:textColor="@color/text_90000000" android:textSize="@dimen/text_14" /> <View android:layout_width="@dimen/dp_7" android:layout_height="match_parent" /> <ImageView android:id="@+id/all_device_title_iv" android:layout_width="@dimen/dp_10" android:layout_height="@dimen/dp_10" android:layout_marginStart="@dimen/dp_7" android:background="@drawable/up" /> </LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout> <!--全部等级--> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/message_tab_all_grade_cl" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="horizontal"> <TextView android:id="@+id/all_grade_title_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_20" android:text="@string/alarm_all_grade" android:textColor="@color/text_90000000" android:textSize="@dimen/text_14" /> <View android:layout_width="7dp" android:layout_height="match_parent" /> <ImageView android:id="@+id/all_grade_title_iv" android:layout_width="@dimen/dp_10" android:layout_height="@dimen/dp_10" android:layout_marginStart="@dimen/dp_7" android:background="@drawable/up" /> </LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout> <!--全部时间--> <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/message_tab_all_time_cl" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_vertical|end" android:orientation="horizontal"> <TextView android:id="@+id/all_time_title_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_20" android:layout_marginEnd="@dimen/dp_7" android:text="@string/alarm_all_time" android:textColor="@color/text_90000000" android:textSize="@dimen/text_14" /> <View android:layout_width="@dimen/dp_7" android:layout_height="match_parent" /> <ImageView android:id="@+id/all_time_title_iv" android:layout_width="@dimen/dp_10" android:layout_height="@dimen/dp_10" android:background="@drawable/up" /> </LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout> </RelativeLayout> </androidx.constraintlayout.widget.ConstraintLayout> <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/message_srl" android:layout_width="match_parent" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/message_rl" /> app:layout_constraintTop_toBottomOf="@+id/message_cl"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/message_rcv" android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" android:paddingBottom="@dimen/dp_16" /> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> <!--没有数据显示样式--> <include android:id="@+id/null_data_ic" layout="@layout/null_data_view" android:layout_width="match_parent" android:layout_height="224dp" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/message_cl" /> </androidx.constraintlayout.widget.ConstraintLayout> app/src/main/res/layout/item_message.xml
@@ -2,8 +2,7 @@ <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="@dimen/dp_150" android:background="@color/text_F5F7FA"> android:layout_height="@dimen/dp_115"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" @@ -26,14 +25,15 @@ android:id="@+id/item_content_tv" android:layout_width="0dp" android:layout_height="@dimen/dp_23" android:layout_marginStart="20dp" android:layout_marginTop="16dp" android:layout_marginStart="16dp" android:layout_marginTop="19dp" android:layout_marginEnd="@dimen/dp_5" android:ellipsize="end" android:gravity="center_vertical" android:singleLine="true" android:textStyle="bold" android:textColor="@color/text_90000000" android:textSize="@dimen/text_16" android:ellipsize="end" android:singleLine="true" app:layout_constraintEnd_toStartOf="@+id/item_estate_tv" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -42,7 +42,7 @@ android:id="@+id/item_home_name_tv" android:layout_width="wrap_content" android:layout_height="@dimen/dp_17" android:layout_marginTop="@dimen/dp_24" android:layout_marginTop="@dimen/dp_6" android:textColor="@color/text_40000000" android:textSize="@dimen/text_12" app:layout_constraintStart_toStartOf="@+id/item_content_tv" @@ -52,7 +52,7 @@ android:id="@+id/item_time_tv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_14" android:layout_marginTop="@dimen/dp_6" android:gravity="center_vertical" android:textColor="@color/text_40000000" android:textSize="@dimen/text_12" app/src/main/res/layout/item_type_title.xml
@@ -19,6 +19,7 @@ android:id="@+id/type_title_tv" android:layout_width="match_parent" android:layout_height="@dimen/dp_20" android:gravity="center" android:textColor="@color/text_90000000" android:textSize="@dimen/text_14" app:layout_constraintBottom_toBottomOf="parent" app/src/main/res/values/strings.xml
@@ -1,5 +1,4 @@ <resources> <!-- <string name="app_name">PhotovoltaicDebug</string>--> <string name="app_name">智慧能源</string> <string name="title_activity_home_login">HomeLoginActivity</string> <!-- Strings used for fragments for navigation --> @@ -10,6 +9,7 @@ <string name="hello_first_fragment">Hello first fragment</string> <string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string> <!--登录模块--> <string name="home_login_chinese">简体中文</string> @@ -287,6 +287,5 @@ <string name="grid_connected">并网</string> <string name="off_network">离网</string> <string name="the_input_value_has_been_exceeded">输入值已经超过</string> <string name="all_read">一键清除</string> </resources>