|
@@ -13,16 +13,20 @@ import com.cooleshow.base.utils.TimeUtils;
|
|
import com.cooleshow.base.utils.UiUtils;
|
|
import com.cooleshow.base.utils.UiUtils;
|
|
import com.cooleshow.base.utils.Utils;
|
|
import com.cooleshow.base.utils.Utils;
|
|
import com.cooleshow.institution.stu.R;
|
|
import com.cooleshow.institution.stu.R;
|
|
|
|
+import com.cooleshow.institution.stu.bean.CountOfUnreadBean;
|
|
import com.cooleshow.institution.stu.constants.JGWebConstants;
|
|
import com.cooleshow.institution.stu.constants.JGWebConstants;
|
|
import com.cooleshow.institution.stu.constants.JGWebStartHelper;
|
|
import com.cooleshow.institution.stu.constants.JGWebStartHelper;
|
|
|
|
+import com.cooleshow.institution.stu.contract.MineContract;
|
|
import com.cooleshow.institution.stu.databinding.FgMineLayoutBinding;
|
|
import com.cooleshow.institution.stu.databinding.FgMineLayoutBinding;
|
|
import com.cooleshow.institution.stu.presenter.MinePresenter;
|
|
import com.cooleshow.institution.stu.presenter.MinePresenter;
|
|
import com.cooleshow.usercenter.bean.StudentUserInfo;
|
|
import com.cooleshow.usercenter.bean.StudentUserInfo;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Author by pq, Date on 2023/9/13.
|
|
* Author by pq, Date on 2023/9/13.
|
|
*/
|
|
*/
|
|
-public class MineFragment extends BaseMVPFragment<FgMineLayoutBinding, MinePresenter> implements View.OnClickListener {
|
|
|
|
|
|
+public class MineFragment extends BaseMVPFragment<FgMineLayoutBinding, MinePresenter> implements View.OnClickListener, MineContract.MineContractView {
|
|
@Override
|
|
@Override
|
|
protected void initView(View rootView) {
|
|
protected void initView(View rootView) {
|
|
Utils.setHeadView(mViewBinding.viewStatusBar, getContext(), 0);
|
|
Utils.setHeadView(mViewBinding.viewStatusBar, getContext(), 0);
|
|
@@ -47,6 +51,7 @@ public class MineFragment extends BaseMVPFragment<FgMineLayoutBinding, MinePrese
|
|
mViewBinding.tvUserProtocol.setOnClickListener(this);
|
|
mViewBinding.tvUserProtocol.setOnClickListener(this);
|
|
mViewBinding.tvPrivacyPolicy.setOnClickListener(this);
|
|
mViewBinding.tvPrivacyPolicy.setOnClickListener(this);
|
|
mViewBinding.tvAboutUs.setOnClickListener(this);
|
|
mViewBinding.tvAboutUs.setOnClickListener(this);
|
|
|
|
+ mViewBinding.imMessage.setOnClickListener(this);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -59,6 +64,12 @@ public class MineFragment extends BaseMVPFragment<FgMineLayoutBinding, MinePrese
|
|
return new MinePresenter();
|
|
return new MinePresenter();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void onResume() {
|
|
|
|
+ super.onResume();
|
|
|
|
+ presenter.queryCountOfUnread();
|
|
|
|
+ }
|
|
|
|
+
|
|
public void refreshUserInfo(StudentUserInfo data) {
|
|
public void refreshUserInfo(StudentUserInfo data) {
|
|
if (isDetached()) {
|
|
if (isDetached()) {
|
|
return;
|
|
return;
|
|
@@ -160,5 +171,36 @@ public class MineFragment extends BaseMVPFragment<FgMineLayoutBinding, MinePrese
|
|
JGWebStartHelper.startActivationCodePage();
|
|
JGWebStartHelper.startActivationCodePage();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ if(id == R.id.im_message){
|
|
|
|
+ ARouter.getInstance().build(RouterPath.JGCenter.MESSAGE_BOX)
|
|
|
|
+ .navigation();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void queryUserInfoSuccess(StudentUserInfo data) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void queryCountOfUnreadSuccess(List<CountOfUnreadBean> data) {
|
|
|
|
+ if (isDetached()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (null == data || data.size() == 0) {
|
|
|
|
+ mViewBinding.viewUnreadMessage.setVisibility(View.GONE);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ int totalCount = 0;
|
|
|
|
+ for (CountOfUnreadBean datum : data) {
|
|
|
|
+ totalCount += datum.value;
|
|
|
|
+ }
|
|
|
|
+ if (totalCount > 0) {
|
|
|
|
+ mViewBinding.viewUnreadMessage.setText(String.valueOf(totalCount));
|
|
|
|
+ mViewBinding.viewUnreadMessage.setVisibility(View.VISIBLE);
|
|
|
|
+ } else {
|
|
|
|
+ mViewBinding.viewUnreadMessage.setVisibility(View.GONE);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|