From 636c4bb04e4fcd723766b82732990cdb4ae4ea2e Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期四, 22 二月 2024 15:48:23 +0800
Subject: [PATCH] 删除掉本地库
---
app/src/main/java/com/hdl/photovoltaic/ui/message/MessageFragment.java | 82 +++++++++++++++++++++++++---------------
1 files changed, 51 insertions(+), 31 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 11770e3..ea34e28 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
@@ -12,11 +12,14 @@
import com.hdl.photovoltaic.base.CustomBaseFragment;
import com.hdl.photovoltaic.config.ConstantManage;
import com.hdl.photovoltaic.databinding.FragmentMessageBinding;
+import com.hdl.photovoltaic.enums.HomepageTitleTabSwitch;
import com.hdl.photovoltaic.enums.MessageFunctionTabSwitch;
-import com.hdl.photovoltaic.other.HdlCommonLogic;
+import com.hdl.photovoltaic.other.HdlLogLogic;
import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus;
import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
@@ -61,8 +64,9 @@
@Override
public void onClick(View v) {
currentIndex = 0;
- showFragment();
initView();
+ showFragment();
+ postEventBus(MessageFunctionTabSwitch.nascent);
}
});
@@ -71,8 +75,9 @@
@Override
public void onClick(View v) {
currentIndex = 1;
- showFragment();
initView();
+ showFragment();
+ postEventBus(MessageFunctionTabSwitch.recover);
}
});
@@ -82,8 +87,9 @@
@Override
public void onClick(View v) {
currentIndex = 2;
- showFragment();
initView();
+ showFragment();
+ postEventBus(MessageFunctionTabSwitch.all);
}
});
}
@@ -91,30 +97,28 @@
private void initView() {
if (this.currentIndex == 0) {
- viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
- viewBinding.line1V.setVisibility(View.GONE);
- viewBinding.line2V.setVisibility(View.VISIBLE);
- viewBinding.line3V.setVisibility(View.GONE);
- postEventBus(MessageFunctionTabSwitch.nascent);
- } else if (this.currentIndex == 1) {
viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
- viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
- viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
- viewBinding.line1V.setVisibility(View.GONE);
- viewBinding.line2V.setVisibility(View.GONE);
- viewBinding.line3V.setVisibility(View.VISIBLE);
- postEventBus(MessageFunctionTabSwitch.recover);
- } else if (this.currentIndex == 2) {
- viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
- viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
- viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
viewBinding.line1V.setVisibility(View.VISIBLE);
viewBinding.line2V.setVisibility(View.GONE);
viewBinding.line3V.setVisibility(View.GONE);
- postEventBus(MessageFunctionTabSwitch.all);
+ } else if (this.currentIndex == 1) {
+ viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
+ viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
+ viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
+ viewBinding.line1V.setVisibility(View.GONE);
+ viewBinding.line2V.setVisibility(View.VISIBLE);
+ viewBinding.line3V.setVisibility(View.GONE);
+ } else if (this.currentIndex == 2) {
+ viewBinding.messageTabNascentTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
+ viewBinding.messageTabRecoverTitleTv.setTextColor(getResources().getColor(R.color.text80_FFFFFF, null));
+ viewBinding.messageTabAllTitleTv.setTextColor(getResources().getColor(R.color.text_FFFFFFFF, null));
+ viewBinding.line1V.setVisibility(View.GONE);
+ viewBinding.line2V.setVisibility(View.GONE);
+ viewBinding.line3V.setVisibility(View.VISIBLE);
}
+
}
private void initData() {
@@ -128,8 +132,9 @@
private void postEventBus(MessageFunctionTabSwitch tabSwitch) {
BaseEventBus baseEventBus = new BaseEventBus();
baseEventBus.setTopic(ConstantManage.message_function_tab_switch);
- baseEventBus.setType(tabSwitch + "");
- EventBus.getDefault().post(baseEventBus);
+ baseEventBus.setType(tabSwitch.toString());
+ //鍙戦�佺矘鎬т簨浠�(濡傛灉涓嶅彂绮樻�т簨浠朵細閬囧埌涓�涓病鏈夊姞杞藉嚭鏉ョ殑纰庣墖鎺ユ敹涓嶅埌淇℃伅)
+ EventBus.getDefault().postSticky(baseEventBus);
}
@@ -160,8 +165,6 @@
fragmentList.add(mRecoverMessageFragment);
fragmentList.add(mAllMessageFragment);
showFragment();
-
-
}
}
@@ -175,14 +178,16 @@
//濡傛灉涔嬪墠娌℃湁娣诲姞杩�
if (!fragmentList.get(currentIndex).isAdded()) {
//绗笁涓弬鏁颁负娣诲姞褰撳墠鐨刦ragment鏃剁粦瀹氫竴涓猼ag
- ft.hide(currentFragment)
- .add(R.id.message_fcv, fragmentList.get(currentIndex), currentIndex + "");
+ ft.hide(currentFragment).add(R.id.message_fcv, fragmentList.get(currentIndex), currentIndex + "");
} else {
- ft.hide(currentFragment)
- .show(fragmentList.get(currentIndex));
+ ft.hide(currentFragment).show(fragmentList.get(currentIndex));
}
currentFragment = fragmentList.get(currentIndex);
ft.commit();
+ //鎶婂綋鍓嶆樉绀虹殑fragment璁板綍涓嬫潵
+ currentFragment = fragmentList.get(currentIndex);
+
+
}
/**
@@ -198,9 +203,24 @@
}
}
ft.commit();
- //鎶婂綋鍓嶆樉绀虹殑fragment璁板綍涓嬫潵
- currentFragment = fragmentList.get(currentIndex);
+
}
+ @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
+ public void onEventMessage(BaseEventBus eventBus) {
+ super.onEventMessage(eventBus);
+ if (eventBus == null) {
+ return;
+ }
+ //鎺ユ敹澶栭儴鐐瑰嚮浜嬩欢
+ if (eventBus.getTopic().equals(ConstantManage.homepage_title_tab_switch)) {
+ if (eventBus.getType().equals(HomepageTitleTabSwitch.message.toString())) {
+ // 鍙栨秷绮樻�т簨浠�
+ EventBus.getDefault().removeStickyEvent(eventBus);
+ postEventBus(MessageFunctionTabSwitch.nascent);
+ HdlLogLogic.print("姝e湪鐐瑰嚮銆愭秷鎭��");
+ }
+ }
+ }
}
--
Gitblit v1.8.0