| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取指定页的获取消息列表 |
| | | * |
| | |
| | | * @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 search_title 报警名称 |
| | | * @param 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) { |
| | | 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, |
| | | String search_title, CloudCallBeak<MessageListClass> cloudCallBeak) { |
| | | String requestUrl = HttpApi.POST_Message_List; |
| | | JsonObject json = new JsonObject(); |
| | | if (!TextUtils.isEmpty(homeId)) { |
| | |
| | | if (!TextUtils.isEmpty(timeType_filter_key) && !TextUtils.isEmpty(timeType_filter_value)) { |
| | | json.addProperty(timeType_filter_key, timeType_filter_value); |
| | | } |
| | | if (!TextUtils.isEmpty(search_title)) { |
| | | json.addProperty("title", search_title); |
| | | } |
| | | json.addProperty("pageNo", pageNo);//页码 |
| | | json.addProperty("pageSize", pageSize);//页数 |
| | | |
| | |
| | | |
| | | public MyViewHolder(@NonNull View itemView) { |
| | | super(itemView); |
| | | power_station_name_tv = itemView.findViewById(R.id.power_station_name_tv); |
| | | power_station_name_tv = itemView.findViewById(R.id.message_name_tv); |
| | | power_station_location_tv = itemView.findViewById(R.id.power_station_location_tv); |
| | | } |
| | | } |
| | |
| | | |
| | | public MyViewHolder(@NonNull View itemView) { |
| | | super(itemView); |
| | | power_station_name_tv = itemView.findViewById(R.id.power_station_name_tv); |
| | | power_station_name_tv = itemView.findViewById(R.id.message_name_tv); |
| | | power_station_location_tv = itemView.findViewById(R.id.power_station_location_tv); |
| | | } |
| | | } |
| | |
| | | package com.hdl.photovoltaic.ui.adapter; |
| | | |
| | | import android.content.Context; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | |
| | | import android.widget.TextView; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.appcompat.content.res.AppCompatResources; |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.enums.MessageAlarmStateType; |
| | | import com.hdl.photovoltaic.ui.bean.DeviceBean; |
| | | import com.hdl.photovoltaic.ui.bean.MessageBean; |
| | | import com.hdl.photovoltaic.utils.TimeUtils; |
| | | import com.hdl.photovoltaic.widget.SwipeLayout; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | */ |
| | | public class SearchMessageAdapter extends RecyclerView.Adapter<SearchMessageAdapter.MyViewHolder> { |
| | | |
| | | List<DeviceBean> mList; |
| | | List<MessageBean> mList; |
| | | |
| | | Context mContext; |
| | | |
| | |
| | | @NonNull |
| | | @Override |
| | | public SearchMessageAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
| | | View contentItem = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_device_details, parent, false); |
| | | View contentItem = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_search_message, parent, false); |
| | | return new SearchMessageAdapter.MyViewHolder(contentItem); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindViewHolder(@NonNull SearchMessageAdapter.MyViewHolder holder, int position) { |
| | | DeviceBean deviceBean = this.mList.get(position); |
| | | holder.itemView.setTag(position); |
| | | holder.itemView.setOnClickListener(new View.OnClickListener() { |
| | | public void onBindViewHolder(@NonNull SearchMessageAdapter.MyViewHolder itemHolder, int position) { |
| | | MessageBean messageBean = this.mList.get(position); |
| | | itemHolder.message_name_tv.setText(messageBean.getTitle()); |
| | | itemHolder.message_content_tv.setText(messageBean.getHomeName()); |
| | | String date = TimeUtils.getTimeFromTimestamp(messageBean.getCreateTime()); |
| | | itemHolder.message_time_tv.setText(date); |
| | | 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); |
| | | drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_e34343); |
| | | } else if (messageBean.getType().equals(MessageAlarmStateType.warn)) { |
| | | 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.loading_title_tip); |
| | | drawable = AppCompatResources.getDrawable(mContext, R.drawable.state_b9b9b9); |
| | | } |
| | | itemHolder.message_state_tv.setText(type); |
| | | itemHolder.message_state_tv.setBackground(drawable); |
| | | itemHolder.itemView.setTag(position); |
| | | itemHolder.itemView.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | try { |
| | | if (mOnclickListener != null) { |
| | | mOnclickListener.onClick((int) holder.itemView.getTag(), deviceBean); |
| | | mOnclickListener.onClick((int) itemHolder.itemView.getTag(), messageBean); |
| | | } |
| | | } catch (Exception ignored) { |
| | | } |
| | |
| | | this.mOnclickListener = onClickListener; |
| | | } |
| | | |
| | | public void setList(List<DeviceBean> newData) { |
| | | public void setList(List<MessageBean> newData) { |
| | | if (this.mList == null) { |
| | | this.mList = new ArrayList<>(); |
| | | } else { |
| | |
| | | * 一行布局容器 |
| | | */ |
| | | static class MyViewHolder extends RecyclerView.ViewHolder { |
| | | public TextView message_name_tv; |
| | | |
| | | public ImageView homeIconIv;//住宅图片 |
| | | public TextView homeNameTv;//住宅名称 |
| | | public TextView capacityTv;//装机容量 |
| | | public TextView powerTv;//发电功率 |
| | | public TextView stateTv;//电站状态(连接中,运行,离线,故障); |
| | | public RelativeLayout item_parent_rl;//条目父容器 |
| | | public ImageView move_home_iv;//移动电站位置 |
| | | public ImageView del_home_iv;//删除电站 |
| | | public SwipeLayout item_parent_swipeLayout;//父容器 |
| | | public TextView message_content_tv; |
| | | public TextView message_time_tv; |
| | | public TextView message_state_tv; |
| | | |
| | | public MyViewHolder(@NonNull View itemView) { |
| | | super(itemView); |
| | | homeIconIv = itemView.findViewById(R.id.device_details_image_iv); |
| | | homeNameTv = itemView.findViewById(R.id.device_details_name_tv); |
| | | capacityTv = itemView.findViewById(R.id.device_details_sn_tv); |
| | | powerTv = itemView.findViewById(R.id.power_type_tv); |
| | | stateTv = itemView.findViewById(R.id.fragment_house_list_line_state_tv); |
| | | item_parent_rl = itemView.findViewById(R.id.item_parent_rl); |
| | | move_home_iv = itemView.findViewById(R.id.move_home_iv); |
| | | del_home_iv = itemView.findViewById(R.id.del_home_iv); |
| | | item_parent_swipeLayout = itemView.findViewById(R.id.item_parent_swipeLayout); |
| | | message_name_tv = itemView.findViewById(R.id.message_name_tv); |
| | | message_content_tv = itemView.findViewById(R.id.message_content_tv); |
| | | message_time_tv = itemView.findViewById(R.id.message_time_tv); |
| | | message_state_tv = itemView.findViewById(R.id.message_state_tv); |
| | | } |
| | | } |
| | | |
| | | public interface OnClickListener { |
| | | void onClick(int position, DeviceBean deviceBean); |
| | | void onClick(int position, MessageBean messageBean); |
| | | |
| | | } |
| | | } |
| | |
| | | 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); |
| | | loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | } |
| | | }); |
| | | //报警记录 |
| | |
| | | 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); |
| | | loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | } |
| | | }); |
| | | //搜索消息 |
| | |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | hideLoading(); |
| | | loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | } |
| | | |
| | | @Override |
| | |
| | | viewBinding.allDeviceTitleTv.setText(title); |
| | | mDeviceTypeFilterKye = FilterType.deviceType; |
| | | mDeviceTypeFilterValue = findFilterValueString(title); |
| | | loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | |
| | | } |
| | | }); |
| | |
| | | viewBinding.allGradeTitleTv.setText(title); |
| | | mTypeFilterKye = FilterType.type; |
| | | mTypeFilterValue = findFilterValueString(title); |
| | | loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | } |
| | | }); |
| | | } |
| | |
| | | viewBinding.allTimeTitleTv.setText(title); |
| | | mTimeTypeFilterKye = FilterType.timeType; |
| | | mTimeTypeFilterValue = findFilterValueString(title); |
| | | loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | } |
| | | }); |
| | | } |
| | |
| | | @Override |
| | | public void onRefresh() { |
| | | viewBinding.messageSrl.setRefreshing(false); |
| | | loadNextPageMessageList(1, true, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); |
| | | } |
| | | }); |
| | | //上拉按钮 |
| | |
| | | if (!isLoadingMore) { |
| | | // 滑动到了底部,执行相应的操作 |
| | | HdlLogLogic.print("--->滑动到了底部"); |
| | | loadNextPageMessageList(++mCurrentPage, false, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, false); |
| | | loadNextPageMessageList(false, ++mCurrentPage, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, false); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | private void initData() { |
| | | //进来读取一次数据(为了更新currentPage,currentTotal这个值),app启动时候读取,为了刷新消息模块的角标 |
| | | loadNextPageMessageList(1, true, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, true); |
| | | loadNextPageMessageList(true, 1, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, true); |
| | | } |
| | | |
| | | |
| | |
| | | * @param isClear true表示清空缓存 |
| | | */ |
| | | private void loadNextPageMessageList( |
| | | int pageNo, |
| | | |
| | | boolean isShowLoading, |
| | | int pageNo, |
| | | String deviceType_filter_key, |
| | | String deviceType_filter_value, |
| | | String type_filter_key, |
| | |
| | | } 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>() { |
| | | 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) { |
| | |
| | | package com.hdl.photovoltaic.ui.message; |
| | | |
| | | |
| | | import android.content.Intent; |
| | | import android.os.Bundle; |
| | | import android.text.Editable; |
| | | import android.text.TextUtils; |
| | |
| | | import com.hdl.photovoltaic.base.CustomBaseActivity; |
| | | import com.hdl.photovoltaic.bean.PageNumberObject; |
| | | import com.hdl.photovoltaic.databinding.ActivitySearchMessgeBinding; |
| | | import com.hdl.photovoltaic.enums.MessageStateType; |
| | | import com.hdl.photovoltaic.enums.ShowErrorMode; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlDeviceLogic; |
| | | import com.hdl.photovoltaic.other.HdlFileLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.other.HdlMessageLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.ui.adapter.SearchHistoryAdapter; |
| | | import com.hdl.photovoltaic.ui.adapter.SearchMessageAdapter; |
| | | import com.hdl.photovoltaic.ui.bean.DeviceBean; |
| | | import com.hdl.photovoltaic.ui.bean.MessageBean; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | |
| | | SearchMessageAdapter searchMessageAdapter;//设备适配器 |
| | | SearchHistoryAdapter searchHistoryAdapter;//历史记录适配器 |
| | | |
| | | private List<DeviceBean> deviceList = new ArrayList<>(); |
| | | |
| | | private int currentHouseListPage = 0; // 当前电站列表页码 |
| | | private int currentHouseListTotal = 0; // 电站列表总页码 |
| | | private boolean isHouseLoadingMore = false; // 标记电站列表正在加载更多数据 |
| | | private final List<MessageBean> mList = new ArrayList<>(); |
| | | private int mCurrentPage = 0; // 当前页码 |
| | | private int mCurrentTotal = 0; // 总页码 |
| | | private boolean isLoadingMore = false; // 标记正在加载更多数据 |
| | | |
| | | private String currSearchText; |
| | | |
| | |
| | | } |
| | | }); |
| | | viewBinding.messageSearchEt.addTextChangedListener(textWatcher); |
| | | |
| | | |
| | | //搜索 |
| | | viewBinding.powerStationSearchTv.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | |
| | | viewBinding.historyListParent.setVisibility(View.GONE); |
| | | viewBinding.listParent.setVisibility(View.VISIBLE); |
| | | addSearchTextToList(); |
| | | loadNextPageHouseList(true, 1, true); |
| | | loadNextPageMessageList(true, 1, viewBinding.messageSearchEt.getText().toString(), true); |
| | | } |
| | | }); |
| | | |
| | |
| | | @Override |
| | | public void onRefresh() { |
| | | viewBinding.listSrl.setRefreshing(false); |
| | | loadNextPageHouseList(true, 1, true); |
| | | loadNextPageMessageList(true, 1, viewBinding.messageSearchEt.getText().toString(), true); |
| | | } |
| | | }); |
| | | //上拉读取 |
| | |
| | | int totalItemCount = layoutManager.getItemCount(); |
| | | int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition(); |
| | | if (visibleItemCount > 0 && visibleItemCount + firstVisibleItemPosition == totalItemCount) { |
| | | if (!isHouseLoadingMore) { |
| | | if (!isLoadingMore) { |
| | | // 滑动到了底部,执行相应的操作 |
| | | HdlLogLogic.print("--->滑动到了底部"); |
| | | loadNextPageHouseList(false, ++currentHouseListPage, false); |
| | | loadNextPageMessageList(false, ++mCurrentPage, viewBinding.messageSearchEt.getText().toString(), false); |
| | | } |
| | | } |
| | | } |
| | |
| | | viewBinding.historyListParent.setVisibility(View.VISIBLE); |
| | | viewBinding.listParent.setVisibility(View.GONE); |
| | | searchHistoryAdapter.setList(searchHistoryTitleList); |
| | | clearData(); |
| | | clearCacheData(); |
| | | } |
| | | }); |
| | | //删除 |
| | |
| | | viewBinding.messageSearchEt.setText(title); |
| | | } |
| | | }); |
| | | //电站点击是事件 |
| | | //消息点击是事件 |
| | | searchMessageAdapter.setOnclickListener(new SearchMessageAdapter.OnClickListener() { |
| | | @Override |
| | | public void onClick(int position, DeviceBean deviceBean) { |
| | | |
| | | public void onClick(int position, MessageBean messageBean) { |
| | | Intent intent = new Intent(); |
| | | intent.putExtra("msgId", messageBean.getMsgId().toString()); |
| | | intent.setClass(_mActivity, MessageInfoActivity.class); |
| | | startActivity(intent); |
| | | } |
| | | }); |
| | | |
| | |
| | | viewBinding.historyListRcv.setLayoutManager(new LinearLayoutManager(_mActivity)); |
| | | viewBinding.historyListRcv.setAdapter(searchHistoryAdapter); |
| | | searchHistoryAdapter.setList(searchHistoryTitleList); |
| | | //初始化电站适配器 |
| | | //初始化消息适配器 |
| | | searchMessageAdapter = new SearchMessageAdapter(_mActivity); |
| | | viewBinding.listRcv.setLayoutManager(new LinearLayoutManager(_mActivity)); |
| | | viewBinding.listRcv.setAdapter(searchMessageAdapter); |
| | |
| | | }; |
| | | |
| | | /** |
| | | * 刷新列表数据 |
| | | */ |
| | | private void updateListData() { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (searchMessageAdapter != null) { |
| | | searchMessageAdapter.setList(mList); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 物理按键返回事件 |
| | | */ |
| | | @Override |
| | |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 刷新UI(设备) |
| | | * 加载一页数据 |
| | | * |
| | | * @param isRefreshing 表示是下拉刷新的 |
| | | * @param isShowLoading 是否启动加载框 true启动 |
| | | * @param pageNo 页数 |
| | | * @param search_title 搜索文本 |
| | | * @param isClear true表示清空缓存 |
| | | */ |
| | | private void loadNextPageHouseList(boolean isRefreshing, long pageNo, boolean isClear) { |
| | | |
| | | //搜索关键字 |
| | | if (TextUtils.isEmpty(currSearchText)) { |
| | | return; |
| | | } |
| | | |
| | | private void loadNextPageMessageList(boolean isShowLoading, int pageNo, String search_title, boolean isClear) { |
| | | if (isClear) { |
| | | clearData(); |
| | | //表示从第一页可以读取,默认清空所有缓存数据; |
| | | clearCacheData(); |
| | | } |
| | | //第一页读取数据强制读取 |
| | | if (pageNo > 1 && currentHouseListPage > currentHouseListTotal) { |
| | | --currentHouseListPage; |
| | | //第一页读取数据强制读 |
| | | if (pageNo > 1 && mCurrentPage > mCurrentTotal) { |
| | | --mCurrentPage; |
| | | //当前页不能大于总页数 |
| | | return; |
| | | } |
| | | isHouseLoadingMore = true;//标记读取状态 |
| | | if (isRefreshing) { |
| | | isLoadingMore = true;//标记读取状态 |
| | | if (isShowLoading) { |
| | | showLoading(); |
| | | } |
| | | |
| | | //获取云端上设备列表 |
| | | HdlDeviceLogic.getInstance().getPowerStationDeviceList(currSearchText, pageNo, 20, new CloudCallBeak<PageNumberObject<DeviceBean>>() { |
| | | @Override |
| | | public void onSuccess(PageNumberObject<DeviceBean> deviceClass) { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | HdlMessageLogic.getInstance().getPageNoMessageList( |
| | | "", |
| | | pageNo, |
| | | "", |
| | | "", |
| | | "", |
| | | "", |
| | | "", |
| | | "", |
| | | "", |
| | | search_title, |
| | | new CloudCallBeak<HdlMessageLogic.MessageListClass>() { |
| | | @Override |
| | | public void run() { |
| | | if (isRefreshing) { |
| | | public void onSuccess(HdlMessageLogic.MessageListClass messageListClass) { |
| | | if (messageListClass != null) { |
| | | mCurrentTotal = (int) messageListClass.getTotalPage(); |
| | | mCurrentPage = (int) messageListClass.getPageNo(); |
| | | setMessageList(messageListClass.getList()); |
| | | updateListData(); |
| | | } |
| | | isLoadingMore = false; |
| | | if (isShowLoading) { |
| | | hideLoading(); |
| | | } |
| | | isHouseLoadingMore = false; |
| | | if (deviceClass != null) { |
| | | currentHouseListTotal = (int) deviceClass.getTotalPage(); |
| | | currentHouseListPage = (int) deviceClass.getPageNo(); |
| | | //更新缓存 |
| | | setDeviceList(deviceClass.getList()); |
| | | if (searchMessageAdapter != null) { |
| | | initData(); |
| | | //更新UI |
| | | searchMessageAdapter.setList(deviceList); |
| | | } |
| | | } |
| | | } |
| | | }, _mActivity, ShowErrorMode.YES); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (currentHouseListPage > 1) { |
| | | --currentHouseListPage; |
| | | public void onFailure(HDLException e) { |
| | | if (mCurrentPage > 1) { |
| | | --mCurrentPage; |
| | | } |
| | | isHouseLoadingMore = false; |
| | | if (isRefreshing) { |
| | | isLoadingMore = false; |
| | | if (isShowLoading) { |
| | | hideLoading(); |
| | | } |
| | | |
| | | } |
| | | }, _mActivity, ShowErrorMode.YES); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | } |
| | | |
| | | private void clearData() { |
| | | if (deviceList != null && deviceList.size() > 0) { |
| | | deviceList.clear(); |
| | | |
| | | private void clearCacheData() { |
| | | if (mList != null && mList.size() > 0) { |
| | | mList.clear(); |
| | | } |
| | | } |
| | | |
| | | public void setDeviceList(List<DeviceBean> list) { |
| | | public void setMessageList(List<MessageBean> list) { |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | if (this.deviceList.size() == 0) { |
| | | this.deviceList.addAll(list); |
| | | if (this.mList.size() == 0) { |
| | | this.mList.addAll(list); |
| | | return; |
| | | } |
| | | for (int i = 0; i < list.size(); i++) { |
| | |
| | | /** |
| | | * 添加设备到列表里面 |
| | | * |
| | | * @param deviceBean -设备对象 |
| | | * @param messageBean -设备对象 |
| | | */ |
| | | public void setSingleDevice(DeviceBean deviceBean) { |
| | | public void setSingleDevice(MessageBean messageBean) { |
| | | try { |
| | | if (deviceBean == null) { |
| | | if (messageBean == null) { |
| | | return; |
| | | } |
| | | boolean if_boolean = false; |
| | | for (int i = 0; i < deviceList.size(); i++) { |
| | | if (deviceList.get(i).getHomeId().equals(deviceBean.getHomeId())) { |
| | | for (int i = 0; i < mList.size(); i++) { |
| | | if (mList.get(i).getHomeId().equals(messageBean.getHomeId())) { |
| | | //存在替换 |
| | | deviceList.remove(i); |
| | | deviceList.add(i, deviceBean); |
| | | mList.remove(i); |
| | | mList.add(i, messageBean); |
| | | if_boolean = true; |
| | | break; |
| | | } |
| | | } |
| | | if (!if_boolean) { |
| | | //没有添加 |
| | | this.deviceList.add(deviceBean); |
| | | this.mList.add(messageBean); |
| | | } |
| | | } catch (Exception e) { |
| | | String mes = e.getMessage(); |
| | |
| | | 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) { |
| | |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | hideLoading(); |
| | | //发起初始化指令给逆变器; |
| | | initializeInverter(list); |
| | | HdlResidenceLogic.getInstance().delHouseId(homeId); |
| | | initializeInverter(list); //发起初始化指令给逆变器;(注意:只能是本地发送了(要搜索局域网逆变器列表,建立本地通讯通道),删除电站成功后,云端解绑逆变器的关系) |
| | | HdlResidenceLogic.getInstance().delHouseId(homeId);//删除电站缓存 |
| | | initData();//初始化缓存数据 |
| | | houseInfoAdapter.setList(houseListBeanIDList);//重新刷新列表 |
| | | nullDataUpdateUi();//检测数据是否为空 |
| | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | hideLoading(); |
| | | |
| | | HdlThreadLogic.toast(_mActivity, e); |
| | | } |
| | | }); |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <corners android:radius="@dimen/dp_13" /> |
| | | <solid android:color="@color/text_FFFFFFFF" /> |
| | | |
| | | </shape> |
| | |
| | | app:layout_constraintTop_toTopOf="parent" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/power_station_name_tv" |
| | | android:id="@+id/message_name_tv" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/dp_23" |
| | | android:layout_marginStart="@dimen/dp_23" |
| | |
| | | android:layout_marginTop="@dimen/dp_7" |
| | | android:textColor="@color/text_40000000" |
| | | android:textSize="@dimen/text_12" |
| | | app:layout_constraintStart_toStartOf="@+id/power_station_name_tv" |
| | | app:layout_constraintTop_toBottomOf="@+id/power_station_name_tv" /> |
| | | app:layout_constraintStart_toStartOf="@+id/message_name_tv" |
| | | app:layout_constraintTop_toBottomOf="@+id/message_name_tv" /> |
| | | |
| | | |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <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_127"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/message_search_iv" |
| | | android:layout_width="@dimen/dp_18" |
| | | android:layout_height="@dimen/dp_18" |
| | | android:layout_marginStart="@dimen/dp_16" |
| | | android:layout_marginTop="@dimen/dp_28" |
| | | android:src="@drawable/search_path" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" /> |
| | | |
| | | <androidx.constraintlayout.widget.ConstraintLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_marginStart="@dimen/dp_57" |
| | | android:layout_marginTop="@dimen/dp_28" |
| | | android:layout_marginEnd="@dimen/dp_21" |
| | | android:background="@drawable/bj_13fffffff" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent"> |
| | | |
| | | <TextView |
| | | android:id="@+id/message_name_tv" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/dp_23" |
| | | android:layout_marginStart="@dimen/dp_16" |
| | | android:layout_marginTop="@dimen/dp_19" |
| | | android:ellipsize="end" |
| | | android:singleLine="true" |
| | | android:textColor="@color/text_90000000" |
| | | android:textSize="@dimen/text_16" |
| | | android:textStyle="bold" |
| | | app:layout_constraintStart_toStartOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/message_content_tv" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/dp_17" |
| | | android:layout_marginTop="@dimen/dp_6" |
| | | android:textColor="@color/text_40000000" |
| | | android:textSize="@dimen/text_12" |
| | | app:layout_constraintStart_toStartOf="@+id/message_name_tv" |
| | | app:layout_constraintTop_toBottomOf="@+id/message_name_tv" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/message_time_tv" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/dp_17" |
| | | android:layout_marginTop="@dimen/dp_6" |
| | | android:textColor="@color/text_40000000" |
| | | android:textSize="@dimen/text_12" |
| | | app:layout_constraintStart_toStartOf="@+id/message_content_tv" |
| | | app:layout_constraintTop_toBottomOf="@+id/message_content_tv" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/message_state_tv" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="@dimen/dp_33" |
| | | android:background="@drawable/state_ffb300" |
| | | android:gravity="center" |
| | | android:paddingStart="@dimen/dp_12" |
| | | android:paddingEnd="@dimen/dp_12" |
| | | android:textColor="@color/text_FFFFFFFF" |
| | | android:textSize="@dimen/text_12" |
| | | app:layout_constraintEnd_toEndOf="parent" |
| | | app:layout_constraintTop_toTopOf="parent" /> |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |
| | | |
| | | </androidx.constraintlayout.widget.ConstraintLayout> |