1:修改点唱房的bug
2:添加公会消息类型
This commit is contained in:
@@ -12,10 +12,14 @@ public class NewsContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void showNews(List<NewsMessageList> newsList);
|
||||
void finishRefresh();
|
||||
|
||||
void postInvite();
|
||||
}
|
||||
public interface IHomePre extends IPresenter {
|
||||
|
||||
void getMessagetitle(String type,String page,String pageLimit);
|
||||
|
||||
void postInvite(String apply_id, String type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,13 +6,16 @@ import com.xscm.moduleutil.bean.NewsMessageList;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class NewsPresenter extends BasePresenter<NewsContacts.View> implements NewsContacts.IHomePre {
|
||||
NewsContacts.View mView;
|
||||
public NewsPresenter(NewsContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +30,31 @@ public class NewsPresenter extends BasePresenter<NewsContacts.View> implements N
|
||||
|
||||
@Override
|
||||
public void onNext(List<NewsMessageList> newsMessageLists) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().showNews(newsMessageLists);
|
||||
MvpRef.get().finishRefresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInvite(String apply_id, String type) {
|
||||
api.postInvite(apply_id, type, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().postInvite();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,48 +61,78 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
|
||||
protected void convert(BaseViewHolder helper, NewsMessageList item) {
|
||||
String time = TimeUtils.getDateToStringNoZ(Long.parseLong(item.getCreatetime()) * 1000L);
|
||||
helper.setText(R.id.tv_sys_time, time);
|
||||
if (item.getImage()==null || item.getImage().isEmpty()){
|
||||
helper.getView(R.id.tv_sys_con).setVisibility(VISIBLE);
|
||||
helper.setText(R.id.tv_sys_con, item.getContent());
|
||||
helper.getView(R.id.ll_system_official).setVisibility(GONE);
|
||||
}else {
|
||||
helper.getView(R.id.tv_sys_con).setVisibility(GONE);
|
||||
helper.getView(R.id.ll_system_official).setVisibility(VISIBLE);
|
||||
ImageUtils.loadHeadCC(item.getImage(), helper.getView(R.id.image));
|
||||
helper.setText(R.id.tv_cont, Html.fromHtml(item.getContent()));
|
||||
}
|
||||
helper.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (item.getRoom_id()>0){
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id()+"","",null);
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("roomId", item.getRoom_id() + "").navigation();
|
||||
}else if (item.getRoom_id() == 0 && item.getUrl() != null && !item.getUrl().isEmpty()){
|
||||
Intent intent = new Intent(OfficialNoticeActivity.this, WebViewActivity.class);
|
||||
intent.putExtra("url", item.getUrl());
|
||||
startActivity(intent);
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", item.getUrl()).navigation();
|
||||
}
|
||||
if (item.getType() == 6) {
|
||||
helper.getView(R.id.ll_system).setVisibility(GONE);
|
||||
helper.getView(R.id.ll_gh).setVisibility(VISIBLE);
|
||||
|
||||
helper.setText(R.id.tv_sys_cons, item.getContent());
|
||||
if (item.getGuild_invited_status()==0){
|
||||
helper.getView(R.id.ll_but).setVisibility(VISIBLE);
|
||||
helper.getView(R.id.tv_cancel2).setVisibility(GONE);
|
||||
}else if (item.getGuild_invited_status()==1){
|
||||
helper.getView(R.id.ll_but).setVisibility(GONE);
|
||||
helper.getView(R.id.tv_cancel2).setVisibility(VISIBLE);
|
||||
helper.setText(R.id.tv_cancel2,"已同意");
|
||||
}else if (item.getGuild_invited_status()==2){
|
||||
helper.getView(R.id.ll_but).setVisibility(GONE);
|
||||
helper.getView(R.id.tv_cancel2).setVisibility(VISIBLE);
|
||||
helper.setText(R.id.tv_cancel2,"已拒绝");
|
||||
}
|
||||
});
|
||||
helper.getView(R.id.tv_cancel).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MvpPre.postInvite(item.getId()+"","2");
|
||||
helper.getView(R.id.ll_but).setVisibility(GONE);
|
||||
helper.getView(R.id.tv_cancel2).setVisibility(VISIBLE);
|
||||
helper.setText(R.id.tv_cancel2,"已拒绝");
|
||||
}
|
||||
});
|
||||
|
||||
helper.getView(R.id.tv_confirm).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MvpPre.postInvite(item.getId()+"","1");
|
||||
helper.getView(R.id.ll_but).setVisibility(GONE);
|
||||
helper.getView(R.id.tv_cancel2).setVisibility(VISIBLE);
|
||||
helper.setText(R.id.tv_cancel2,"已同意");
|
||||
MvpPre.getMessagetitle(type, "1", "10");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// if (item.getType().equals("1")) {
|
||||
// helper.getView(R.id.ll_system_official).setVisibility(GONE);
|
||||
// } else if (item.getType().equals("2")) {
|
||||
// helper.getView(R.id.tv_sys_con).setVisibility(GONE);
|
||||
// helper.getView(R.id.ll_system_official).setVisibility(VISIBLE);
|
||||
// } else {
|
||||
// helper.getView(R.id.ll_system_official).setVisibility(GONE);
|
||||
// }
|
||||
} else {
|
||||
helper.getView(R.id.ll_system).setVisibility(VISIBLE);
|
||||
helper.getView(R.id.ll_gh).setVisibility(GONE);
|
||||
if (item.getImage() == null || item.getImage().isEmpty()) {
|
||||
helper.getView(R.id.tv_sys_con).setVisibility(VISIBLE);
|
||||
helper.setText(R.id.tv_sys_con, item.getContent());
|
||||
helper.getView(R.id.ll_system_official).setVisibility(GONE);
|
||||
} else {
|
||||
helper.getView(R.id.tv_sys_con).setVisibility(GONE);
|
||||
helper.getView(R.id.ll_system_official).setVisibility(VISIBLE);
|
||||
ImageUtils.loadHeadCC(item.getImage(), helper.getView(R.id.image));
|
||||
helper.setText(R.id.tv_cont, Html.fromHtml(item.getContent()));
|
||||
}
|
||||
helper.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (item.getRoom_id() > 0) {
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id() + "", "", null);
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("roomId", item.getRoom_id() + "").navigation();
|
||||
} else if (item.getRoom_id() == 0 && item.getUrl() != null && !item.getUrl().isEmpty()) {
|
||||
Intent intent = new Intent(OfficialNoticeActivity.this, WebViewActivity.class);
|
||||
intent.putExtra("url", item.getUrl());
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// helper.getView(R.id.image).setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
};
|
||||
mBinding.recycleView.setAdapter(mAdapter);
|
||||
@@ -122,7 +152,18 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
|
||||
|
||||
@Override
|
||||
public void showNews(List<NewsMessageList> newsList) {
|
||||
mAdapter.setNewData(newsList);
|
||||
// 判断是否为第一页
|
||||
if (page == 1) {
|
||||
// 第一页,使用setNewData替换所有数据
|
||||
mAdapter.setNewData(newsList);
|
||||
} else {
|
||||
// 非第一页(上拉加载),判断是否有数据
|
||||
if (newsList != null && !newsList.isEmpty()) {
|
||||
// 有数据,添加到现有数据中
|
||||
mAdapter.addData(newsList);
|
||||
}
|
||||
// 如果没有数据,不做任何操作,保持原有数据不变
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,4 +171,9 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
|
||||
mBinding.smartRefreshLayout.finishRefresh();
|
||||
mBinding.smartRefreshLayout.finishLoadMore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInvite() {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user