修改测试问题,shouye ytuijian

This commit is contained in:
18401019693 2022-08-10 19:36:15 +08:00
parent 2424fd1e06
commit 89e725a73f
3 changed files with 64 additions and 58 deletions

View File

@ -31,7 +31,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.android.billingclient.api.Purchase; import com.android.billingclient.api.Purchase;
import com.android.billingclient.api.SkuDetails; import com.android.billingclient.api.SkuDetails;
import com.blankj.utilcode.util.GsonUtils;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.tencent.imsdk.v2.V2TIMCallback; import com.tencent.imsdk.v2.V2TIMCallback;
@ -47,7 +46,6 @@ import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.ChatRemarksBean; import com.yunbao.common.bean.ChatRemarksBean;
import com.yunbao.common.bean.ConfigBean; import com.yunbao.common.bean.ConfigBean;
import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.LiveInfoModel;
import com.yunbao.common.bean.LiveSvgGiftBean; import com.yunbao.common.bean.LiveSvgGiftBean;
import com.yunbao.common.bean.UpdataListBean; import com.yunbao.common.bean.UpdataListBean;
import com.yunbao.common.custom.TabButtonGroup; import com.yunbao.common.custom.TabButtonGroup;
@ -59,7 +57,6 @@ import com.yunbao.common.event.RongIMConnectionStatusEvent;
import com.yunbao.common.event.UpdateTablePointMe; import com.yunbao.common.event.UpdateTablePointMe;
import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.http.main.MainNetManager;
import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
@ -375,35 +372,32 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
if (!isClickfloatBanner) { if (!isClickfloatBanner) {
isClickfloatBanner = true; isClickfloatBanner = true;
String Uid = floatBanner.getUid(); String Uid = floatBanner.getUid();
LiveNetManager.get(mContext) LiveHttpUtil.getLiveInfo(Uid + "", new HttpCallback() {
.getLiveInfo(String.valueOf(Uid), new com.yunbao.common.http.base.HttpCallback<LiveInfoModel>() { @Override
@Override public void onSuccess(int code, String msg, String[] info) {
public void onSuccess(LiveInfoModel data) { if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean, liveType, liveTypeVal, liveSdk) -> {
//讲数据转成json LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
String json = GsonUtils.toJson(data); @Override
LiveBean liveBean2 = GsonUtils.fromJson(json, LiveBean.class); public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean2 == null) { if (liveBean == null) {
return; return;
} }
LiveAudienceActivity.forward(mContext, liveBean2, 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);
isClickfloatBanner = false;
}
@Override mCheckLivePresenter.checkLive(liveBean);
public void onError(String error) { } else {
RouteUtil.forwardUserHome(mContext, String.valueOf(Uid), 0); RouteUtil.forwardUserHome(mContext,Uid, 0);
isClickfloatBanner = false;
} }
}); }
});
} }

View File

@ -16,16 +16,15 @@ import android.widget.TextView;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import com.blankj.utilcode.util.GsonUtils; import com.alibaba.fastjson.JSON;
import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.bean.LiveInfoModel; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.SearchHistoryRecordManager; import com.yunbao.common.manager.SearchHistoryRecordManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.live.activity.LiveAudienceActivity; import com.yunbao.live.activity.LiveAudienceActivity;
import com.yunbao.live.bean.LiveBean; import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.event.JumpUserHomeEvent; import com.yunbao.main.event.JumpUserHomeEvent;
@ -169,34 +168,35 @@ public class SearchActivity extends AbsActivity {
*/ */
@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 HttpCallback() {
.getLiveInfo(String.valueOf(event.getModel().getId()), new HttpCallback<LiveInfoModel>() { @Override
@Override public void onSuccess(int code, String msg, String[] info) {
public void onSuccess(LiveInfoModel data) { if (code == 0 && info.length > 0) {
LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, (liveBean, liveType, liveTypeVal, liveSdk) -> { LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
//讲数据转成json
String json = GsonUtils.toJson(data);
LiveBean liveBean2 = GsonUtils.fromJson(json, LiveBean.class); LiveRoomCheckLivePresenter mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
if (liveBean2 == null) { @Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean == null) {
return; return;
} }
LiveAudienceActivity.forward(mContext, liveBean2, 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);
}
@Override
public void onError(String error) {
//跳转到个人资料
if (imm != null && mEditText != null) {
imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
RouteUtil.forwardUserHome(mContext, String.valueOf(event.getModel().getId()), 0);
} }
});
mCheckLivePresenter.checkLive(liveBean);
} else {
//跳转到个人资料
if (imm != null && mEditText != null) {
imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
RouteUtil.forwardUserHome(mContext, String.valueOf(event.getModel().getId()), 0);
} }
}); }
}
});
} }

View File

@ -13,11 +13,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.SearchModel; import com.yunbao.common.bean.SearchModel;
import com.yunbao.common.event.SearchRecommendEvent;
import com.yunbao.common.fragment.BaseFragment; import com.yunbao.common.fragment.BaseFragment;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.http.main.MainNetManager;
import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.OnRecyclerViewScrollListener; import com.yunbao.common.views.weight.OnRecyclerViewScrollListener;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.adapter.SearchRecommendBodyAdapter; import com.yunbao.main.adapter.SearchRecommendBodyAdapter;
@ -48,7 +46,22 @@ public class SearchResultsItemFragment extends BaseFragment {
@Override @Override
protected void initVariables(Bundle bundle) { protected void initVariables(Bundle bundle) {
setSearchKey(bundle.getString("searchKey"), bundle.getInt("type")); this.searchKey = bundle.getString("searchKey");
this.type = bundle.getInt("type");
}
@Override
public void onResume() {
super.onResume();
setSearchKey(searchKey, type);
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser && type > 1) {
setSearchKey(searchKey, type);
}
} }
@Override @Override
@ -117,8 +130,7 @@ public class SearchResultsItemFragment extends BaseFragment {
* @param type 類型 * @param type 類型
*/ */
public void setSearchKey(String searchKey, int type) { public void setSearchKey(String searchKey, int type) {
this.searchKey = searchKey;
this.type = type;
if (type == 1) { if (type == 1) {
MainNetManager.get(getActivity()) MainNetManager.get(getActivity())
.search(WordsTypeUtil.changeSimplified(searchKey), .search(WordsTypeUtil.changeSimplified(searchKey),