| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 电站消息界面 |
| | | */ |
| | | public class MessageActivity extends CustomBaseActivity { |
| | | |
| | | private FragmentMessageBinding viewBinding; |
| | |
| | | |
| | | |
| | | private void initData() { |
| | | //进来读取一次数据(为了更新currentPage,currentTotal这个值),app启动时候读取,为了刷新消息模块的角标 |
| | | loadNextPageMessageList(true, 1, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, true); |
| | | HdlThreadLogic.runSubThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | //进来读取一次数据(为了更新currentPage,currentTotal这个值),app启动时候读取,为了刷新消息模块的角标 |
| | | loadNextPageMessageList(true, 1, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, FilterType.all, true); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | return; |
| | | } |
| | | isLoadingMore = true;//标记读取状态 |
| | | if (isShowLoading) { |
| | | showLoading(); |
| | | } |
| | | String messageStateType; |
| | | if (isAlarmDeviceClick) { |
| | | messageStateType = MessageStateType.untreated; |
| | | } else { |
| | | messageStateType = MessageStateType.processed; |
| | | } |
| | | |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (isShowLoading) { |
| | | showLoading(); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | |
| | | HdlMessageLogic.getInstance().getPageNoMessageList(mMessageBean.getHomeId(), 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(); |
| | | mTotalCount = (int) messageListClass.getTotalCount(); |
| | | updateListData(); |
| | | } |
| | | isLoadingMore = false; |
| | | if (isShowLoading) { |
| | | hideLoading(); |
| | | } |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (isShowLoading) { |
| | | hideLoading(); |
| | | } |
| | | if (messageListClass != null) { |
| | | mCurrentTotal = (int) messageListClass.getTotalPage(); |
| | | mCurrentPage = (int) messageListClass.getPageNo(); |
| | | mTotalCount = (int) messageListClass.getTotalCount(); |
| | | updateListData(); |
| | | } |
| | | isLoadingMore = false; |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | if (mCurrentPage > 1) { |
| | | --mCurrentPage; |
| | | } |
| | | isLoadingMore = false; |
| | | if (isShowLoading) { |
| | | hideLoading(); |
| | | } |
| | | HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")"); |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | if (isShowLoading) { |
| | | hideLoading(); |
| | | } |
| | | if (mCurrentPage > 1) { |
| | | --mCurrentPage; |
| | | } |
| | | isLoadingMore = false; |
| | | HdlThreadLogic.toast(_mActivity, e.getMsg() + "(" + e.getCode() + ")"); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |