1:修改页面的图标
This commit is contained in:
@@ -5,16 +5,19 @@ import android.app.Activity;
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.NewsDataBean;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
|
||||
public class NewsContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
void getOfficialNoticeList(NewsDataBean newsDataBeans);
|
||||
|
||||
void myInfoSuccess(UserInfo data);
|
||||
}
|
||||
public interface IHomePre extends IPresenter {
|
||||
|
||||
void getOfficialNotice();
|
||||
void getMyInfo();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,14 +10,22 @@ import com.example.modulenews.R;
|
||||
import com.example.modulenews.contacts.NewsContacts;
|
||||
import com.example.modulenews.databinding.FragmentNewsBinding;
|
||||
import com.example.modulenews.presenter.NewsPresenter;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
import com.xscm.moduleutil.activity.news.OfficialNoticeActivity;
|
||||
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.NewsDataBean;
|
||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
|
||||
import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragment;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.event.UnreadCountEvent;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -29,20 +37,29 @@ import java.util.List;
|
||||
*@description: 音域
|
||||
*/
|
||||
public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBinding> implements NewsContacts.View {
|
||||
|
||||
private Long messageCount;
|
||||
public static NewsFragment newInstance () {
|
||||
return new NewsFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData () {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MvpPre.getOfficialNotice();
|
||||
MvpPre.getMyInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHiddenChanged(boolean hidden) {
|
||||
super.onHiddenChanged(hidden);
|
||||
if (!hidden){
|
||||
MvpPre.getOfficialNotice();
|
||||
MvpPre.getMyInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -131,5 +148,20 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
}else {
|
||||
mBinding.tvOfficialCount.setVisibility(View.GONE);
|
||||
}
|
||||
int count = newsDataBeans.getSystem_no_read_count()+newsDataBeans.getAnnouncement_read_count();
|
||||
UnreadCountEvent event = CommonAppContext.getInstance().getUnreadCountEvent();
|
||||
if (event== null){
|
||||
event = new UnreadCountEvent();
|
||||
event.setALong(0);
|
||||
}
|
||||
event.setBLong( (long)count);
|
||||
CommonAppContext.getInstance().setUnreadCountEvent(event);
|
||||
EventBus.getDefault().post(event);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void myInfoSuccess(UserInfo data) {
|
||||
SpUtil.saveUserInfo(data);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
|
||||
import com.example.modulenews.contacts.NewsContacts;
|
||||
import com.xscm.moduleutil.bean.NewsDataBean;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
@@ -28,4 +29,19 @@ public class NewsPresenter extends BasePresenter<NewsContacts.View> implements N
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getMyInfo() {
|
||||
api.getMyInfo(new BaseObserver<UserInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(UserInfo userInfo) {
|
||||
MvpRef.get().myInfoSuccess(userInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user