修改测试问题,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.TextView;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager;
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.IMLoginModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.SetAttentsModel;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback;
@ -105,6 +103,7 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
.anchorRecommend("3", new HttpCallback<AnchorRecommendModel>() {
@Override
public void onSuccess(AnchorRecommendModel data) {
if (((Activity) mContext).isFinishing()) return;
if (data.getListShow() == 1) {
listShow.setVisibility(View.VISIBLE);
} else {
@ -305,34 +304,19 @@ public class LiveEndViewHolder extends AbsViewHolder implements View.OnClickList
*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onJumpUserHome(JumpUserHomeEvent event) {
LiveNetManager.get(mContext)
.getLiveInfo(String.valueOf(event.getModel().getId()), new HttpCallback<LiveInfoModel>() {
LiveHttpUtil.getLiveInfo(event.getModel().getId() + "", new com.yunbao.common.http.HttpCallback() {
@Override
public void onSuccess(LiveInfoModel data) {
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean, liveType, liveTypeVal, liveSdk) -> {
public void onSuccess(int code, String msg, String[] info) {
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) {
return;
}
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);
if (mContext instanceof LiveAnchorActivity) {
((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>() {
@Override
public void onSuccess(AnchorRecommendModel data) {
if (isFinishing()) return;
if (data.getListShow() == 1 && data.getList().size() > 2) {
floatBanner.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>() {
@Override
public void onSuccess(AnchorRecommendModel data) {
if (getActivity().isFinishing()) return;
//组装搜索历史数据
List<SearchRecommendModel> searchRecommendModels = new ArrayList<>();
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>>>() {
@Override
public void onSuccess(List<List<SearchModel>> data) {
if (getActivity().isFinishing()) return;
if (page > 1) {
itemAdapter.onLoadMoreData(data, searchKey);
} else {
@ -154,6 +155,7 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override
public void onError(String error) {
if (getActivity().isFinishing()) return;
emptyLayout.setVisibility(View.VISIBLE);
searchList.setVisibility(View.GONE);
}
@ -165,7 +167,7 @@ public class SearchResultsItemFragment extends BaseFragment {
type, page, new HttpCallback<List<SearchModel>>() {
@Override
public void onSuccess(List<SearchModel> data) {
if (getActivity().isFinishing()) return;
List<List<SearchModel>> listList = new ArrayList<>();
listList.add(data);
if (page > 1) {
@ -187,6 +189,7 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override
public void onError(String error) {
if (getActivity().isFinishing()) return;
emptyLayout.setVisibility(View.VISIBLE);
searchList.setVisibility(View.GONE);
}