From 438e4880f3f43021b222b201378377c1ec34c634 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期六, 11 五月 2024 14:59:10 +0800 Subject: [PATCH] 2024年05月11日14:59:03 --- app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java | 81 +++++++++++++++++----------------------- 1 files changed, 34 insertions(+), 47 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java b/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java index 7d4221d..466190d 100644 --- a/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java +++ b/app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java @@ -96,7 +96,7 @@ 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); } }); //鎶ヨ璁板綍 @@ -110,7 +110,7 @@ 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); } }); //鎼滅储娑堟伅 @@ -132,7 +132,7 @@ @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 @@ -151,21 +151,7 @@ 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); - - } - }); - + setTypeTitleListDialog(viewBinding.allDeviceTitleTv, FilterType.deviceType, getTypeList(FilterType.deviceType)); } }); @@ -176,18 +162,8 @@ 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); - } - }); + setTypeTitleListDialog(viewBinding.allGradeTitleTv, FilterType.type, getTypeList(FilterType.type)); + } }); //鍏ㄩ儴鏃堕棿(褰撳ぉ銆佽繎3澶┿�佽繎7澶┿�佽繎30澶�)鎸夐挳 @@ -197,18 +173,7 @@ 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); - } - }); + setTypeTitleListDialog(viewBinding.allTimeTitleTv, FilterType.timeType, getTypeList(FilterType.timeType)); } }); @@ -218,7 +183,7 @@ @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); } }); //涓婃媺鎸夐挳 @@ -238,7 +203,7 @@ if (!isLoadingMore) { // 婊戝姩鍒颁簡搴曢儴锛屾墽琛岀浉搴旂殑鎿嶄綔 HdlLogLogic.print("--->婊戝姩鍒颁簡搴曢儴"); - loadNextPageMessageList(++mCurrentPage, false, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, false); + loadNextPageMessageList(false, ++mCurrentPage, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, false); } } } @@ -255,6 +220,27 @@ }); } + } + + /** + * 绫诲瀷绛涢�� + * + * @param textView 缁勪欢鏄剧ず + * @param filterType 杩囨护绫诲瀷 + * @param stringList 杩囨护绫诲瀷鍊艰〃 + */ + private void setTypeTitleListDialog(TextView textView, String filterType, List<String> stringList) { + TypeTitleListDialog typeTitleListDialog = new TypeTitleListDialog(_mActivity, stringList); + typeTitleListDialog.show(); + typeTitleListDialog.setOnListener(new TypeTitleListDialog.OnClickListener() { + @Override + public void onClick(int position, String title) { + textView.setText(title); + mTimeTypeFilterKye = filterType; + mTimeTypeFilterValue = findFilterValueString(title); + loadNextPageMessageList(true, 1, mDeviceTypeFilterKye, mDeviceTypeFilterValue, mTypeFilterKye, mTypeFilterValue, mTimeTypeFilterKye, mTimeTypeFilterValue, true); + } + }); } @@ -274,7 +260,7 @@ private void initData() { //杩涙潵璇诲彇涓�娆℃暟鎹�(涓轰簡鏇存柊currentPage锛宑urrentTotal杩欎釜鍊�),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); } @@ -315,8 +301,9 @@ * @param isClear true琛ㄧず娓呯┖缂撳瓨 */ private void loadNextPageMessageList( - int pageNo, + boolean isShowLoading, + int pageNo, String deviceType_filter_key, String deviceType_filter_value, String type_filter_key, @@ -344,7 +331,7 @@ } 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) { -- Gitblit v1.8.0