| | |
| | | |
| | | 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.FragmentNascentMessageBinding; |
| | | 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 NascentMessageFragment extends CustomBaseFragment { |
| | | private FragmentNascentMessageBinding viewBinding; |
| | | |
| | | private MessageAdapter messageNascentAdapter; |
| | | |
| | | private List<MessageBean> mList; |
| | | |
| | | @Override |
| | | public Object getContentView() { |
| | | return null; |
| | | viewBinding = FragmentNascentMessageBinding.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 < 5; 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() { |
| | | messageNascentAdapter.setNoOnclickListener(new MessageAdapter.OnclickListener() { |
| | | @Override |
| | | public void onClick(int position, MessageBean item) { |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void initView() { |
| | | viewBinding.messageNascentRecyclerview.setLayoutManager(new LinearLayoutManager(_mActivity)); |
| | | messageNascentAdapter = new MessageAdapter(this.mList, _mActivity); |
| | | viewBinding.messageNascentRecyclerview.setAdapter(messageNascentAdapter); |
| | | } |
| | | |
| | | private void updateListData() { |
| | | if (this.messageNascentAdapter != null) { |
| | | this.messageNascentAdapter.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.nascent.toString())) { |
| | | HdlLogLogic.print("正在点击【进行中】"); |
| | | } |
| | | } |
| | | } |
| | | } |