合并接口第七次次上传,跳轉統一性
This commit is contained in:
parent
7005895d90
commit
96eee88c82
@ -1,8 +1,6 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.media.AudioManager;
|
||||
@ -67,6 +65,7 @@ import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.GiftCacheUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.ProcessResultUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@ -92,7 +91,6 @@ import com.yunbao.live.http.ImHttpUtil;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.live.views.LiveRoomPlayViewHolder;
|
||||
import com.yunbao.live.views.PortraitLiveManager;
|
||||
|
||||
@ -103,7 +101,6 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/10.
|
||||
@ -178,6 +175,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
mStream = mLiveBean.getStream();
|
||||
initData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面
|
||||
*/
|
||||
@ -342,53 +340,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取直播间状态
|
||||
*/
|
||||
// private HttpCallback liveInfo = new HttpCallback() {
|
||||
// @Override
|
||||
// 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, (liveBean1, liveType, liveTypeVal, liveSdk) -> {
|
||||
// //主播正在直播
|
||||
// if (liveBean1 == null) {
|
||||
// return;
|
||||
// }
|
||||
// runOnUiThread(() -> {
|
||||
// mLiveSDK = liveSdk;
|
||||
// mLiveType = liveType;
|
||||
// mLiveTypeVal = liveTypeVal;
|
||||
// mLiveBean = liveBean1;
|
||||
// mLiveUid = liveBean1.getUid();
|
||||
// mStream = liveBean1.getStream();
|
||||
// mAncherName = liveBean1.getUserNiceName();
|
||||
// mAncherIcon = liveBean1.getAvatar();
|
||||
// Log.e(TAG, "mLiveUid--------------------------->" + mLiveUid);
|
||||
// //加载当前页面数据
|
||||
// View rootView = manager.getRootView();
|
||||
// if (rootView.getParent() != null && rootView.getParent() instanceof ViewGroup) {
|
||||
// ((ViewGroup) (rootView.getParent())).removeView(rootView);
|
||||
// manager.onRemove(false);
|
||||
// }
|
||||
// mViewGroup.addView(manager.getRootView());
|
||||
//
|
||||
// manager.onAdd(liveBean1, liveType, liveTypeVal, liveSdk);
|
||||
// //加载完页面后再后台静默下载礼物svga
|
||||
// downloadAllGift();
|
||||
// over();
|
||||
// });
|
||||
//
|
||||
//
|
||||
// });
|
||||
//
|
||||
// mCheckLivePresenter.checkLive(liveBean);
|
||||
// } else {
|
||||
// //主播未直播时自动下滑至下一个直播间
|
||||
// verticalViewPager.setCurrentItem(mCurrentPage + 1);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
private void over() {
|
||||
if ("NEWUSER".equals(getIntent().getStringExtra("OPEN"))) {
|
||||
Intent intent = getIntent();
|
||||
@ -1199,38 +1150,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
return super.canBackPressed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转当前页面
|
||||
*/
|
||||
public static void forward(Context context, LiveBean liveBean, int liveType,
|
||||
int liveTypeVal, String key, int position, int liveSdk) {
|
||||
forward(context, liveBean, liveType, liveTypeVal, key, null, position, liveSdk);
|
||||
}
|
||||
|
||||
public static void forward(Context context, LiveBean liveBean, int liveType,
|
||||
int liveTypeVal, String key, Map<String, String> map, int position, int liveSdk) {
|
||||
if (MicStatusManager.getInstance().getMicStatus() != MicStatusManager.MIC_TYPE_DEFAULT &&
|
||||
!MicStatusManager.getInstance().getMicLiveId().equals(liveBean.getUid())) {
|
||||
MicStatusManager.getInstance().showDownMicDialog(context);
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(context, LiveAudienceActivity.class);
|
||||
intent.putExtra(Constants.LIVE_BEAN, liveBean);
|
||||
intent.putExtra(Constants.LIVE_TYPE, liveType);
|
||||
intent.putExtra(Constants.LIVE_TYPE_VAL, liveTypeVal);
|
||||
intent.putExtra(Constants.LIVE_KEY, key);
|
||||
intent.putExtra(Constants.LIVE_POSITION, position);
|
||||
intent.putExtra(Constants.LIVE_SDK, liveSdk);
|
||||
intent.putExtra(Constants.LIVE_SDK, liveSdk);
|
||||
if (map != null) {
|
||||
for (String _key : map.keySet()) {
|
||||
intent.putExtra(_key, map.get(_key));
|
||||
}
|
||||
}
|
||||
intent.putExtra("landscape", liveBean.getLandscape());
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取侧边栏数据
|
||||
|
@ -140,7 +140,7 @@ public class WebViewActivityMedal extends AbsActivity {
|
||||
}
|
||||
|
||||
});
|
||||
mWebView.addJavascriptInterface( JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView), "androidObject");
|
||||
mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, mWebView), "androidObject");
|
||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
@ -167,9 +167,13 @@ public class WebViewActivityMedal extends AbsActivity {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
|
||||
LiveAudienceActivity.forward(mContext, liveBean, 0, 0, "", 0, 0);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
RouteUtil.forwardUserHome(mContext, String.valueOf(live_id), 0);
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,13 @@ import com.yunbao.common.custom.ItemDecoration;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.live.utils.LiveStorge;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.adapter.MainHomeFollowAdapter;
|
||||
import com.yunbao.main.http.MainHttpConsts;
|
||||
import com.yunbao.main.http.MainHttpUtil;
|
||||
import com.yunbao.main.presenter.CheckLivePresenter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -33,7 +34,6 @@ public class LiveClassActivity extends AbsActivity implements OnItemClickListene
|
||||
private int mClassId;
|
||||
private CommonRefreshView mRefreshView;
|
||||
private MainHomeFollowAdapter mAdapter;
|
||||
private CheckLivePresenter mCheckLivePresenter;
|
||||
|
||||
public static void forward(Context context, int classId, String className) {
|
||||
Intent intent = new Intent(context, LiveClassActivity.class);
|
||||
@ -116,14 +116,12 @@ public class LiveClassActivity extends AbsActivity implements OnItemClickListene
|
||||
* 观看直播
|
||||
*/
|
||||
public void watchLive(LiveBean liveBean, int position) {
|
||||
if (mCheckLivePresenter == null) {
|
||||
mCheckLivePresenter = new CheckLivePresenter(mContext);
|
||||
}
|
||||
if (CommonAppConfig.LIVE_ROOM_SCROLL) {
|
||||
mCheckLivePresenter.watchLive(liveBean, Constants.LIVE_CLASS_PREFIX + mClassId, position);
|
||||
} else {
|
||||
mCheckLivePresenter.watchLive(liveBean);
|
||||
}
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,6 +26,7 @@ import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.event.JumpUserHomeEvent;
|
||||
import com.yunbao.main.fragment.SearchRecommendFragment;
|
||||
@ -174,7 +175,12 @@ public class SearchActivity extends AbsActivity {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
|
||||
LiveAudienceActivity.forward(mContext, liveBean, 0, 0, "", 0, 0);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//跳转到个人资料
|
||||
if (imm != null && mEditText != null) {
|
||||
|
@ -1,184 +0,0 @@
|
||||
package com.yunbao.main.presenter;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.main.R;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/9/29.
|
||||
*/
|
||||
|
||||
public class CheckLivePresenter {
|
||||
|
||||
private Context mContext;
|
||||
private LiveBean mLiveBean;//选中的直播间信息
|
||||
private String mKey;
|
||||
private int mPosition;
|
||||
private int mLiveType;//直播间的类型 普通 密码 门票 计时等
|
||||
private int mLiveTypeVal;//收费价格等
|
||||
private String mLiveTypeMsg;//直播间提示信息或房间密码
|
||||
private int mLiveSdk;
|
||||
private HttpCallback mCheckLiveCallback;
|
||||
|
||||
public CheckLivePresenter(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 观众 观看直播
|
||||
*/
|
||||
public void watchLive(LiveBean bean) {
|
||||
watchLive(bean, "", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 观众 观看直播
|
||||
*/
|
||||
public void watchLive(LiveBean bean, String key, int position) {
|
||||
mLiveBean = bean;
|
||||
mKey = key;
|
||||
mPosition = position;
|
||||
if (mCheckLiveCallback == null) {
|
||||
mCheckLiveCallback = new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
mLiveType = obj.getIntValue("type");
|
||||
mLiveTypeVal = obj.getIntValue("type_val");
|
||||
mLiveTypeMsg = obj.getString("type_msg");
|
||||
if (CommonAppConfig.LIVE_SDK_CHANGED) {
|
||||
mLiveSdk = obj.getIntValue("live_sdk");
|
||||
} else {
|
||||
mLiveSdk = CommonAppConfig.LIVE_SDK_USED;
|
||||
}
|
||||
switch (mLiveType) {
|
||||
case Constants.LIVE_TYPE_NORMAL:
|
||||
forwardNormalRoom();
|
||||
break;
|
||||
case Constants.LIVE_TYPE_PWD:
|
||||
//forwardPwdRoom();
|
||||
forwardLiveAudienceActivity();
|
||||
break;
|
||||
case Constants.LIVE_TYPE_PAY:
|
||||
case Constants.LIVE_TYPE_TIME:
|
||||
forwardPayRoom();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showLoadingDialog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog createLoadingDialog() {
|
||||
return DialogUitl.loadingDialog(mContext);
|
||||
}
|
||||
};
|
||||
}
|
||||
LiveHttpUtil.checkLive(bean.getUid(), bean.getStream(), mCheckLiveCallback);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 前往普通房间
|
||||
*/
|
||||
private void forwardNormalRoom() {
|
||||
forwardLiveAudienceActivity();
|
||||
}
|
||||
|
||||
/**
|
||||
* 前往密码房间
|
||||
*/
|
||||
private void forwardPwdRoom() {
|
||||
DialogUitl.showSimpleInputDialog(mContext, WordUtil.getString(R.string.live_input_password), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
ToastUtil.show(WordUtil.getString(R.string.live_input_password));
|
||||
return;
|
||||
}
|
||||
String password = MD5Util.getMD5(content);
|
||||
if (mLiveTypeMsg.equalsIgnoreCase(password)) {
|
||||
dialog.dismiss();
|
||||
forwardLiveAudienceActivity();
|
||||
} else {
|
||||
ToastUtil.show(WordUtil.getString(R.string.live_password_error));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 前往付费房间
|
||||
*/
|
||||
private void forwardPayRoom() {
|
||||
DialogUitl.showSimpleDialog(mContext, mLiveTypeMsg, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
roomCharge();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void roomCharge() {
|
||||
LiveHttpUtil.roomCharge(mLiveBean.getUid(), mLiveBean.getStream(), mRoomChargeCallback);
|
||||
}
|
||||
|
||||
private HttpCallback mRoomChargeCallback = new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
forwardLiveAudienceActivity();
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showLoadingDialog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog createLoadingDialog() {
|
||||
return DialogUitl.loadingDialog(mContext);
|
||||
}
|
||||
};
|
||||
|
||||
public void cancel() {
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到直播间
|
||||
*/
|
||||
private void forwardLiveAudienceActivity() {
|
||||
LiveAudienceActivity.forward(mContext, mLiveBean, mLiveType, mLiveTypeVal, mKey, mPosition, mLiveSdk);
|
||||
}
|
||||
}
|
@ -235,7 +235,12 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
|
||||
LiveAudienceActivity.forward(mContext, liveBean, 0, 0, "", 0, 0);
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
RouteUtil.forwardUserHome(mContext, String.valueOf(live_id), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user