修改测试问题,shouye ytuijian

This commit is contained in:
18401019693 2022-08-10 21:42:09 +08:00
parent 94343c17c6
commit 270bf2786e
4 changed files with 45 additions and 37 deletions

View File

@ -11,14 +11,12 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.blankj.utilcode.util.GsonUtils; import com.alibaba.fastjson.JSON;
import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.SetAttentsModel; import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
@ -105,6 +103,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
.anchorRecommend("3", new HttpCallback<AnchorRecommendModel>() { .anchorRecommend("3", new HttpCallback<AnchorRecommendModel>() {
@Override @Override
public void onSuccess(AnchorRecommendModel data) { public void onSuccess(AnchorRecommendModel data) {
if (((Activity) mContext).isFinishing()) return;
if (data.getListShow() == 1) { if (data.getListShow() == 1) {
listShow.setVisibility(View.VISIBLE); listShow.setVisibility(View.VISIBLE);
} else { } else {
@ -305,34 +304,19 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
*/ */
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onJumpUserHome(JumpUserHomeEvent event) { public void onJumpUserHome(JumpUserHomeEvent event) {
LiveNetManager.get(mContext) LiveHttpUtil.getLiveInfo(event.getModel().getId() + "", new com.yunbao.common.http.HttpCallback() {
.getLiveInfo(String.valueOf(event.getModel().getId()), new HttpCallback<LiveInfoModel>() {
@Override @Override
public void onSuccess(LiveInfoModel data) { public void onSuccess(int code, String msg, String[] info) {
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean, liveType, liveTypeVal, liveSdk) -> { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean == null) { if (liveBean == null) {
return; return;
} }
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
});
//讲数据转成json
String json = GsonUtils.toJson(data);
LiveBean liveBean = GsonUtils.fromJson(json, LiveBean.class);
mCheckLivePresenter.checkLive(liveBean);
if (mContext instanceof LiveAnchorActivity) {
((LiveAnchorActivity) mContext).superBackPressed();
} else if (mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).exitLiveRoom();
} else if (mContext instanceof LiveRyAnchorActivity) {
((LiveRyAnchorActivity) mContext).superBackPressed();
}
}
@Override
public void onError(String error) {
RouteUtil.forwardUserHome(mContext, String.valueOf(event.getModel().getId()), 0); RouteUtil.forwardUserHome(mContext, String.valueOf(event.getModel().getId()), 0);
if (mContext instanceof LiveAnchorActivity) { if (mContext instanceof LiveAnchorActivity) {
((LiveAnchorActivity) mContext).superBackPressed(); ((LiveAnchorActivity) mContext).superBackPressed();
@ -345,6 +329,25 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
} }
}); });
mCheckLivePresenter.checkLive(liveBean);
} else {
RouteUtil.forwardUserHome(mContext, String.valueOf(event.getModel().getId()), 0);
RouteUtil.forwardUserHome(mContext, String.valueOf(event.getModel().getId()), 0);
if (mContext instanceof LiveAnchorActivity) {
((LiveAnchorActivity) mContext).superBackPressed();
} else if (mContext instanceof LiveAudienceActivity) {
((LiveAudienceActivity) mContext).exitLiveRoom();
} else if (mContext instanceof LiveRyAnchorActivity) {
((LiveRyAnchorActivity) mContext).superBackPressed();
}
}
}
});
} }
} }

View File

@ -428,6 +428,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
.anchorRecommend("10", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() { .anchorRecommend("10", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
@Override @Override
public void onSuccess(AnchorRecommendModel data) { public void onSuccess(AnchorRecommendModel data) {
if (isFinishing()) return;
if (data.getListShow() == 1 && data.getList().size() > 2) { if (data.getListShow() == 1 && data.getList().size() > 2) {
floatBanner.setVisibility(View.VISIBLE); floatBanner.setVisibility(View.VISIBLE);
findViewById(R.id.banner_click).setVisibility(View.VISIBLE); findViewById(R.id.banner_click).setVisibility(View.VISIBLE);

View File

@ -60,6 +60,7 @@ public class SearchRecommendFragment extends BaseFragment {
.anchorRecommend("10", new HttpCallback<AnchorRecommendModel>() { .anchorRecommend("10", new HttpCallback<AnchorRecommendModel>() {
@Override @Override
public void onSuccess(AnchorRecommendModel data) { public void onSuccess(AnchorRecommendModel data) {
if (getActivity().isFinishing()) return;
//组装搜索历史数据 //组装搜索历史数据
List<SearchRecommendModel> searchRecommendModels = new ArrayList<>(); List<SearchRecommendModel> searchRecommendModels = new ArrayList<>();
Map<String, String> historyRecordMap = SearchHistoryRecordManager.get(getActivity()).getHistoryRecordMap(); Map<String, String> historyRecordMap = SearchHistoryRecordManager.get(getActivity()).getHistoryRecordMap();

View File

@ -138,6 +138,7 @@ public class SearchResultsItemFragment extends BaseFragment {
type, page, new HttpCallback<List<List<SearchModel>>>() { type, page, new HttpCallback<List<List<SearchModel>>>() {
@Override @Override
public void onSuccess(List<List<SearchModel>> data) { public void onSuccess(List<List<SearchModel>> data) {
if (getActivity().isFinishing()) return;
if (page > 1) { if (page > 1) {
itemAdapter.onLoadMoreData(data, searchKey); itemAdapter.onLoadMoreData(data, searchKey);
} else { } else {
@ -154,6 +155,7 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override @Override
public void onError(String error) { public void onError(String error) {
if (getActivity().isFinishing()) return;
emptyLayout.setVisibility(View.VISIBLE); emptyLayout.setVisibility(View.VISIBLE);
searchList.setVisibility(View.GONE); searchList.setVisibility(View.GONE);
} }
@ -165,7 +167,7 @@ public class SearchResultsItemFragment extends BaseFragment {
type, page, new HttpCallback<List<SearchModel>>() { type, page, new HttpCallback<List<SearchModel>>() {
@Override @Override
public void onSuccess(List<SearchModel> data) { public void onSuccess(List<SearchModel> data) {
if (getActivity().isFinishing()) return;
List<List<SearchModel>> listList = new ArrayList<>(); List<List<SearchModel>> listList = new ArrayList<>();
listList.add(data); listList.add(data);
if (page > 1) { if (page > 1) {
@ -187,6 +189,7 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override @Override
public void onError(String error) { public void onError(String error) {
if (getActivity().isFinishing()) return;
emptyLayout.setVisibility(View.VISIBLE); emptyLayout.setVisibility(View.VISIBLE);
searchList.setVisibility(View.GONE); searchList.setVisibility(View.GONE);
} }