| | |
| | | |
| | | import android.os.Bundle; |
| | | |
| | | import androidx.recyclerview.widget.LinearLayoutManager; |
| | | |
| | | import com.hdl.photovoltaic.base.CustomBaseFragment; |
| | | import com.hdl.photovoltaic.config.ConstantManage; |
| | | import com.hdl.photovoltaic.databinding.FragmentRecoverMessageBinding; |
| | | import com.hdl.photovoltaic.other.HdlCommonLogic; |
| | | import com.hdl.photovoltaic.other.HdlLogLogic; |
| | | import com.hdl.photovoltaic.ui.adapter.MessageAdapter; |
| | | import com.hdl.photovoltaic.ui.bean.MessageBean; |
| | | import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 消息-已恢复 |
| | | */ |
| | | public class RecoverMessageFragment extends CustomBaseFragment { |
| | | |
| | | FragmentRecoverMessageBinding viewBinding; |
| | | |
| | | private MessageAdapter messageRecoverAdapter; |
| | | |
| | | private List<MessageBean> mList; |
| | | @Override |
| | | public Object getContentView() { |
| | | return null; |
| | | viewBinding = FragmentRecoverMessageBinding.inflate(getLayoutInflater()); |
| | | return viewBinding.getRoot(); |
| | | } |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | //初始化数据 |
| | | initData(); |
| | | //初始化界面 |
| | | initView(); |
| | | //初始化监听器 |
| | | initEvent(); |
| | | } |
| | | |
| | | private void initData() { |
| | | mList = new ArrayList<>(); |
| | | for (int i = 0; i < 2; i++) { |
| | | MessageBean messageBean = new MessageBean(); |
| | | messageBean.setContent("来了一条告警信息" + i); |
| | | messageBean.setHomeName(i + ""); |
| | | messageBean.setTime("2023-12-06-15"); |
| | | messageBean.setRead(false); |
| | | mList.add(messageBean); |
| | | } |
| | | } |
| | | |
| | | private void initEvent() { |
| | | messageRecoverAdapter.setNoOnclickListener(new MessageAdapter.OnclickListener() { |
| | | @Override |
| | | public void onClick(int position, MessageBean item) { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void initView() { |
| | | viewBinding.messageRecoverRecyclerview.setLayoutManager(new LinearLayoutManager(_mActivity)); |
| | | messageRecoverAdapter = new MessageAdapter(this.mList, _mActivity); |
| | | viewBinding.messageRecoverRecyclerview.setAdapter(messageRecoverAdapter); |
| | | } |
| | | |
| | | private void updateListData() { |
| | | if (this.messageRecoverAdapter != null) { |
| | | this.messageRecoverAdapter.notifyDataSetChanged(); |
| | | } |
| | | } |
| | | @Override |
| | | public void onEventMessage(BaseEventBus eventBus) { |
| | | super.onEventMessage(eventBus); |
| | | //接收外部点击事件 |
| | | if (eventBus.getTopic().equals(ConstantManage.message_function_tab_switch)) { |
| | | if (eventBus.getType().equals(HdlCommonLogic.MessageFunctionTabSwitch.recover.toString())) { |
| | | HdlLogLogic.print("正在点击【已恢复】"); |
| | | } |
| | | } |
| | | } |
| | | } |