Commit de3cb8cb by mReturn

Merge remote-tracking branch 'remotes/origin/dev'

parents c350fd94 69d53b70
Showing with 1942 additions and 725 deletions
...@@ -85,6 +85,8 @@ dependencies { ...@@ -85,6 +85,8 @@ dependencies {
api 'com.google.android:flexbox:1.0.0' api 'com.google.android:flexbox:1.0.0'
api 'com.github.chrisbanes:PhotoView:2.0.0' api 'com.github.chrisbanes:PhotoView:2.0.0'
// api 'cjt.library.wheel:camera:1.1.9' // api 'cjt.library.wheel:camera:1.1.9'
api 'de.hdodenhof:circleimageview:2.2.0'
api project(':umeng') api project(':umeng')
......
...@@ -89,7 +89,7 @@ public class APIException { ...@@ -89,7 +89,7 @@ public class APIException {
return ex; return ex;
} else { } else {
ex = new ResponeThrowable(e, ERROR.UNKNOWN); ex = new ResponeThrowable(e, ERROR.UNKNOWN);
ex.message = BaseApplication.getContext().getString(R.string.error_unknow); ex.message = e.toString();
return ex; return ex;
} }
} }
......
...@@ -33,7 +33,8 @@ public class Constants { ...@@ -33,7 +33,8 @@ public class Constants {
public final static String PATH_USER_REWARD= "/userCenter/user_reward"; public final static String PATH_USER_REWARD= "/userCenter/user_reward";
public static final String PROGRAM_PATH = "pages/mallDetail/main?goodsId=gid&userId=uid&type=1"; //小程序路径 public static final String PROGRAM_PATH = "pages/mallDetail/main?goodsId=gid&userId=uid&type=1"; //小程序路径
public static final String LEAEN_PROGRAM_PATH = " /pages/shareVideo/main?type=_type&id="; //课程视频小程序路径 public static final String LEAEN_PROGRAM_PATH = "/pages/shareVideo/main?type=_type&id="; //课程视频小程序路径
public static final String USER_PROGRAM_PATH = " /pages/masterInfo/main?id=";
public static final String INVITE_NEW_SHARE_URL = "http://app.dl.kf.ai/ext/#/shareMaster?code="; //邀请新人分享链接 public static final String INVITE_NEW_SHARE_URL = "http://app.dl.kf.ai/ext/#/shareMaster?code="; //邀请新人分享链接
public static final String INVITE_NEW_SHARE_URL_BUSINESS = "http://app.dl.kf.ai/ext/#/merchants?code="; //邀请商家分享链接 public static final String INVITE_NEW_SHARE_URL_BUSINESS = "http://app.dl.kf.ai/ext/#/merchants?code="; //邀请商家分享链接
...@@ -156,6 +157,7 @@ public class Constants { ...@@ -156,6 +157,7 @@ public class Constants {
public final static String AppLogoUrl = "https://dayuoss.oss-cn-beijing.aliyuncs.com/saas/151508298725_.pic_hd.jpg"; public final static String AppLogoUrl = "https://dayuoss.oss-cn-beijing.aliyuncs.com/saas/151508298725_.pic_hd.jpg";
public final static String AvatarUrl = "http://dl.kf.ai/test/sp/mobile/ios/business/checkApply/d1f55406ba3eeb90c4f7e8552131e623.JPG?x-oss-process=style/pic";
/***********************其他配置**********************************/ /***********************其他配置**********************************/
......
...@@ -378,7 +378,7 @@ public class CommonUtils { ...@@ -378,7 +378,7 @@ public class CommonUtils {
*/ */
public static String getYearData(String dataStr) { public static String getYearData(String dataStr) {
if (TextUtils.isEmpty(dataStr)) { if (TextUtils.isEmpty(dataStr)) {
return UIUtils.getString(R.string.unknown); return " ";
} else { } else {
SimpleDateFormat df = null; SimpleDateFormat df = null;
Date sDate = null; Date sDate = null;
...@@ -388,7 +388,9 @@ public class CommonUtils { ...@@ -388,7 +388,9 @@ public class CommonUtils {
return df.format(sDate); return df.format(sDate);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
return UIUtils.getString(R.string.unknown); // return UIUtils.getString(R.string.unknown);
return " ";
} }
} }
} }
......
...@@ -233,6 +233,70 @@ public class UIUtils { ...@@ -233,6 +233,70 @@ public class UIUtils {
} }
return style; return style;
} }
/**
* drawStars.
*
* @param starLinearLayout .
* @param lev .
* @param totalLevel .
*/
public static void drawStars(Activity mActivity,LinearLayout starLinearLayout, String lev, String totalLevel) {
String level = "0";
if (!TextUtils.isEmpty(lev)) {
level = lev;
}
int max = Integer.parseInt(totalLevel);
int beginNum = 0;
int endNum = max;
boolean isNedHalf = false;
if (!TextUtils.isEmpty(level)) {
if (Float.parseFloat(level) > max) {
beginNum = max;
endNum = max - beginNum;
} else {
Float levelf = Float.parseFloat(level);
int leveli = Math.round(levelf);
if (leveli > levelf) {
beginNum = leveli - 1;
endNum = (max - 1) - beginNum;
isNedHalf = true;
} else {
beginNum = leveli;
endNum = max - beginNum;
}
}
}
starLinearLayout.removeAllViews();
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(3, 0, 3, 0);
for (int i = 0; i < beginNum; i++) {
ImageView starImg = new ImageView(mActivity);
Bitmap bm = BitmapFactory.decodeResource(mActivity.getResources(), R.drawable.
person_xingxing);
starImg.setImageBitmap(bm);
starLinearLayout.addView(starImg, layoutParams);
}
if (isNedHalf) {
ImageView starImg = new ImageView(mActivity);
Bitmap bm = BitmapFactory.decodeResource(mActivity.getResources(), R.drawable.person_banxing);
starImg.setImageBitmap(bm);
starLinearLayout.addView(starImg, layoutParams);
}
for (int i = 0; i < endNum; i++) {
ImageView starImg = new ImageView(mActivity);
Bitmap bm = BitmapFactory.decodeResource(mActivity.getResources(), R.drawable.
person_xing);
starImg.setImageBitmap(bm);
starLinearLayout.addView(starImg, layoutParams);
}
}
} }
...@@ -162,6 +162,7 @@ ...@@ -162,6 +162,7 @@
<string name="title_agreement">用户协议</string> <string name="title_agreement">用户协议</string>
<string name="agreement_detail">《用户协议》</string> <string name="agreement_detail">《用户协议》</string>
<string name="login_faile">登录失败</string> <string name="login_faile">登录失败</string>
<string name="login_faile_by_role">该账号不是大鱼师傅</string>
<string name="send_code_faile">发送验证码失败</string> <string name="send_code_faile">发送验证码失败</string>
<string name="voice_code_notice">收不到短信?试试语音验证</string> <string name="voice_code_notice">收不到短信?试试语音验证</string>
<string name="schedule">日程</string> <string name="schedule">日程</string>
...@@ -679,10 +680,10 @@ ...@@ -679,10 +680,10 @@
<string name="agreement"> <string name="agreement">
特别提示:\n 特别提示:\n
欢迎您注册使用大U服(以下简称“大鱼平台”),您在申请注册流程中点击同意本协议之前,应当认真阅读本协议。请您务必审慎阅读、充分理解各条款内容,特别是免除或者限制责任的条款、法律适用和争议解决条款。免除或者限制责任的条款将以粗体以及下划线标识,您应重点阅读。如您对本协议有任何疑问,请与kf@kf.ai联系。当您按照注册页面提示填写信息、阅读并同意本协议且完成全部注册程序后,即表示您已充分阅读、理解并接受本协议的全部内容,并与北京大鱼创想网络科技有限公司达成一致,双方同意使用互联网信息技术以数据电文形式订立本用户协议并认同其效力。\n 欢迎您注册使用大云服(以下简称“大鱼平台”),您在申请注册流程中点击同意本协议之前,应当认真阅读本协议。请您务必审慎阅读、充分理解各条款内容,特别是免除或者限制责任的条款、法律适用和争议解决条款。免除或者限制责任的条款将以粗体以及下划线标识,您应重点阅读。如您对本协议有任何疑问,请与kf@kf.ai联系。当您按照注册页面提示填写信息、阅读并同意本协议且完成全部注册程序后,即表示您已充分阅读、理解并接受本协议的全部内容,并与北京大鱼创想网络科技有限公司达成一致,双方同意使用互联网信息技术以数据电文形式订立本用户协议并认同其效力。\n
您的下载、注册、登录、使用及连接大鱼平台服务等行为均将被视为您已经完全了解、接受并同意遵守本协议项下的全部内容。本协议可由本公司根据需要不时的修改,并以网站或应用程序公示的方式进行公告,不再单独通知您。修改后的协议一经公布即替代原来的协议,构成您与本公司之间就本协议主题事由的全部、最新协议。您有义务不时关注并阅读最新版的协议以及网站或应用程序的公告。如您不同意更新后的协议,可以且应立即停止接受本公司依据本协议提供的服务;如您继续使用大鱼平台的服务的,即视为您同意更新后的协议。\n 您的下载、注册、登录、使用及连接大鱼平台服务等行为均将被视为您已经完全了解、接受并同意遵守本协议项下的全部内容。本协议可由本公司根据需要不时的修改,并以网站或应用程序公示的方式进行公告,不再单独通知您。修改后的协议一经公布即替代原来的协议,构成您与本公司之间就本协议主题事由的全部、最新协议。您有义务不时关注并阅读最新版的协议以及网站或应用程序的公告。如您不同意更新后的协议,可以且应立即停止接受本公司依据本协议提供的服务;如您继续使用大鱼平台的服务的,即视为您同意更新后的协议。\n
第一条 定义\n 第一条 定义\n
1. 大鱼平台:大鱼平台是由北京大鱼创想科技有限公司(下简称“本公司”或者“乙方”)开发的提供服务的互联网产品,包含大鱼U服SAAS平台和大鱼师傅app。\n 1. 大鱼平台:大鱼平台是由北京大鱼创想科技有限公司(下简称“本公司”或者“乙方”)开发的提供服务的互联网产品,包含大鱼云服SAAS平台和大鱼师傅app。\n
2. 大客户:是指服务需求的提供方,通过派遣服务单的方式提供服务需求给服务商,并对其服务进行验收的企业或个人。\n 2. 大客户:是指服务需求的提供方,通过派遣服务单的方式提供服务需求给服务商,并对其服务进行验收的企业或个人。\n
3. 平台用户(以下简称“甲方”):平台用户是指签署本协议并有权使用大鱼平台服务人员账户的个人,包括且不限于服务师傅,店长和服务商管理员。\n 3. 平台用户(以下简称“甲方”):平台用户是指签署本协议并有权使用大鱼平台服务人员账户的个人,包括且不限于服务师傅,店长和服务商管理员。\n
4. 最终用户:用户是指通过大鱼平台完成全部注册程序后,提出服务申请并享受相关服务的个人。\n 4. 最终用户:用户是指通过大鱼平台完成全部注册程序后,提出服务申请并享受相关服务的个人。\n
...@@ -937,7 +938,7 @@ C) 雿輻憭折掉撟喳餈葉鈭抒嚗恥 ...@@ -937,7 +938,7 @@ C) 雿輻憭折掉撟喳餈葉鈭抒嚗恥
<string name="user_bank_account">银行账号:</string> <string name="user_bank_account">银行账号:</string>
<string name="user_bank_account_hint">请输入银行账号</string> <string name="user_bank_account_hint">请输入银行账号</string>
<string name="user_bank_holer">开户人姓名:</string> <string name="user_bank_holer">开户人姓名:</string>
<string name="fill_bank_notice">完善银行卡信息,您的所有收入和奖励将会在下个月1号由平台提现到此卡上</string> <string name="fill_bank_notice">完善银行卡信息后,您的所有收入和奖励将会在下个月初由平台提现到此卡上</string>
<string name="user_bank_holer_hint">请输入开户人姓名</string> <string name="user_bank_holer_hint">请输入开户人姓名</string>
<string name="user_addr_info">快递地址信息</string> <string name="user_addr_info">快递地址信息</string>
<string name="user_receiver_addr">收件地址:</string> <string name="user_receiver_addr">收件地址:</string>
......
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<item name="android:layout_height">35dp</item> <item name="android:layout_height">35dp</item>
<item name="android:padding">3dp</item> <item name="android:padding">3dp</item>
<item name="android:layout_marginLeft">10dp</item> <item name="android:layout_marginLeft">10dp</item>
<item name="android:gravity">left|center_vertical</item> <item name="android:gravity">left|top</item>
<item name="android:background">@drawable/bg_input_gray_react</item> <item name="android:background">@drawable/bg_input_gray_react</item>
</style> </style>
......
...@@ -5,8 +5,8 @@ buildscript { ...@@ -5,8 +5,8 @@ buildscript {
ext.build_tools_version = "27.0.3" ext.build_tools_version = "27.0.3"
ext.min_sdk_version = 17 ext.min_sdk_version = 17
ext.target_sdk_version = 26 ext.target_sdk_version = 26
ext.version_code = 259 ext.version_code = 260
ext.verson_name = "2.5.9" ext.verson_name = "2.6.0"
ext.gradle_version = '3.1.4' ext.gradle_version = '3.1.4'
ext.isReleaseMinify = false ext.isReleaseMinify = false
ext.isDebugMinify = false ext.isDebugMinify = false
......
...@@ -74,7 +74,7 @@ public class PrepareLiveActivity extends BaseActivity<SImplePresenter, ActivityP ...@@ -74,7 +74,7 @@ public class PrepareLiveActivity extends BaseActivity<SImplePresenter, ActivityP
private void initCover() { private void initCover() {
// String strCover = TCUserMgr.getInstance().getCoverPic(); // String strCover = TCUserMgr.getInstance().getCoverPic();
if (!TextUtils.isEmpty(coverUrl)) { if (!TextUtils.isEmpty(coverUrl)) {
GlideImageLoader.load(this,mBind.ivCover,coverUrl,R.drawable.publish_background); GlideImageLoader.loadFit(this,mBind.ivCover,coverUrl,R.drawable.publish_background);
// mBind.tvTips.setVisibility(View.GONE); // mBind.tvTips.setVisibility(View.GONE);
} else { } else {
mBind.ivCover.setImageResource(com.dayu.livemodule.R.drawable.publish_background); mBind.ivCover.setImageResource(com.dayu.livemodule.R.drawable.publish_background);
......
...@@ -4,6 +4,7 @@ import android.content.Context; ...@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import com.dayu.base.ui.activity.BaseActivity; import com.dayu.base.ui.activity.BaseActivity;
...@@ -32,6 +33,7 @@ public class VideoPlayActivity extends BaseActivity<SImplePresenter, ActivityVid ...@@ -32,6 +33,7 @@ public class VideoPlayActivity extends BaseActivity<SImplePresenter, ActivityVid
@Override @Override
public int getLayoutId() { public int getLayoutId() {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
return R.layout.activity_video_play; return R.layout.activity_video_play;
} }
......
...@@ -186,7 +186,7 @@ public class CommonLearnFragment extends BaseFragment<CommonLearnPresenter, Frag ...@@ -186,7 +186,7 @@ public class CommonLearnFragment extends BaseFragment<CommonLearnPresenter, Frag
addShareRecord(data); addShareRecord(data);
} else { } else {
String imgUrl = CommonUtils.getVideoImg(item.getUrl()); String imgUrl = CommonUtils.getVideoImg(item.getUrl());
LogUtils.e("shareImg: "+imgUrl); LogUtils.e("sharevideo: "+item.getUrl());
CommonUtils.shareUrl(mActivity, url,imgUrl , item.getName(), item.getBrief(), SHARE_MEDIA.WEIXIN_CIRCLE, null); CommonUtils.shareUrl(mActivity, url,imgUrl , item.getName(), item.getBrief(), SHARE_MEDIA.WEIXIN_CIRCLE, null);
AddShareRecordData data = new AddShareRecordData(mUserId, mUserInfo.getAccountName(), AddShareRecordData data = new AddShareRecordData(mUserId, mUserInfo.getAccountName(),
"朋友圈", item.getId(), 1); "朋友圈", item.getId(), 1);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
</RelativeLayout> </RelativeLayout>
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
...@@ -36,7 +37,6 @@ ...@@ -36,7 +37,6 @@
android:layout_height="200dp" android:layout_height="200dp"
android:onClick="onClick" android:onClick="onClick"
android:background="@color/black" android:background="@color/black"
android:scaleType="centerCrop"
/> />
<TextView <TextView
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
android:gravity="center" android:gravity="center"
android:paddingLeft="15dp" android:paddingLeft="15dp"
android:paddingRight="15dp" android:paddingRight="15dp"
android:text="发布时间 2020-01-01" /> android:text="发布时间 " />
<TextView <TextView
android:id="@+id/tv_disable" android:id="@+id/tv_disable"
......
...@@ -57,67 +57,67 @@ import java.util.Vector; ...@@ -57,67 +57,67 @@ import java.util.Vector;
public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.HeartBeatCallback, IMMessageMgr.IMMessageListener { public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.HeartBeatCallback, IMMessageMgr.IMMessageListener {
protected static final String TAG = MLVBLiveRoomImpl2.class.getName(); protected static final String TAG = MLVBLiveRoomImpl2.class.getName();
protected static final int LIVEROOM_ROLE_NONE = 0; protected static final int LIVEROOM_ROLE_NONE = 0;
protected static final int LIVEROOM_ROLE_PUSHER = 1; protected static final int LIVEROOM_ROLE_PUSHER = 1;
protected static final int LIVEROOM_ROLE_PLAYER = 2; protected static final int LIVEROOM_ROLE_PLAYER = 2;
protected static MLVBLiveRoomImpl2 mInstance = null; protected static MLVBLiveRoomImpl2 mInstance = null;
protected static final String mServerDomain = "https://liveroom.qcloud.com/weapp/live_room"; //RoomService后台域名 protected static final String mServerDomain = "https://liveroom.qcloud.com/weapp/live_room"; //RoomService后台域名
protected Context mAppContext = null; protected Context mAppContext = null;
protected IMLVBLiveRoomListener mListener = null; protected IMLVBLiveRoomListener mListener = null;
protected int mSelfRoleType = LIVEROOM_ROLE_NONE; protected int mSelfRoleType = LIVEROOM_ROLE_NONE;
protected boolean mJoinPusher = false; protected boolean mJoinPusher = false;
protected boolean mBackground = false; protected boolean mBackground = false;
protected TXLivePlayer mTXLivePlayer; protected TXLivePlayer mTXLivePlayer;
protected TXLivePlayConfig mTXLivePlayConfig; protected TXLivePlayConfig mTXLivePlayConfig;
protected Handler mListenerHandler = null; protected Handler mListenerHandler = null;
protected HttpRequests mHttpRequest = null; //HTTP CGI请求相关 protected HttpRequests mHttpRequest = null; //HTTP CGI请求相关
protected IMMessageMgr mIMMessageMgr; //IM SDK相关 protected IMMessageMgr mIMMessageMgr; //IM SDK相关
protected LoginInfo mSelfAccountInfo; protected LoginInfo mSelfAccountInfo;
protected StreamMixturer mStreamMixturer; //混流类 protected StreamMixturer mStreamMixturer; //混流类
protected HeartBeatThread mHeartBeatThread; //心跳 protected HeartBeatThread mHeartBeatThread; //心跳
protected String mCurrRoomID; protected String mCurrRoomID;
protected int mRoomStatusCode = 0; protected int mRoomStatusCode = 0;
protected ArrayList<RoomInfo> mRoomList = new ArrayList<>(); protected ArrayList<RoomInfo> mRoomList = new ArrayList<>();
protected TXLivePusher mTXLivePusher; protected TXLivePusher mTXLivePusher;
protected TXLivePushListenerImpl mTXLivePushListener; protected TXLivePushListenerImpl mTXLivePushListener;
protected String mSelfPushUrl; protected String mSelfPushUrl;
protected String mSelfAccelerateURL; protected String mSelfAccelerateURL;
protected HashMap<String, PlayerItem> mPlayers = new LinkedHashMap<>(); protected HashMap<String, PlayerItem> mPlayers = new LinkedHashMap<>();
protected HashMap<String, AnchorInfo> mPushers = new LinkedHashMap<>(); protected HashMap<String, AnchorInfo> mPushers = new LinkedHashMap<>();
private IMLVBLiveRoomListener.RequestJoinAnchorCallback mJoinAnchorCallback; private IMLVBLiveRoomListener.RequestJoinAnchorCallback mJoinAnchorCallback;
private Runnable mJoinAnchorTimeoutTask; private Runnable mJoinAnchorTimeoutTask;
private IMLVBLiveRoomListener.RequestRoomPKCallback mRequestPKCallback = null; private IMLVBLiveRoomListener.RequestRoomPKCallback mRequestPKCallback = null;
private Runnable mRequestPKTimeoutTask = null; private Runnable mRequestPKTimeoutTask = null;
private AnchorInfo mPKAnchorInfo = null; private AnchorInfo mPKAnchorInfo = null;
//观众列表最大长度 //观众列表最大长度
private static final int MAX_MEMBER_SIZE = 20; private static final int MAX_MEMBER_SIZE = 20;
//更新观众列表的频率,防止观众进房太多导致的刷新频率太高 //更新观众列表的频率,防止观众进房太多导致的刷新频率太高
private static final int REFRESH_AUDIENCE_INTERVAL_MS = 2000; private static final int REFRESH_AUDIENCE_INTERVAL_MS = 2000;
private long mLastEnterAudienceTimeMS = 0; private long mLastEnterAudienceTimeMS = 0;
private long mLastExitAudienceTimeMS = 0; private long mLastExitAudienceTimeMS = 0;
//观众列表 //观众列表
private LinkedHashMap<String/*userID*/, AudienceInfo> mAudiences = null; private LinkedHashMap<String/*userID*/, AudienceInfo> mAudiences = null;
private static final int LIVEROOM_CAMERA_PREVIEW = 0; private static final int LIVEROOM_CAMERA_PREVIEW = 0;
private static final int LIVEROOM_SCREEN_PREVIEW = 1; private static final int LIVEROOM_SCREEN_PREVIEW = 1;
private int mPreviewType = LIVEROOM_CAMERA_PREVIEW; private int mPreviewType = LIVEROOM_CAMERA_PREVIEW;
protected boolean mScreenAutoEnable = true; protected boolean mScreenAutoEnable = true;
private boolean mHasAddAnchor = false; private boolean mHasAddAnchor = false;
private static final int STREAM_MIX_MODE_JOIN_ANCHOR = 0; private static final int STREAM_MIX_MODE_JOIN_ANCHOR = 0;
private static final int STREAM_MIX_MODE_PK = 1; private static final int STREAM_MIX_MODE_PK = 1;
private int mMixMode = STREAM_MIX_MODE_JOIN_ANCHOR; private int mMixMode = STREAM_MIX_MODE_JOIN_ANCHOR;
private long mTimeDiff = 0; //客户端和服务器时间差,用户连麦和PK请求超时处理 private long mTimeDiff = 0; //客户端和服务器时间差,用户连麦和PK请求超时处理
private boolean isFrontCamera; private boolean isFrontCamera;
...@@ -141,7 +141,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -141,7 +141,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 设置回调接口 * 设置回调接口
* * <p>
* 您可以通过 IMLVBLiveRoomListener 获得 MLVBLiveRoom 的各种状态通知 * 您可以通过 IMLVBLiveRoomListener 获得 MLVBLiveRoom 的各种状态通知
* *
* @param listener 回调接口 * @param listener 回调接口
...@@ -278,7 +278,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -278,7 +278,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 获取房间列表 * 获取房间列表
* * <p>
* 该接口支持分页获取房间列表,可以用 index 和 count 两个参数控制列表分页的逻辑, * 该接口支持分页获取房间列表,可以用 index 和 count 两个参数控制列表分页的逻辑,
* - index = 0 & count = 10 代表获取第一页的10个房间。 * - index = 0 & count = 10 代表获取第一页的10个房间。
* - index = 11 & count = 10 代表获取第二页的10个房间。 * - index = 11 & count = 10 代表获取第二页的10个房间。
...@@ -298,9 +298,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -298,9 +298,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
mHttpRequest.getRoomList(index, count, new HttpRequests.OnResponseCallback<HttpResponse.RoomList>() { mHttpRequest.getRoomList(index, count, new HttpRequests.OnResponseCallback<HttpResponse.RoomList>() {
@Override @Override
public void onResponse(final int retcode, final String retmsg, HttpResponse.RoomList data) { public void onResponse(final int retcode, final String retmsg, HttpResponse.RoomList data) {
if (retcode != HttpResponse.CODE_OK || data == null || data.rooms == null){ if (retcode != HttpResponse.CODE_OK || data == null || data.rooms == null) {
callbackOnThread(callback, "onError", retcode, "[LiveRoom] getRoomList 失败[" + retmsg + "]"); callbackOnThread(callback, "onError", retcode, "[LiveRoom] getRoomList 失败[" + retmsg + "]");
}else { } else {
final ArrayList<RoomInfo> arrayList = new ArrayList<>(data.rooms.size()); final ArrayList<RoomInfo> arrayList = new ArrayList<>(data.rooms.size());
arrayList.addAll(data.rooms); arrayList.addAll(data.rooms);
mRoomList = arrayList; mRoomList = arrayList;
...@@ -312,7 +312,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -312,7 +312,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 获取观众列表 * 获取观众列表
* * <p>
* 当有观众进房时,后台会将其信息加入到指定房间的观众列表中,调入该函数即可返回指定房间的观众列表 * 当有观众进房时,后台会将其信息加入到指定房间的观众列表中,调入该函数即可返回指定房间的观众列表
* *
* @param callback 获取观众列表的结果回调。 * @param callback 获取观众列表的结果回调。
...@@ -320,7 +320,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -320,7 +320,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
*/ */
@Override @Override
public void getAudienceList(final IMLVBLiveRoomListener.GetAudienceListCallback callback) { public void getAudienceList(final IMLVBLiveRoomListener.GetAudienceListCallback callback) {
TXCLog.i(TAG, "API -> getAudienceList " +mCurrRoomID); TXCLog.i(TAG, "API -> getAudienceList " + mCurrRoomID);
if (mCurrRoomID == null || mCurrRoomID.length() == 0) { if (mCurrRoomID == null || mCurrRoomID.length() == 0) {
callbackOnThread(callback, "onError", MLVBCommonDef.LiveRoomErrorCode.ERROR_NOT_IN_ROOM, "[LiveRoom] getAudienceList 失败[房间号为空]"); callbackOnThread(callback, "onError", MLVBCommonDef.LiveRoomErrorCode.ERROR_NOT_IN_ROOM, "[LiveRoom] getAudienceList 失败[房间号为空]");
return; return;
...@@ -360,7 +360,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -360,7 +360,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 创建房间(主播调用) * 创建房间(主播调用)
* * <p>
* 主播开播的正常调用流程是: * 主播开播的正常调用流程是:
* 1.【主播】调用 startLocalPreview() 打开摄像头预览,此时可以调整美颜参数。 * 1.【主播】调用 startLocalPreview() 打开摄像头预览,此时可以调整美颜参数。
* 2.【主播】调用 createRoom 创建直播间,房间创建成功与否会通过 {@link IMLVBLiveRoomListener.CreateRoomCallback} 通知给主播。 * 2.【主播】调用 createRoom 创建直播间,房间创建成功与否会通过 {@link IMLVBLiveRoomListener.CreateRoomCallback} 通知给主播。
...@@ -383,12 +383,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -383,12 +383,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
public void onResponse(int retcode, String retmsg, HttpResponse.PushUrl data) { public void onResponse(int retcode, String retmsg, HttpResponse.PushUrl data) {
if (retcode == HttpResponse.CODE_OK && data != null && data.pushURL != null) { if (retcode == HttpResponse.CODE_OK && data != null && data.pushURL != null) {
// final String pushURL = data.pushURL; // final String pushURL = data.pushURL;
final String pushURL = TCGlobalConfig.pushURLPrefix +data.pushURL.substring(data.pushURL.indexOf("/live"),data.pushURL.length()); final String pushURL = TCGlobalConfig.pushURLPrefix + data.pushURL.substring(data.pushURL.indexOf("/live"), data.pushURL.length());
mSelfPushUrl = pushURL; mSelfPushUrl = pushURL;
mSelfAccelerateURL = data.accelerateURL; mSelfAccelerateURL = data.accelerateURL;
TXCLog.i(TAG, "API -> createRoom push url:" +pushURL); TXCLog.i(TAG, "API -> createRoom push url:" + pushURL);
TXCLog.i(TAG, "API -> createRoom push url2:" +data.pushURL); TXCLog.i(TAG, "API -> createRoom push url2:" + data.pushURL);
//3.开始推流 //3.开始推流
startPushStream(pushURL, TXLiveConstants.VIDEO_QUALITY_HIGH_DEFINITION, new StandardCallback() { startPushStream(pushURL, TXLiveConstants.VIDEO_QUALITY_HIGH_DEFINITION, new StandardCallback() {
...@@ -410,14 +410,14 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -410,14 +410,14 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
mTXLivePusher.setConfig(config); mTXLivePusher.setConfig(config);
} }
EventBus.getDefault().post(new StartPushEvent(true,mSelfPushUrl,roomInfo)); EventBus.getDefault().post(new StartPushEvent(true, mSelfPushUrl, roomInfo));
mBackground = false; mBackground = false;
//4.推流成功,请求CGI:create_room,获取roomID、roomSig //4.推流成功,请求CGI:create_room,获取roomID、roomSig
String mRoomInfo = roomInfo; String mRoomInfo = roomInfo;
if (!TextUtils.isEmpty(mRoomInfo)){ if (!TextUtils.isEmpty(mRoomInfo)) {
try { try {
JSONObject jsonRoomInfo = new JSONObject(mRoomInfo); JSONObject jsonRoomInfo = new JSONObject(mRoomInfo);
jsonRoomInfo.put("playurl",data.playUrl); jsonRoomInfo.put("playurl", data.playUrl);
mRoomInfo = jsonRoomInfo.toString(); mRoomInfo = jsonRoomInfo.toString();
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -472,8 +472,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -472,8 +472,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
}); });
} } else {
else {
callbackOnThread(callback, "onError", retcode, "[LiveRoom] 创建房间失败[获取推流地址失败]"); callbackOnThread(callback, "onError", retcode, "[LiveRoom] 创建房间失败[获取推流地址失败]");
} }
} }
...@@ -482,7 +481,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -482,7 +481,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 进入房间(观众调用) * 进入房间(观众调用)
* * <p>
* 观众观看直播的正常调用流程是: * 观众观看直播的正常调用流程是:
* 1.【观众】调用 getRoomList() 刷新最新的直播房间列表,并通过 {@link IMLVBLiveRoomListener.GetRoomListCallback} 回调拿到房间列表。 * 1.【观众】调用 getRoomList() 刷新最新的直播房间列表,并通过 {@link IMLVBLiveRoomListener.GetRoomListCallback} 回调拿到房间列表。
* 2.【观众】选择一个直播间以后,调用 enterRoom() 进入该房间。 * 2.【观众】选择一个直播间以后,调用 enterRoom() 进入该房间。
...@@ -523,7 +522,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -523,7 +522,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
int playType = getPlayType(mixedPlayUrl); int playType = getPlayType(mixedPlayUrl);
mTXLivePlayer.setPlayerView(view); mTXLivePlayer.setPlayerView(view);
mTXLivePlayer.startPlay(mixedPlayUrl, playType); mTXLivePlayer.startPlay(mixedPlayUrl, playType);
TXCLog.i(TAG, "startPlay "+mixedPlayUrl+" "+playType); TXCLog.i(TAG, "startPlay " + mixedPlayUrl + " " + playType);
if (mHttpRequest != null) { if (mHttpRequest != null) {
String userInfo = ""; String userInfo = "";
...@@ -538,7 +537,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -538,7 +537,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
mHttpRequest.addAudience(roomID, mSelfAccountInfo.userID, userInfo, new HttpRequests.OnResponseCallback<HttpResponse>() { mHttpRequest.addAudience(roomID, mSelfAccountInfo.userID, userInfo, new HttpRequests.OnResponseCallback<HttpResponse>() {
@Override @Override
public void onResponse(int retcode, @Nullable String retmsg, @Nullable HttpResponse data) { public void onResponse(int retcode, @Nullable String retmsg, @Nullable HttpResponse data) {
TXCLog.i(TAG, "addAudience "+roomID+" "+retcode+" "+retmsg); TXCLog.i(TAG, "addAudience " + roomID + " " + retcode + " " + retmsg);
} }
}); });
} }
...@@ -659,7 +658,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -659,7 +658,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
mJoinPusher = false; mJoinPusher = false;
mSelfRoleType = LIVEROOM_ROLE_NONE; mSelfRoleType = LIVEROOM_ROLE_NONE;
mCurrRoomID = ""; mCurrRoomID = "";
mPushers.clear(); mPushers.clear();
mStreamMixturer.resetMergeState(); mStreamMixturer.resetMergeState();
...@@ -669,16 +668,15 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -669,16 +668,15 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 设置自定义信息 * 设置自定义信息
* * <p>
* 有时候您可能需要为房间产生一些额外的信息,此接口可以将这些信息缓存到服务器。 * 有时候您可能需要为房间产生一些额外的信息,此接口可以将这些信息缓存到服务器。
* *
* @param op 执行动作,定义请查看 {@link MLVBCommonDef.CustomFieldOp} * @param op 执行动作,定义请查看 {@link MLVBCommonDef.CustomFieldOp}
* @param key 自定义键 * @param key 自定义键
* @param value 数值 * @param value 数值
*
* @note op 为 {@link MLVBCommonDef.CustomFieldOp#SET} 时,value 可以是 String 或者 Integer 类型 * @note op 为 {@link MLVBCommonDef.CustomFieldOp#SET} 时,value 可以是 String 或者 Integer 类型
* op 为 {@link MLVBCommonDef.CustomFieldOp#INC} 时,value 是 Integer 类型 * op 为 {@link MLVBCommonDef.CustomFieldOp#INC} 时,value 是 Integer 类型
* op 为 {@link MLVBCommonDef.CustomFieldOp#DEC} 时,value 是 Integer 类型 * op 为 {@link MLVBCommonDef.CustomFieldOp#DEC} 时,value 是 Integer 类型
*/ */
public void setCustomInfo(final MLVBCommonDef.CustomFieldOp op, final String key, final Object value, final IMLVBLiveRoomListener.SetCustomInfoCallback callback) { public void setCustomInfo(final MLVBCommonDef.CustomFieldOp op, final String key, final Object value, final IMLVBLiveRoomListener.SetCustomInfoCallback callback) {
TXCLog.i(TAG, "API -> setCustomInfo:" + op + ":" + key); TXCLog.i(TAG, "API -> setCustomInfo:" + op + ":" + key);
...@@ -734,7 +732,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -734,7 +732,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 观众请求连麦 * 观众请求连麦
* * <p>
* 主播和观众的连麦流程可以简单描述为如下几个步骤: * 主播和观众的连麦流程可以简单描述为如下几个步骤:
* 1. 【观众】调用 requestJoinAnchor() 向主播发起连麦请求。 * 1. 【观众】调用 requestJoinAnchor() 向主播发起连麦请求。
* 2. 【主播】会收到 {@link IMLVBLiveRoomListener#onRequestJoinAnchor(AnchorInfo, String)} 的回调通知。 * 2. 【主播】会收到 {@link IMLVBLiveRoomListener#onRequestJoinAnchor(AnchorInfo, String)} 的回调通知。
...@@ -789,7 +787,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -789,7 +787,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
//10秒收不到主播同意/拒绝连麦的响应,则回调超时 //10秒收不到主播同意/拒绝连麦的响应,则回调超时
mListenerHandler.postDelayed(mJoinAnchorTimeoutTask, 10 * 1000); mListenerHandler.postDelayed(mJoinAnchorTimeoutTask, 10 * 1000);
String content = new Gson().toJson(request, new TypeToken<CommonJson<JoinAnchorRequest>>(){}.getType()); String content = new Gson().toJson(request, new TypeToken<CommonJson<JoinAnchorRequest>>() {
}.getType());
String toUserID = getRoomCreator(mCurrRoomID); String toUserID = getRoomCreator(mCurrRoomID);
IMMessageMgr imMessageMgr = mIMMessageMgr; IMMessageMgr imMessageMgr = mIMMessageMgr;
if (imMessageMgr != null) { if (imMessageMgr != null) {
...@@ -814,21 +813,19 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -814,21 +813,19 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
}); });
} }
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* 主播处理连麦请求 * 主播处理连麦请求
* * <p>
* 主播在收到 {@link IMLVBLiveRoomListener#onRequestJoinAnchor(AnchorInfo, String)} 回调之后会需要调用此接口来处理观众的连麦请求。 * 主播在收到 {@link IMLVBLiveRoomListener#onRequestJoinAnchor(AnchorInfo, String)} 回调之后会需要调用此接口来处理观众的连麦请求。
* *
* @param userID 观众ID * @param userID 观众ID
* @param agree true:同意;false:拒绝 * @param agree true:同意;false:拒绝
* @param reason 同意/拒绝连麦的原因描述 * @param reason 同意/拒绝连麦的原因描述
*
* @return 0:响应成功;非0:响应失败 * @return 0:响应成功;非0:响应失败
*/ */
@Override @Override
...@@ -846,11 +843,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -846,11 +843,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
response.cmd = "linkmic"; response.cmd = "linkmic";
response.data = new JoinAnchorResponse(); response.data = new JoinAnchorResponse();
response.data.type = "response"; response.data.type = "response";
response.data.result = agree?"accept":"reject"; response.data.result = agree ? "accept" : "reject";
response.data.reason = reason; response.data.reason = reason;
response.data.roomID = mCurrRoomID; response.data.roomID = mCurrRoomID;
response.data.timestamp = System.currentTimeMillis() - mTimeDiff; response.data.timestamp = System.currentTimeMillis() - mTimeDiff;
String content = new Gson().toJson(response, new TypeToken<CommonJson<JoinAnchorResponse>>(){}.getType()); String content = new Gson().toJson(response, new TypeToken<CommonJson<JoinAnchorResponse>>() {
}.getType());
IMMessageMgr imMessageMgr = mIMMessageMgr; IMMessageMgr imMessageMgr = mIMMessageMgr;
if (imMessageMgr != null) { if (imMessageMgr != null) {
imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() { imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() {
...@@ -865,8 +863,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -865,8 +863,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
}); });
} }
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return 0; return 0;
...@@ -874,13 +871,13 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -874,13 +871,13 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 观众进入连麦状态 * 观众进入连麦状态
* * <p>
* 进入连麦成功后,主播和其他连麦观众会收到 {@link IMLVBLiveRoomListener#onAnchorEnter(AnchorInfo)} 通知 * 进入连麦成功后,主播和其他连麦观众会收到 {@link IMLVBLiveRoomListener#onAnchorEnter(AnchorInfo)} 通知
* *
* @param callback 进入连麦的结果回调 * @param callback 进入连麦的结果回调
*/ */
@Override @Override
public void joinAnchor(String roomInfo,final IMLVBLiveRoomListener.JoinAnchorCallback callback) { public void joinAnchor(String roomInfo, final IMLVBLiveRoomListener.JoinAnchorCallback callback) {
TXCLog.i(TAG, "API -> joinAnchor"); TXCLog.i(TAG, "API -> joinAnchor");
if (mCurrRoomID == null || mCurrRoomID.length() == 0) { if (mCurrRoomID == null || mCurrRoomID.length() == 0) {
callbackOnThread(callback, "onError", MLVBCommonDef.LiveRoomErrorCode.ERROR_NOT_IN_ROOM, "[LiveRoom] 观众进入连麦失败[房间号为空,请确认是否已经进房]"); callbackOnThread(callback, "onError", MLVBCommonDef.LiveRoomErrorCode.ERROR_NOT_IN_ROOM, "[LiveRoom] 观众进入连麦失败[房间号为空,请确认是否已经进房]");
...@@ -914,12 +911,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -914,12 +911,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
// mSelfPushUrl = data.pushURL; // mSelfPushUrl = data.pushURL;
// mSelfAccelerateURL = data.accelerateURL; // mSelfAccelerateURL = data.accelerateURL;
final String pushURL = TCGlobalConfig.pushURLPrefix+data.pushURL.substring(data.pushURL.indexOf("/live"),data.pushURL.length()); final String pushURL = TCGlobalConfig.pushURLPrefix + data.pushURL.substring(data.pushURL.indexOf("/live"), data.pushURL.length());
mSelfPushUrl = pushURL; mSelfPushUrl = pushURL;
mSelfAccelerateURL = data.accelerateURL; mSelfAccelerateURL = data.accelerateURL;
TXCLog.i(TAG, "API -> createRoom push join url:" +pushURL); TXCLog.i(TAG, "API -> createRoom push join url:" + pushURL);
TXCLog.i(TAG, "API -> createRoom push join url2:" +data.pushURL+" "+roomInfo); TXCLog.i(TAG, "API -> createRoom push join url2:" + data.pushURL + " " + roomInfo);
//5. 开始推流 //5. 开始推流
startPushStream(pushURL, TXLiveConstants.VIDEO_QUALITY_LINKMIC_SUB_PUBLISHER, new StandardCallback() { startPushStream(pushURL, TXLiveConstants.VIDEO_QUALITY_LINKMIC_SUB_PUBLISHER, new StandardCallback() {
...@@ -931,7 +928,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -931,7 +928,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
@Override @Override
public void onSuccess() { public void onSuccess() {
mBackground = false; mBackground = false;
EventBus.getDefault().post(new StartPushEvent(false,mSelfPushUrl,roomInfo)); EventBus.getDefault().post(new StartPushEvent(false, mSelfPushUrl, roomInfo));
//6. 推流成功,请求CGI:add_pusher,把自己加入房间成员列表 //6. 推流成功,请求CGI:add_pusher,把自己加入房间成员列表
addAnchor(mCurrRoomID, data.pushURL, new StandardCallback() { addAnchor(mCurrRoomID, data.pushURL, new StandardCallback() {
@Override @Override
...@@ -960,7 +957,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -960,7 +957,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 观众退出连麦 * 观众退出连麦
* * <p>
* 退出连麦成功后,主播和其他连麦观众会收到 {@link IMLVBLiveRoomListener#onAnchorExit(AnchorInfo)} 通知 * 退出连麦成功后,主播和其他连麦观众会收到 {@link IMLVBLiveRoomListener#onAnchorExit(AnchorInfo)} 通知
* *
* @param callback 退出连麦的结果回调 * @param callback 退出连麦的结果回调
...@@ -1027,7 +1024,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1027,7 +1024,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 主播踢除连麦观众 * 主播踢除连麦观众
* * <p>
* 主播调用此接口踢除连麦观众后,被踢连麦观众会收到 {@link IMLVBLiveRoomListener#onKickoutJoinAnchor()} 回调通知 * 主播调用此接口踢除连麦观众后,被踢连麦观众会收到 {@link IMLVBLiveRoomListener#onKickoutJoinAnchor()} 回调通知
* *
* @param userID 连麦观众ID * @param userID 连麦观众ID
...@@ -1043,30 +1040,30 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1043,30 +1040,30 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
response.data.type = "kickout"; response.data.type = "kickout";
response.data.roomID = mCurrRoomID; response.data.roomID = mCurrRoomID;
response.data.timestamp = System.currentTimeMillis() - mTimeDiff; response.data.timestamp = System.currentTimeMillis() - mTimeDiff;
String content = new Gson().toJson(response, new TypeToken<CommonJson<KickoutResponse>>(){}.getType()); String content = new Gson().toJson(response, new TypeToken<CommonJson<KickoutResponse>>() {
}.getType());
IMMessageMgr imMessageMgr = mIMMessageMgr; IMMessageMgr imMessageMgr = mIMMessageMgr;
if (imMessageMgr != null) { if (imMessageMgr != null) {
imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() { imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() {
@Override @Override
public void onError(final int code, final String errInfo) { public void onError(final int code, final String errInfo) {
} }
@Override @Override
public void onSuccess(Object... args) { public void onSuccess(Object... args) {
} }
}); });
} }
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* 请求跨房PK * 请求跨房PK
* * <p>
* 主播和主播之间可以跨房间 PK,两个正在直播中的主播 A 和 B,他们之间的跨房 PK 流程如下: * 主播和主播之间可以跨房间 PK,两个正在直播中的主播 A 和 B,他们之间的跨房 PK 流程如下:
* 1. 【主播 A】调用 requestRoomPK() 向主播 B 发起连麦请求。 * 1. 【主播 A】调用 requestRoomPK() 向主播 B 发起连麦请求。
* 2. 【主播 B】会收到 {@link IMLVBLiveRoomListener#onRequestRoomPK(AnchorInfo)} 回调通知。 * 2. 【主播 B】会收到 {@link IMLVBLiveRoomListener#onRequestRoomPK(AnchorInfo)} 回调通知。
...@@ -1120,7 +1117,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1120,7 +1117,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
mPKAnchorInfo = new AnchorInfo(userID, "", "", ""); mPKAnchorInfo = new AnchorInfo(userID, "", "", "");
String content = new Gson().toJson(request, new TypeToken<CommonJson<PKRequest>>(){}.getType()); String content = new Gson().toJson(request, new TypeToken<CommonJson<PKRequest>>() {
}.getType());
IMMessageMgr imMessageMgr = mIMMessageMgr; IMMessageMgr imMessageMgr = mIMMessageMgr;
if (imMessageMgr != null) { if (imMessageMgr != null) {
imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() { imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() {
...@@ -1135,21 +1133,19 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1135,21 +1133,19 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
}); });
} }
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* 响应跨房 PK 请求 * 响应跨房 PK 请求
* * <p>
* 主播响应其他房间主播的 PK 请求,发起 PK 请求的主播会收到 {@link IMLVBLiveRoomListener.RequestRoomPKCallback} 回调通知。 * 主播响应其他房间主播的 PK 请求,发起 PK 请求的主播会收到 {@link IMLVBLiveRoomListener.RequestRoomPKCallback} 回调通知。
* *
* @param userID 发起 PK 请求的主播 ID * @param userID 发起 PK 请求的主播 ID
* @param agree true:同意;false:拒绝 * @param agree true:同意;false:拒绝
* @param reason 同意/拒绝PK的原因描述 * @param reason 同意/拒绝PK的原因描述
*
* @return 0:响应成功;非0:响应失败 * @return 0:响应成功;非0:响应失败
*/ */
@Override @Override
...@@ -1167,29 +1163,29 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1167,29 +1163,29 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
response.cmd = "pk"; response.cmd = "pk";
response.data = new PKResponse(); response.data = new PKResponse();
response.data.type = "response"; response.data.type = "response";
response.data.result = agree?"accept":"reject"; response.data.result = agree ? "accept" : "reject";
response.data.reason= reason; response.data.reason = reason;
response.data.roomID = mCurrRoomID; response.data.roomID = mCurrRoomID;
response.data.accelerateURL = mSelfAccelerateURL; response.data.accelerateURL = mSelfAccelerateURL;
response.data.timestamp = System.currentTimeMillis() - mTimeDiff; response.data.timestamp = System.currentTimeMillis() - mTimeDiff;
String content = new Gson().toJson(response, new TypeToken<CommonJson<PKResponse>>(){}.getType()); String content = new Gson().toJson(response, new TypeToken<CommonJson<PKResponse>>() {
}.getType());
IMMessageMgr imMessageMgr = mIMMessageMgr; IMMessageMgr imMessageMgr = mIMMessageMgr;
if (imMessageMgr != null) { if (imMessageMgr != null) {
imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() { imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() {
@Override @Override
public void onError(final int code, final String errInfo) { public void onError(final int code, final String errInfo) {
} }
@Override @Override
public void onSuccess(Object... args) { public void onSuccess(Object... args) {
} }
}); });
} }
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return 0; return 0;
...@@ -1197,7 +1193,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1197,7 +1193,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 退出跨房 PK * 退出跨房 PK
* * <p>
* 当两个主播中的任何一个退出跨房 PK 状态后,另一个主播会收到 {@link IMLVBLiveRoomListener#onQuitRoomPK(AnchorInfo)} 回调通知。 * 当两个主播中的任何一个退出跨房 PK 状态后,另一个主播会收到 {@link IMLVBLiveRoomListener#onQuitRoomPK(AnchorInfo)} 回调通知。
* *
* @param callback 退出跨房 PK 的结果回调 * @param callback 退出跨房 PK 的结果回调
...@@ -1219,26 +1215,26 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1219,26 +1215,26 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
request.data.accelerateURL = ""; request.data.accelerateURL = "";
request.data.timestamp = System.currentTimeMillis() - mTimeDiff; request.data.timestamp = System.currentTimeMillis() - mTimeDiff;
String content = new Gson().toJson(request, new TypeToken<CommonJson<PKRequest>>() {}.getType()); String content = new Gson().toJson(request, new TypeToken<CommonJson<PKRequest>>() {
}.getType());
IMMessageMgr imMessageMgr = mIMMessageMgr; IMMessageMgr imMessageMgr = mIMMessageMgr;
if (imMessageMgr != null) { if (imMessageMgr != null) {
imMessageMgr.sendC2CCustomMessage(mPKAnchorInfo.userID, content, new IMMessageMgr.Callback() { imMessageMgr.sendC2CCustomMessage(mPKAnchorInfo.userID, content, new IMMessageMgr.Callback() {
@Override @Override
public void onError(final int code, final String errInfo) { public void onError(final int code, final String errInfo) {
callbackOnThread(callback, "onError", code, "[IM] 退出PK失败[" + errInfo + ":" + code + "]"); callbackOnThread(callback, "onError", code, "[IM] 退出PK失败[" + errInfo + ":" + code + "]");
} }
@Override @Override
public void onSuccess(Object... args) { public void onSuccess(Object... args) {
callbackOnThread(callback, "onSuccess"); callbackOnThread(callback, "onSuccess");
} }
}); });
} }
} else { } else {
TXCLog.e(TAG, "获取不到 PK 主播信息,请确认是否已经跨房 PK"); TXCLog.e(TAG, "获取不到 PK 主播信息,请确认是否已经跨房 PK");
} }
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -1282,7 +1278,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1282,7 +1278,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
* @param anchorInfo 对方的用户信息 * @param anchorInfo 对方的用户信息
* @param view 承载视频画面的控件 * @param view 承载视频画面的控件
* @param callback 播放器监听器 * @param callback 播放器监听器
*
* @note 在 onUserVideoAvailable 回调时,调用这个接口 * @note 在 onUserVideoAvailable 回调时,调用这个接口
*/ */
@Override @Override
...@@ -1312,7 +1307,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1312,7 +1307,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
mTXLivePusher.setVideoQuality(TXLiveConstants.VIDEO_QUALITY_LINKMIC_MAIN_PUBLISHER, true, true); mTXLivePusher.setVideoQuality(TXLiveConstants.VIDEO_QUALITY_LINKMIC_MAIN_PUBLISHER, true, true);
TXLivePushConfig config = mTXLivePusher.getConfig(); TXLivePushConfig config = mTXLivePusher.getConfig();
// config.setVideoResolution(TXLiveConstants.VIDEO_RESOLUTION_TYPE_360_640); // config.setVideoResolution(TXLiveConstants.VIDEO_RESOLUTION_TYPE_360_640);
config.setVideoResolution(TXLiveConstants.VIDEO_RESOLUTION_TYPE_640_360); config.setVideoResolution(TXLiveConstants.VIDEO_RESOLUTION_TYPE_640_360); //横屏分辨率
config.setAutoAdjustBitrate(false); config.setAutoAdjustBitrate(false);
config.setVideoBitrate(800); config.setVideoBitrate(800);
mTXLivePusher.setConfig(config); mTXLivePusher.setConfig(config);
...@@ -1347,8 +1342,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1347,8 +1342,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
} }
callbackOnThread(callback, "onBegin"); callbackOnThread(callback, "onBegin");
} } else if (event == TXLiveConstants.PLAY_EVT_PLAY_END || event == TXLiveConstants.PLAY_ERR_NET_DISCONNECT) {
else if (event == TXLiveConstants.PLAY_EVT_PLAY_END || event == TXLiveConstants.PLAY_ERR_NET_DISCONNECT){
callbackOnThread(callback, "onError", event, "[LivePlayer] 播放异常[" + param.getString(TXLiveConstants.EVT_DESCRIPTION) + "]"); callbackOnThread(callback, "onError", event, "[LivePlayer] 播放异常[" + param.getString(TXLiveConstants.EVT_DESCRIPTION) + "]");
//结束播放 //结束播放
...@@ -1358,8 +1352,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1358,8 +1352,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
// item.destroy(); // item.destroy();
// } // }
// } // }
} } else {
else {
callbackOnThread(callback, "onEvent", event, param); callbackOnThread(callback, "onEvent", event, param);
} }
} }
...@@ -1371,7 +1364,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1371,7 +1364,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
}); });
int result = player.startPlay(anchorInfo.accelerateURL, TXLivePlayer.PLAY_TYPE_LIVE_RTMP_ACC); int result = player.startPlay(anchorInfo.accelerateURL, TXLivePlayer.PLAY_TYPE_LIVE_RTMP_ACC);
if (result != 0){ if (result != 0) {
TXCLog.e(TAG, String.format("[BaseRoom] 播放成员 {%s} 地址 {%s} 失败", anchorInfo.userID, anchorInfo.accelerateURL)); TXCLog.e(TAG, String.format("[BaseRoom] 播放成员 {%s} 地址 {%s} 失败", anchorInfo.userID, anchorInfo.accelerateURL));
} }
} }
...@@ -1393,7 +1386,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1393,7 +1386,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
handler.post(new Runnable() { handler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
if (mPlayers.containsKey(anchorInfo.userID)){ if (mPlayers.containsKey(anchorInfo.userID)) {
PlayerItem pusherPlayer = mPlayers.remove(anchorInfo.userID); PlayerItem pusherPlayer = mPlayers.remove(anchorInfo.userID);
pusherPlayer.destroy(); pusherPlayer.destroy();
} }
...@@ -1425,7 +1418,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1425,7 +1418,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 启动录屏。 * 启动录屏。
*
*/ */
public synchronized void startScreenCapture() { public synchronized void startScreenCapture() {
TXCLog.i(TAG, "API -> startScreenCapture"); TXCLog.i(TAG, "API -> startScreenCapture");
...@@ -1438,7 +1430,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1438,7 +1430,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 结束录屏。 * 结束录屏。
*
*/ */
public synchronized void stopScreenCapture() { public synchronized void stopScreenCapture() {
TXCLog.i(TAG, "API -> stopScreenCapture"); TXCLog.i(TAG, "API -> stopScreenCapture");
...@@ -1478,7 +1469,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1478,7 +1469,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
*/ */
@Override @Override
public void muteRemoteAudio(String userID, boolean mute) { public void muteRemoteAudio(String userID, boolean mute) {
if (mPlayers.containsKey(userID)){ if (mPlayers.containsKey(userID)) {
PlayerItem pusherPlayer = mPlayers.get(userID); PlayerItem pusherPlayer = mPlayers.get(userID);
pusherPlayer.player.setMute(mute); pusherPlayer.player.setMute(mute);
} else if (userID == getRoomCreator(mCurrRoomID)) { } else if (userID == getRoomCreator(mCurrRoomID)) {
...@@ -1508,7 +1499,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1508,7 +1499,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
@Override @Override
public void switchCamera() { public void switchCamera() {
if (mTXLivePusher != null) { if (mTXLivePusher != null) {
isFrontCamera = ! isFrontCamera; isFrontCamera = !isFrontCamera;
mTXLivePusher.setMirror(isFrontCamera); mTXLivePusher.setMirror(isFrontCamera);
mTXLivePusher.switchCamera(); mTXLivePusher.switchCamera();
} }
...@@ -1518,7 +1509,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1518,7 +1509,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
* 设置摄像头缩放因子(焦距) * 设置摄像头缩放因子(焦距)
* *
* @param distance 取值范围 1 - 5 ,当为1的时候为最远视角(正常镜头),当为5的时候为最近视角(放大镜头),这里最大值推荐为5,超过5后视频数据会变得模糊不清 * @param distance 取值范围 1 - 5 ,当为1的时候为最远视角(正常镜头),当为5的时候为最近视角(放大镜头),这里最大值推荐为5,超过5后视频数据会变得模糊不清
*
* @return false:调用失败;true:调用成功 * @return false:调用失败;true:调用成功
*/ */
@Override @Override
...@@ -1533,7 +1523,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1533,7 +1523,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
* 开关闪光灯 * 开关闪光灯
* *
* @param enable true:开启;false:关闭 * @param enable true:开启;false:关闭
*
* @return false:调用失败;true:调用成功 * @return false:调用失败;true:调用成功
*/ */
@Override @Override
...@@ -1546,7 +1535,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1546,7 +1535,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 主播屏蔽摄像头期间需要显示的等待图片 * 主播屏蔽摄像头期间需要显示的等待图片
* * <p>
* 当主播屏蔽摄像头,或者由于 App 切入后台无法使用摄像头的时候,我们需要使用一张等待图片来提示观众“主播暂时离开,请不要走开”。 * 当主播屏蔽摄像头,或者由于 App 切入后台无法使用摄像头的时候,我们需要使用一张等待图片来提示观众“主播暂时离开,请不要走开”。
* *
* @param bitmap 位图 * @param bitmap 位图
...@@ -1563,7 +1552,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1563,7 +1552,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 主播屏蔽摄像头期间需要显示的等待图片 * 主播屏蔽摄像头期间需要显示的等待图片
* * <p>
* 当主播屏蔽摄像头,或者由于 App 切入后台无法使用摄像头的时候,我们需要使用一张等待图片来提示观众“主播暂时离开,请不要走开”。 * 当主播屏蔽摄像头,或者由于 App 切入后台无法使用摄像头的时候,我们需要使用一张等待图片来提示观众“主播暂时离开,请不要走开”。
* *
* @param id 设置默认显示图片的资源文件 * @param id 设置默认显示图片的资源文件
...@@ -1630,10 +1619,10 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1630,10 +1619,10 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 添加水印,height 不用设置,sdk 内部会根据水印宽高比自动计算 height * 添加水印,height 不用设置,sdk 内部会根据水印宽高比自动计算 height
* *
* @param image 水印图片 null 表示清除水印 * @param image 水印图片 null 表示清除水印
* @param x 归一化水印位置的 X 轴坐标,取值[0,1] * @param x 归一化水印位置的 X 轴坐标,取值[0,1]
* @param y 归一化水印位置的 Y 轴坐标,取值[0,1] * @param y 归一化水印位置的 Y 轴坐标,取值[0,1]
* @param width 归一化水印宽度,取值[0,1] * @param width 归一化水印宽度,取值[0,1]
*/ */
@Override @Override
public void setWatermark(Bitmap image, float x, float y, float width) { public void setWatermark(Bitmap image, float x, float y, float width) {
...@@ -1658,13 +1647,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1658,13 +1647,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 设置绿幕文件 * 设置绿幕文件
* * <p>
* 目前图片支持jpg/png,视频支持mp4/3gp等Android系统支持的格式 * 目前图片支持jpg/png,视频支持mp4/3gp等Android系统支持的格式
* *
* @param file 绿幕文件位置,支持两种方式: * @param file 绿幕文件位置,支持两种方式:
* 1.资源文件放在assets目录,path直接取文件名 * 1.资源文件放在assets目录,path直接取文件名
* 2.path取文件绝对路径 * 2.path取文件绝对路径
*
* @return false:调用失败;true:调用成功 * @return false:调用失败;true:调用成功
* @note API要求18 * @note API要求18
*/ */
...@@ -1763,7 +1751,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1763,7 +1751,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 发送文本消息 * 发送文本消息
* *
* @param message 文本消息 * @param message 文本消息
* @param callback 发送消息的结果回调 * @param callback 发送消息的结果回调
* @see {@link IMLVBLiveRoomListener#onRecvRoomTextMsg(String, String, String, String, String)} * @see {@link IMLVBLiveRoomListener#onRecvRoomTextMsg(String, String, String, String, String)}
*/ */
...@@ -1790,8 +1778,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1790,8 +1778,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 发送自定义文本消息 * 发送自定义文本消息
* *
* @param cmd 命令字,由开发者自定义,主要用于区分不同消息类型 * @param cmd 命令字,由开发者自定义,主要用于区分不同消息类型
* @param message 文本消息 * @param message 文本消息
* @param callback 发送消息的结果回调 * @param callback 发送消息的结果回调
* @see {@link IMLVBLiveRoomListener#onRecvRoomCustomMsg(String, String, String, String, String, String)} * @see {@link IMLVBLiveRoomListener#onRecvRoomCustomMsg(String, String, String, String, String, String)}
*/ */
...@@ -1803,8 +1791,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1803,8 +1791,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
customMessage.data.userName = mSelfAccountInfo.userName; customMessage.data.userName = mSelfAccountInfo.userName;
customMessage.data.userAvatar = mSelfAccountInfo.userAvatar; customMessage.data.userAvatar = mSelfAccountInfo.userAvatar;
customMessage.data.cmd = cmd; customMessage.data.cmd = cmd;
customMessage.data.msg = message ; customMessage.data.msg = message;
final String content = new Gson().toJson(customMessage, new TypeToken<CommonJson<CustomMessage>>(){}.getType()); final String content = new Gson().toJson(customMessage, new TypeToken<CommonJson<CustomMessage>>() {
}.getType());
IMMessageMgr imMessageMgr = mIMMessageMgr; IMMessageMgr imMessageMgr = mIMMessageMgr;
if (imMessageMgr != null) { if (imMessageMgr != null) {
imMessageMgr.sendGroupCustomMessage(content, new IMMessageMgr.Callback() { imMessageMgr.sendGroupCustomMessage(content, new IMMessageMgr.Callback() {
...@@ -1889,7 +1878,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1889,7 +1878,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
@Override @Override
public void setMicVolumeOnMixing(int volume) { public void setMicVolumeOnMixing(int volume) {
if (mTXLivePusher != null) { if (mTXLivePusher != null) {
mTXLivePusher.setMicVolume(volume/100.0f); mTXLivePusher.setMicVolume(volume / 100.0f);
} }
} }
...@@ -1901,7 +1890,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1901,7 +1890,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
@Override @Override
public void setBGMVolume(int volume) { public void setBGMVolume(int volume) {
if (mTXLivePusher != null) { if (mTXLivePusher != null) {
mTXLivePusher.setBGMVolume(volume/100.0f); mTXLivePusher.setBGMVolume(volume / 100.0f);
} }
} }
...@@ -1909,13 +1898,13 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1909,13 +1898,13 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
* 设置混响效果 * 设置混响效果
* *
* @param reverbType 混响类型,详见 * @param reverbType 混响类型,详见
* {@link TXLiveConstants#REVERB_TYPE_0 } (关闭混响) * {@link TXLiveConstants#REVERB_TYPE_0 } (关闭混响)
* {@link TXLiveConstants#REVERB_TYPE_1 } (KTV) * {@link TXLiveConstants#REVERB_TYPE_1 } (KTV)
* {@link TXLiveConstants#REVERB_TYPE_2 } (小房间) * {@link TXLiveConstants#REVERB_TYPE_2 } (小房间)
* {@link TXLiveConstants#REVERB_TYPE_3 } (大会堂) * {@link TXLiveConstants#REVERB_TYPE_3 } (大会堂)
* {@link TXLiveConstants#REVERB_TYPE_4 } (低沉) * {@link TXLiveConstants#REVERB_TYPE_4 } (低沉)
* {@link TXLiveConstants#REVERB_TYPE_5 } (洪亮) * {@link TXLiveConstants#REVERB_TYPE_5 } (洪亮)
* {@link TXLiveConstants#REVERB_TYPE_6 } (磁性) * {@link TXLiveConstants#REVERB_TYPE_6 } (磁性)
*/ */
@Override @Override
public void setReverbType(int reverbType) { public void setReverbType(int reverbType) {
...@@ -1938,7 +1927,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1938,7 +1927,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 设置背景音乐的音调。 * 设置背景音乐的音调。
* * <p>
* 该接口用于混音处理,比如将背景音乐与麦克风采集到的声音混合后播放。 * 该接口用于混音处理,比如将背景音乐与麦克风采集到的声音混合后播放。
* *
* @param pitch 音调,0为正常音量,范围是 -1 - 1。 * @param pitch 音调,0为正常音量,范围是 -1 - 1。
...@@ -1952,12 +1941,10 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1952,12 +1941,10 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
/** /**
* 指定背景音乐的播放位置 * 指定背景音乐的播放位置
* *
* @note 请尽量避免频繁地调用该接口,因为该接口可能会再次读写 BGM 文件,耗时稍高。
* 例如:当配合进度条使用时,请在进度条拖动完毕的回调中调用,而避免在拖动过程中实时调用。
*
* @param position 背景音乐的播放位置,单位ms。 * @param position 背景音乐的播放位置,单位ms。
*
* @return 结果是否成功,true:成功;false:失败。 * @return 结果是否成功,true:成功;false:失败。
* @note 请尽量避免频繁地调用该接口,因为该接口可能会再次读写 BGM 文件,耗时稍高。
* 例如:当配合进度条使用时,请在进度条拖动完毕的回调中调用,而避免在拖动过程中实时调用。
*/ */
public boolean setBGMPosition(int position) { public boolean setBGMPosition(int position) {
if (mTXLivePusher != null) { if (mTXLivePusher != null) {
...@@ -1999,7 +1986,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -1999,7 +1986,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
if (ratio > 1.3f) { if (ratio > 1.3f) {
mTXLivePlayer.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN); mTXLivePlayer.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN);
} else { } else {
mTXLivePlayer.setRenderMode(TXLiveConstants.RENDER_MODE_ADJUST_RESOLUTION); //画面填充整个屏幕
mTXLivePlayer.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN);
// mTXLivePlayer.setRenderMode(TXLiveConstants.RENDER_MODE_ADJUST_RESOLUTION);
} }
} }
} }
...@@ -2017,8 +2006,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2017,8 +2006,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
protected void startPushStream(final String url, final int videoQuality, final StandardCallback callback) {
protected void startPushStream(final String url, final int videoQuality, final StandardCallback callback){
//在主线程开启推流 //在主线程开启推流
Handler handler = new Handler(mAppContext.getMainLooper()); Handler handler = new Handler(mAppContext.getMainLooper());
handler.post(new Runnable() { handler.post(new Runnable() {
...@@ -2031,18 +2019,20 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2031,18 +2019,20 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
if (ret == -5) { if (ret == -5) {
String msg = "[LiveRoom] 推流失败[license 校验失败]"; String msg = "[LiveRoom] 推流失败[license 校验失败]";
TXCLog.e(TAG, msg); TXCLog.e(TAG, msg);
if (callback != null) callback.onError(MLVBCommonDef.LiveRoomErrorCode.ERROR_LICENSE_INVALID, msg); if (callback != null)
callback.onError(MLVBCommonDef.LiveRoomErrorCode.ERROR_LICENSE_INVALID, msg);
} }
} else { } else {
String msg = "[LiveRoom] 推流失败[TXLivePusher未初始化,请确保已经调用startLocalPreview]"; String msg = "[LiveRoom] 推流失败[TXLivePusher未初始化,请确保已经调用startLocalPreview]";
TXCLog.e(TAG, msg); TXCLog.e(TAG, msg);
if (callback != null) callback.onError(MLVBCommonDef.LiveRoomErrorCode.ERROR_PUSH, msg); if (callback != null)
callback.onError(MLVBCommonDef.LiveRoomErrorCode.ERROR_PUSH, msg);
} }
} }
}); });
} }
protected void doCreateRoom(final String roomID, String roomInfo, final StandardCallback callback){ protected void doCreateRoom(final String roomID, String roomInfo, final StandardCallback callback) {
mHttpRequest.createRoom(roomID, mSelfAccountInfo.userID, roomInfo, mHttpRequest.createRoom(roomID, mSelfAccountInfo.userID, roomInfo,
new HttpRequests.OnResponseCallback<HttpResponse.CreateRoom>() { new HttpRequests.OnResponseCallback<HttpResponse.CreateRoom>() {
@Override @Override
...@@ -2100,7 +2090,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2100,7 +2090,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
} }
protected void jionIMGroup(final String roomID, final StandardCallback callback){ protected void jionIMGroup(final String roomID, final StandardCallback callback) {
IMMessageMgr imMessageMgr = mIMMessageMgr; IMMessageMgr imMessageMgr = mIMMessageMgr;
if (imMessageMgr != null) { if (imMessageMgr != null) {
imMessageMgr.jionGroup(roomID, new IMMessageMgr.Callback() { imMessageMgr.jionGroup(roomID, new IMMessageMgr.Callback() {
...@@ -2125,7 +2115,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2125,7 +2115,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
msg.cmd = "notifyPusherChange"; msg.cmd = "notifyPusherChange";
msg.data = new AnchorInfo(); msg.data = new AnchorInfo();
msg.data.userID = mSelfAccountInfo.userID; msg.data.userID = mSelfAccountInfo.userID;
String content = new Gson().toJson(msg, new TypeToken<CommonJson<AnchorInfo>>(){}.getType()); String content = new Gson().toJson(msg, new TypeToken<CommonJson<AnchorInfo>>() {
}.getType());
IMMessageMgr imMessageMgr = mIMMessageMgr; IMMessageMgr imMessageMgr = mIMMessageMgr;
if (imMessageMgr != null) { if (imMessageMgr != null) {
imMessageMgr.sendGroupCustomMessage(content, new IMMessageMgr.Callback() { imMessageMgr.sendGroupCustomMessage(content, new IMMessageMgr.Callback() {
...@@ -2151,7 +2142,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2151,7 +2142,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
} }
protected void updateAnchors(final boolean excludeRoomCreator, final UpdateAnchorsCallback callback){ protected void updateAnchors(final boolean excludeRoomCreator, final UpdateAnchorsCallback callback) {
mHttpRequest.getPushers(mCurrRoomID, new HttpRequests.OnResponseCallback<HttpResponse.PusherList>() { mHttpRequest.getPushers(mCurrRoomID, new HttpRequests.OnResponseCallback<HttpResponse.PusherList>() {
@Override @Override
public void onResponse(final int retcode, String retmsg, final HttpResponse.PusherList data) { public void onResponse(final int retcode, String retmsg, final HttpResponse.PusherList data) {
...@@ -2251,8 +2242,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2251,8 +2242,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
mPushers = mergedAnchors; mPushers = mergedAnchors;
} } else {
else {
TXCLog.e(TAG, "更新主播列表返回空数据"); TXCLog.e(TAG, "更新主播列表返回空数据");
if (callback != null) { if (callback != null) {
callback.onUpdateAnchors(-1, null, null, null, null); callback.onUpdateAnchors(-1, null, null, null, null);
...@@ -2260,7 +2250,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2260,7 +2250,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
} }
protected void mergerAnchors(List<AnchorInfo> anchors, List<AnchorInfo> addAnchors, List<AnchorInfo> delAnchors, HashMap<String, AnchorInfo> mergedAnchors){ protected void mergerAnchors(List<AnchorInfo> anchors, List<AnchorInfo> addAnchors, List<AnchorInfo> delAnchors, HashMap<String, AnchorInfo> mergedAnchors) {
if (anchors == null) { if (anchors == null) {
//主播列表为空,意味着所有主播都已经退房 //主播列表为空,意味着所有主播都已经退房
if (delAnchors != null) { if (delAnchors != null) {
...@@ -2274,7 +2264,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2274,7 +2264,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
for (AnchorInfo member : anchors) { for (AnchorInfo member : anchors) {
if (member.userID != null && (!member.userID.equals(mSelfAccountInfo.userID))){ if (member.userID != null && (!member.userID.equals(mSelfAccountInfo.userID))) {
if (!mPushers.containsKey(member.userID)) { if (!mPushers.containsKey(member.userID)) {
if (addAnchors != null) { if (addAnchors != null) {
addAnchors.add(member); addAnchors.add(member);
...@@ -2322,7 +2312,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2322,7 +2312,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
protected String getRoomCreator(String roomID) { protected String getRoomCreator(String roomID) {
for (RoomInfo item: mRoomList) { for (RoomInfo item : mRoomList) {
if (roomID.equalsIgnoreCase(item.roomID)) { if (roomID.equalsIgnoreCase(item.roomID)) {
return item.roomCreator; return item.roomCreator;
} }
...@@ -2459,8 +2449,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2459,8 +2449,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
return; return;
} }
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -2508,8 +2497,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2508,8 +2497,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
}); });
return; return;
} } else if (result.equalsIgnoreCase("reject")) {
else if (result.equalsIgnoreCase("reject")) {
callbackOnThread(new Runnable() { callbackOnThread(new Runnable() {
@Override @Override
public void run() { public void run() {
...@@ -2533,8 +2521,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2533,8 +2521,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
}); });
return; return;
} }
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -2569,6 +2556,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2569,6 +2556,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
// IMMessageMgr.IMMessageListener // IMMessageMgr.IMMessageListener
// //
////////////////////////////////////////// //////////////////////////////////////////
/** /**
* IM连接成功 * IM连接成功
*/ */
...@@ -2625,7 +2613,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2625,7 +2613,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
*/ */
@Override @Override
public void onGroupCustomMessage(final String groupID, final String senderID, String message) { public void onGroupCustomMessage(final String groupID, final String senderID, String message) {
final CustomMessage customMessage = new Gson().fromJson(message, CustomMessage.class); final CustomMessage customMessage = new Gson().fromJson(message, CustomMessage.class);
callbackOnThread(mListener, "onRecvRoomCustomMsg", groupID, senderID, customMessage.userName, customMessage.userAvatar, customMessage.cmd, customMessage.msg); callbackOnThread(mListener, "onRecvRoomCustomMsg", groupID, senderID, customMessage.userName, customMessage.userAvatar, customMessage.cmd, customMessage.msg);
} }
...@@ -2640,8 +2628,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2640,8 +2628,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
public void onC2CCustomMessage(String sendID, String cmd, String message) { public void onC2CCustomMessage(String sendID, String cmd, String message) {
if (cmd.equalsIgnoreCase("linkmic")) { if (cmd.equalsIgnoreCase("linkmic")) {
onRecvLinkMicMessage(message); onRecvLinkMicMessage(message);
} } else if (cmd.equalsIgnoreCase("pk")) {
else if (cmd.equalsIgnoreCase("pk")) {
onRecvPKMessage(message); onRecvPKMessage(message);
} }
} }
...@@ -2719,17 +2706,17 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2719,17 +2706,17 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
private class StreamMixturer { private class StreamMixturer {
private String mMainStreamId = ""; private String mMainStreamId = "";
private String mPKStreamId = ""; private String mPKStreamId = "";
private Vector<String> mSubStreamIds = new Vector<String>(); private Vector<String> mSubStreamIds = new Vector<String>();
private int mMainStreamWidth = 540; private int mMainStreamWidth = 960;
private int mMainStreamHeight = 960; private int mMainStreamHeight = 540;
public StreamMixturer() { public StreamMixturer() {
} }
public void setMainVideoStream(String streamUrl) { public void setMainVideoStream(String streamUrl) {
mMainStreamId = getStreamIDByStreamUrl(streamUrl); mMainStreamId = getStreamIDByStreamUrl(streamUrl);
Log.e(TAG, "MergeVideoStream: setMainVideoStream " + mMainStreamId); Log.e(TAG, "MergeVideoStream: setMainVideoStream " + mMainStreamId);
...@@ -2742,7 +2729,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2742,7 +2729,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
} }
public void addSubVideoStream(String streamUrl) { public void addSubVideoStream(String streamUrl) {
if (mSubStreamIds.size() > 3) { if (mSubStreamIds.size() > 3) {
return; return;
} }
...@@ -2755,7 +2742,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2755,7 +2742,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
return; return;
} }
for (String item: mSubStreamIds) { for (String item : mSubStreamIds) {
if (item.equalsIgnoreCase(streamId)) { if (item.equalsIgnoreCase(streamId)) {
return; return;
} }
...@@ -2765,13 +2752,13 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2765,13 +2752,13 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
sendStreamMergeRequest(5); sendStreamMergeRequest(5);
} }
public void delSubVideoStream(String streamUrl) { public void delSubVideoStream(String streamUrl) {
String streamId = getStreamIDByStreamUrl(streamUrl); String streamId = getStreamIDByStreamUrl(streamUrl);
Log.e(TAG, "MergeVideoStream: delSubVideoStream " + streamId); Log.e(TAG, "MergeVideoStream: delSubVideoStream " + streamId);
boolean bExist = false; boolean bExist = false;
for (String item: mSubStreamIds) { for (String item : mSubStreamIds) {
if (item.equalsIgnoreCase(streamId)) { if (item.equalsIgnoreCase(streamId)) {
bExist = true; bExist = true;
break; break;
...@@ -2822,9 +2809,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2822,9 +2809,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
mSubStreamIds.clear(); mSubStreamIds.clear();
mMainStreamId = null; mMainStreamId = null;
mPKStreamId = null; mPKStreamId = null;
mMainStreamWidth = 540; mMainStreamWidth = 960;
mMainStreamHeight = 960; mMainStreamHeight = 540;
} }
private void sendStreamMergeRequest(final int retryCount) { private void sendStreamMergeRequest(final int retryCount) {
...@@ -2847,8 +2834,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2847,8 +2834,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
if (runImmediately == false) { if (runImmediately == false) {
try { try {
sleep(2000, 0); sleep(2000, 0);
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -2867,8 +2853,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2867,8 +2853,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
if (result != null && result.code == 0 && result.merge_code == 0) { if (result != null && result.code == 0 && result.merge_code == 0) {
return; return;
} } else {
else {
int tempRetryIndex = retryIndex - 1; int tempRetryIndex = retryIndex - 1;
if (tempRetryIndex > 0) { if (tempRetryIndex > 0) {
internalSendRequest(tempRetryIndex, false, requestParam); internalSendRequest(tempRetryIndex, false, requestParam);
...@@ -2958,22 +2943,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2958,22 +2943,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
JSONObject layoutParam = new JSONObject(); JSONObject layoutParam = new JSONObject();
layoutParam.put("image_layer", 2); layoutParam.put("image_layer", 2);
if (mSubStreamIds.size()>0){ layoutParam.put("image_width", 960);
layoutParam.put("image_width", 960); layoutParam.put("image_height", 540);
layoutParam.put("image_height", 540);
// JSONObject cropParam = new JSONObject();
// cropParam.put("crop_width", 240);
// cropParam.put("crop_height", 270);
// cropParam.put("crop_x", 0);
// cropParam.put("crop_y", 0);
// mainStream.put("crop_params", cropParam);
}else {
layoutParam.put("image_width", 960);
layoutParam.put("image_height", 540);
}
layoutParam.put("location_x", 0); layoutParam.put("location_x", 0);
layoutParam.put("location_y", 0); layoutParam.put("location_y", 0);
...@@ -2992,8 +2963,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -2992,8 +2963,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
layoutParam.put("location_y", 0); layoutParam.put("location_y", 0);
JSONObject cropParam = new JSONObject(); JSONObject cropParam = new JSONObject();
cropParam.put("crop_width", 240); cropParam.put("crop_width", 280);
cropParam.put("crop_height", 270); cropParam.put("crop_height", 320);
cropParam.put("crop_x", 0); cropParam.put("crop_x", 0);
cropParam.put("crop_y", 0); cropParam.put("crop_y", 0);
...@@ -3023,8 +2994,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3023,8 +2994,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
requestParam.put("timestamp", System.currentTimeMillis() / 1000); requestParam.put("timestamp", System.currentTimeMillis() / 1000);
requestParam.put("eventId", System.currentTimeMillis() / 1000); requestParam.put("eventId", System.currentTimeMillis() / 1000);
requestParam.put("interface", interfaceObj); requestParam.put("interface", interfaceObj);
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -3043,7 +3013,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3043,7 +3013,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
// input_stream_list // input_stream_list
JSONArray inputStreamList = new JSONArray(); JSONArray inputStreamList = new JSONArray();
if (mPKStreamId != null && mPKStreamId.length() > 0){ if (mPKStreamId != null && mPKStreamId.length() > 0) {
// 画布 // 画布
{ {
JSONObject layoutParam = new JSONObject(); JSONObject layoutParam = new JSONObject();
...@@ -3090,8 +3060,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3090,8 +3060,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
inputStreamList.put(mainStream); inputStreamList.put(mainStream);
} }
} } else {
else {
JSONObject layoutParam = new JSONObject(); JSONObject layoutParam = new JSONObject();
layoutParam.put("image_layer", 1); layoutParam.put("image_layer", 1);
...@@ -3120,8 +3089,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3120,8 +3089,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
requestParam.put("timestamp", System.currentTimeMillis() / 1000); requestParam.put("timestamp", System.currentTimeMillis() / 1000);
requestParam.put("eventId", System.currentTimeMillis() / 1000); requestParam.put("eventId", System.currentTimeMillis() / 1000);
requestParam.put("interface", interfaceObj); requestParam.put("interface", interfaceObj);
} } catch (Exception e) {
catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -3201,11 +3169,11 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3201,11 +3169,11 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
}; };
public void startHeartbeat(){ public void startHeartbeat() {
synchronized (this) { synchronized (this) {
if (handler != null && handler.getLooper() != null) { if (handler != null && handler.getLooper() != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
handler.getLooper().quitSafely(); handler.getLooper().quitSafely();
} else { } else {
handler.getLooper().quit(); handler.getLooper().quit();
} }
...@@ -3217,7 +3185,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3217,7 +3185,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
} }
} }
public void stopHeartbeat(){ public void stopHeartbeat() {
synchronized (this) { synchronized (this) {
if (handler != null) { if (handler != null) {
handler.removeCallbacks(heartBeatRunnable); handler.removeCallbacks(heartBeatRunnable);
...@@ -3254,11 +3222,11 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3254,11 +3222,11 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
callbackOnThread(mCallback, "onError", event, msg); callbackOnThread(mCallback, "onError", event, msg);
} else if (event == TXLiveConstants.PUSH_ERR_NET_DISCONNECT || event == TXLiveConstants.PUSH_ERR_INVALID_ADDRESS) { } else if (event == TXLiveConstants.PUSH_ERR_NET_DISCONNECT || event == TXLiveConstants.PUSH_ERR_INVALID_ADDRESS) {
String msg = "[LivePusher] 推流失败[网络断开]"; String msg = "[LivePusher] 推流失败[网络断开]";
TXCLog.e(TAG,msg); TXCLog.e(TAG, msg);
callbackOnThread(mCallback, "onError", event, msg); callbackOnThread(mCallback, "onError", event, msg);
} else if (event == TXLiveConstants.PUSH_ERR_SCREEN_CAPTURE_START_FAILED) { } else if (event == TXLiveConstants.PUSH_ERR_SCREEN_CAPTURE_START_FAILED) {
String msg = "[LivePusher] 推流失败[录屏启动失败]"; String msg = "[LivePusher] 推流失败[录屏启动失败]";
TXCLog.e(TAG,msg); TXCLog.e(TAG, msg);
callbackOnThread(mCallback, "onError", event, msg); callbackOnThread(mCallback, "onError", event, msg);
} }
} }
...@@ -3309,10 +3277,10 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3309,10 +3277,10 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
}); });
} }
private class PlayerItem { private class PlayerItem {
public TXCloudVideoView view; public TXCloudVideoView view;
public AnchorInfo anchorInfo; public AnchorInfo anchorInfo;
public TXLivePlayer player; public TXLivePlayer player;
public PlayerItem(TXCloudVideoView view, AnchorInfo anchorInfo, TXLivePlayer player) { public PlayerItem(TXCloudVideoView view, AnchorInfo anchorInfo, TXLivePlayer player) {
this.view = view; this.view = view;
...@@ -3320,15 +3288,15 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3320,15 +3288,15 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
this.player = player; this.player = player;
} }
public void resume(){ public void resume() {
this.player.resume(); this.player.resume();
} }
public void pause(){ public void pause() {
this.player.pause(); this.player.pause();
} }
public void destroy(){ public void destroy() {
this.player.stopPlay(true); this.player.stopPlay(true);
this.view.onDestroy(); this.view.onDestroy();
} }
...@@ -3336,7 +3304,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3336,7 +3304,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
protected class CommonJson<T> { protected class CommonJson<T> {
public String cmd; public String cmd;
public T data; public T data;
public CommonJson() { public CommonJson() {
} }
} }
...@@ -3385,7 +3354,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear ...@@ -3385,7 +3354,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear
public long timestamp; public long timestamp;
} }
protected class CustomMessage{ protected class CustomMessage {
public String userName; public String userName;
public String userAvatar; public String userAvatar;
public String cmd; public String cmd;
......
...@@ -500,6 +500,15 @@ public class TCCameraAnchorActivity2 extends TCBaseAnchorActivity { ...@@ -500,6 +500,15 @@ public class TCCameraAnchorActivity2 extends TCBaseAnchorActivity {
*/ */
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (null != mAudioCtrl && mAudioCtrl.getVisibility() == View.VISIBLE) {
mAudioCtrl.setVisibility( View.GONE);
return;
}
if (mBeautyControl.isShown() || mBeautyControl.getVisibility() == View.VISIBLE) {
mBeautyControl.setVisibility( View.GONE);
return;
}
int i = v.getId(); int i = v.getId();
if (i == R.id.switch_cam) { if (i == R.id.switch_cam) {
if (mLiveRoom != null) { if (mLiveRoom != null) {
......
...@@ -399,7 +399,7 @@ ...@@ -399,7 +399,7 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginRight="15dp" android:layout_marginRight="125dp"
android:layout_marginBottom="10dp"> android:layout_marginBottom="10dp">
<com.dayu.livemodule.xiaozhibo.common.widget.like.TCHeartLayout <com.dayu.livemodule.xiaozhibo.common.widget.like.TCHeartLayout
......
...@@ -328,16 +328,23 @@ ...@@ -328,16 +328,23 @@
android:stackFromBottom="true" android:stackFromBottom="true"
android:transcriptMode="normal" /> android:transcriptMode="normal" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never"
android:layout_marginBottom="60dp"
android:background="#00000000"
>
<com.dayu.livemodule.xiaozhibo.anchor.music.TCAudioControl <com.dayu.livemodule.xiaozhibo.anchor.music.TCAudioControl
android:id="@+id/anchor_audio_control" android:id="@+id/anchor_audio_control"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="#ffffff"
android:clickable="true" android:clickable="true"
android:orientation="vertical" android:orientation="vertical"
android:padding="0dp" android:padding="0dp"
android:visibility="gone" /> android:visibility="gone" />
</ScrollView>
<com.tencent.liteav.demo.beauty.BeautyPanel <com.tencent.liteav.demo.beauty.BeautyPanel
android:id="@+id/beauty_panel" android:id="@+id/beauty_panel"
...@@ -420,6 +427,7 @@ ...@@ -420,6 +427,7 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"> android:layout_marginBottom="10dp">
<com.dayu.livemodule.xiaozhibo.common.widget.like.TCHeartLayout <com.dayu.livemodule.xiaozhibo.common.widget.like.TCHeartLayout
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/xml_music_control_part"
android:orientation="vertical"
android:background="@color/colorTransparentGray"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_marginTop="15dp">
<Button
android:id="@+id/btn_select_bgm"
android:layout_width="50dp"
android:layout_height="20dp"
android:text="伴奏"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button"
android:layout_marginLeft="15dp"
android:layout_marginBottom="15dp"
android:layout_above="@+id/seekBar_bgm_volume"/>
<Button
android:id="@+id/btn_stop_bgm"
android:layout_width="50dp"
android:layout_height="20dp"
android:text="结束"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button"
android:layout_marginLeft="15dp"
android:layout_marginBottom="15dp"
android:layout_toRightOf="@+id/btn_select_bgm"
android:layout_above="@+id/seekBar_bgm_volume" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_marginTop="15dp" >
<TextView
android:id="@+id/textView_bgm_pitch"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:text="伴奏音调"
android:textSize="12dp"
android:textColor="@color/colorTextBlack"
android:layout_marginBottom="8dp"
android:layout_above="@+id/textView_bgm_seek"
android:layout_marginLeft="15dp" />
<SeekBar
android:id="@+id/seekBar_bgm_pitch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="4.0dip"
android:minHeight="4.0dip"
android:visibility="visible"
android:progressDrawable="@drawable/seekbar_progress_drawable"
android:max="100"
android:progress="50"
android:indeterminate="false"
android:layout_marginBottom="15dp"
android:layout_above="@+id/seekBar_bgm_seek"
android:layout_toRightOf="@+id/textView_bgm_pitch" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_marginTop="15dp" >
<TextView
android:id="@+id/textView_bgm_seek"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:text="伴奏快进"
android:textSize="12dp"
android:textColor="@color/colorTextBlack"
android:layout_marginBottom="8dp"
android:layout_above="@+id/textView_bgm_volume"
android:layout_marginLeft="15dp" />
<SeekBar
android:id="@+id/seekBar_bgm_seek"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="4.0dip"
android:minHeight="4.0dip"
android:visibility="visible"
android:progressDrawable="@drawable/seekbar_progress_drawable"
android:max="100"
android:progress="0"
android:indeterminate="false"
android:layout_marginBottom="15dp"
android:layout_above="@+id/seekBar_bgm_volume"
android:layout_toRightOf="@+id/textView_bgm_volume" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_marginTop="15dp" >
<TextView
android:id="@+id/textView_bgm_volume"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:text="伴奏音量"
android:textSize="12dp"
android:textColor="@color/colorTextBlack"
android:layout_marginBottom="8dp"
android:layout_above="@+id/textView_voice_volume"
android:layout_marginLeft="15dp" />
<SeekBar
android:id="@+id/seekBar_bgm_volume"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="4.0dip"
android:minHeight="4.0dip"
android:visibility="visible"
android:progressDrawable="@drawable/seekbar_progress_drawable"
android:max="100"
android:progress="50"
android:indeterminate="false"
android:layout_marginBottom="15dp"
android:layout_above="@+id/seekBar_voice_volume"
android:layout_toRightOf="@+id/textView_bgm_volume" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_marginTop="15dp" >
<TextView
android:id="@+id/textView_voice_volume"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:text="人声音量"
android:textSize="12dp"
android:textColor="@color/colorTextBlack"
android:layout_marginBottom="8dp"
android:layout_above="@+id/layout_reverb"
android:layout_marginLeft="15dp" />
<SeekBar
android:id="@+id/seekBar_voice_volume"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="4.0dip"
android:minHeight="4.0dip"
android:visibility="visible"
android:progressDrawable="@drawable/seekbar_progress_drawable"
android:max="100"
android:progress="50"
android:indeterminate="false"
android:layout_toRightOf="@+id/textView_voice_volume" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="horizontal"
android:weightSum="7"
android:layout_above="@+id/textView_audio_ctrl_title">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_reverb_default"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="原声"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_reverb_1"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="KTV"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_reverb_2"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="房间"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_reverb_3"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="会堂"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_reverb_4"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="低沉"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_reverb_5"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="洪亮"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_reverb_6"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="磁性"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="horizontal"
android:weightSum="7"
android:layout_above="@+id/textView_audio_ctrl_title">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_default"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="原声"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_1"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="熊孩子"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_2"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="萝莉"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_3"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="大叔"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_4"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="重金属"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_5"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="感冒"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="horizontal"
android:weightSum="7"
android:layout_above="@+id/textView_audio_ctrl_title">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_6"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="外国人"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_7"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="困兽"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_8"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="死肥仔"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_9"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="强电流"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_10"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="重机械"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:id="@+id/btn_voicechanger_11"
android:layout_width="40dp"
android:layout_height="40dp"
android:text="空灵"
android:textSize="12dp"
android:focusable="false"
android:background="@drawable/round_button_2"/>
</FrameLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/colorGray7"/>
<TextView
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="音效调节"
android:textSize="16dp"
android:textColor="@color/colorTextBlack"
android:background="@color/white"
android:gravity="center"
android:layout_alignParentBottom="true" />
</LinearLayout>
<com.dayu.livemodule.xiaozhibo.anchor.music.TCMusicSelectView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="@+id/xml_music_select_view"
android:visibility="gone"
android:clickable="true"
android:background="@color/white">
</com.dayu.livemodule.xiaozhibo.anchor.music.TCMusicSelectView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_outside_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/rl_inputdlg_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_input_dialog_background"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<LinearLayout
android:id="@+id/barrage_area"
android:orientation="horizontal"
android:layout_weight="0.3"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/barrage_btn"
android:layout_width="40dp"
android:layout_marginLeft="10dp"
android:layout_height="25dp"
android:layout_marginRight="10dp"
android:background="@drawable/barrage_slider_off" />
</LinearLayout>
<View android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="6dp"
android:layout_marginStart="6dp"
android:background="@color/colorTransparentBlack"/>
<EditText
android:id="@+id/et_input_message"
android:hint="@string/dialog_input_text_hint"
android:layout_width="match_parent"
android:layout_weight="4"
android:layout_height="wrap_content"
android:imeActionId="@+id/login"
android:imeOptions="flagNoExtractUi"
android:inputType="text"
android:maxLength="32"
android:textColor="@color/black"
android:maxLines="1"
android:singleLine="true" />
<View android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="6dp"
android:layout_marginStart="6dp"
android:background="@color/colorTransparentBlack"/>
<LinearLayout
android:id="@+id/confirm_area"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content">
<Button
android:id="@+id/confrim_btn"
android:layout_width="50dp"
android:layout_height="30dp"
android:background="@drawable/btn_send_message"
android:gravity="center"
android:textColor="@color/colorAccent"
android:text="@string/send" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
...@@ -26,6 +26,7 @@ import com.dayu.order.api.protocol.TranCompanyBean; ...@@ -26,6 +26,7 @@ import com.dayu.order.api.protocol.TranCompanyBean;
import com.dayu.order.api.protocol.bean.ServiceProviderBean; import com.dayu.order.api.protocol.bean.ServiceProviderBean;
import com.dayu.order.api.protocol.bean.ServiceStationBean; import com.dayu.order.api.protocol.bean.ServiceStationBean;
import com.dayu.order.api.protocol.companyManager; import com.dayu.order.api.protocol.companyManager;
import com.dayu.order.api.protocol.data.AddDialRecordData;
import com.dayu.order.api.protocol.data.ReceivePartData; import com.dayu.order.api.protocol.data.ReceivePartData;
import com.dayu.order.api.protocol.data.SendPartData; import com.dayu.order.api.protocol.data.SendPartData;
import com.dayu.order.common.OrderConstant; import com.dayu.order.common.OrderConstant;
...@@ -490,4 +491,10 @@ public interface OrderService { ...@@ -490,4 +491,10 @@ public interface OrderService {
*/ */
@GET(Constants.API_7200+"/ordersLogistics/{id}") @GET(Constants.API_7200+"/ordersLogistics/{id}")
Observable<BaseResponse<OrderPardDeatilBean>> getPartDetail(@Path("id") int id); Observable<BaseResponse<OrderPardDeatilBean>> getPartDetail(@Path("id") int id);
/**
* 拨打电话记录
*/
@POST(Constants.API_7200+"/orderDialRecord")
Observable<BaseResponse<Boolean>> addDialRecord(@Body AddDialRecordData data);
} }
package com.dayu.order.api.protocol.data;
public class AddDialRecordData {
/**
* createId : 0
* createTime : 2020-07-17T06:29:51.733Z
* created : string
* id : 0
* mobile : string
* orderId : 0
*/
private int createId;
private String createTime;
private String created;
private String mobile;
private int orderId;
public AddDialRecordData() {
}
public AddDialRecordData(int createId, String createTime, String created, String mobile, int orderId) {
this.createId = createId;
this.createTime = createTime;
this.created = created;
this.mobile = mobile;
this.orderId = orderId;
}
public int getCreateId() {
return createId;
}
public void setCreateId(int createId) {
this.createId = createId;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getCreated() {
return created;
}
public void setCreated(String created) {
this.created = created;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public int getOrderId() {
return orderId;
}
public void setOrderId(int orderId) {
this.orderId = orderId;
}
}
...@@ -3,13 +3,16 @@ package com.dayu.order.presenter.orderdoing; ...@@ -3,13 +3,16 @@ package com.dayu.order.presenter.orderdoing;
import android.databinding.ObservableField; import android.databinding.ObservableField;
import android.os.Bundle; import android.os.Bundle;
import com.dayu.base.api.Api;
import com.dayu.common.BaseApplication; import com.dayu.common.BaseApplication;
import com.dayu.common.Constants; import com.dayu.common.Constants;
import com.dayu.event.UserInfo; import com.dayu.event.UserInfo;
import com.dayu.order.R; import com.dayu.order.R;
import com.dayu.order.api.OrderApiFactory; import com.dayu.order.api.OrderApiFactory;
import com.dayu.order.api.OrderService;
import com.dayu.order.api.protocol.Order; import com.dayu.order.api.protocol.Order;
import com.dayu.order.api.protocol.Spu; import com.dayu.order.api.protocol.Spu;
import com.dayu.order.api.protocol.data.AddDialRecordData;
import com.dayu.order.common.OrderConstant; import com.dayu.order.common.OrderConstant;
import com.dayu.order.ui.activity.MultiProcessOrderActivity; import com.dayu.order.ui.activity.MultiProcessOrderActivity;
import com.dayu.order.ui.activity.OrderDetailsActivity; import com.dayu.order.ui.activity.OrderDetailsActivity;
...@@ -21,6 +24,7 @@ import com.dayu.provider.event.RefreshTab; ...@@ -21,6 +24,7 @@ import com.dayu.provider.event.RefreshTab;
import com.dayu.utils.AppManager; import com.dayu.utils.AppManager;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
import com.dayu.utils.UserManager; import com.dayu.utils.UserManager;
import com.dayu.utils.UtilsDate;
import com.dayu.widgets.CustomDialog; import com.dayu.widgets.CustomDialog;
import com.megvii.idcardlib.util.ConUtil; import com.megvii.idcardlib.util.ConUtil;
import com.megvii.licensemanager.Manager; import com.megvii.licensemanager.Manager;
...@@ -49,10 +53,11 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter { ...@@ -49,10 +53,11 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter {
private int mSiteId; private int mSiteId;
private int mState; private int mState;
private int mPage; private int mPage;
UserInfo userInfo;
@Override @Override
public void onAttached() { public void onAttached() {
UserInfo userInfo = UserManager.getInstance().getUser(); userInfo = UserManager.getInstance().getUser();
mUserId = Integer.parseInt(userInfo.getAccountId()); mUserId = Integer.parseInt(userInfo.getAccountId());
mSiteId = userInfo.getSiteId(); mSiteId = userInfo.getSiteId();
mState = mView.getState(); mState = mView.getState();
...@@ -207,4 +212,10 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter { ...@@ -207,4 +212,10 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter {
public void onDetached() { public void onDetached() {
super.onDetached(); super.onDetached();
} }
public void addDialRecord(String phoneNum,int orderId) {
String time = UtilsDate.getCurrDate("yyyy-MM-dd HH:mm:ss");
AddDialRecordData recordData = new AddDialRecordData(mUserId, time, userInfo.getAccountName(),phoneNum, orderId);
Api.getService(OrderService.class).addDialRecord(recordData).compose(Api.applySchedulers()).subscribe();
}
} }
...@@ -30,7 +30,6 @@ import com.dayu.provider.event.RefreshServe; ...@@ -30,7 +30,6 @@ import com.dayu.provider.event.RefreshServe;
import com.dayu.provider.event.RefreshTab; import com.dayu.provider.event.RefreshTab;
import com.dayu.provider.router.RouterPath; import com.dayu.provider.router.RouterPath;
import com.dayu.utils.CommonUtils; import com.dayu.utils.CommonUtils;
import com.dayu.utils.LogUtils;
import com.dayu.utils.ProgressUtil; import com.dayu.utils.ProgressUtil;
import com.dayu.utils.SPUtils; import com.dayu.utils.SPUtils;
import com.dayu.utils.UIUtils; import com.dayu.utils.UIUtils;
...@@ -41,9 +40,7 @@ import com.umeng.analytics.MobclickAgent; ...@@ -41,9 +40,7 @@ import com.umeng.analytics.MobclickAgent;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -234,6 +231,7 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi ...@@ -234,6 +231,7 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
holder.tvSettlementDate.setTextColor(mContext.getResources().getColor(R.color.common_text_color)); holder.tvSettlementDate.setTextColor(mContext.getResources().getColor(R.color.common_text_color));
} }
holder.tvSettlementPrice.setText(CommonUtils.getMoneyStr(mContext,item.getSettlementPrice())); holder.tvSettlementPrice.setText(CommonUtils.getMoneyStr(mContext,item.getSettlementPrice()));
holder.tvSettlementDate.setText(CommonUtils.getYearData(item.getSettlementDate()));
time = item.getConfirmDoorTime(); time = item.getConfirmDoorTime();
break; break;
...@@ -296,11 +294,11 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi ...@@ -296,11 +294,11 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
if (item.getStatus() != 1) { if (item.getStatus() != 1) {
holder.itemTextPhone.setOnClickListener(v -> { holder.itemTextPhone.setOnClickListener(v -> {
if (!TextUtils.isEmpty(item.getCustomerTelphome()) && !TextUtils.isEmpty(item.getCustomerMobile())) { if (!TextUtils.isEmpty(item.getCustomerTelphome()) && !TextUtils.isEmpty(item.getCustomerMobile())) {
showMoblieDialog(item.getCustomerMobile(), item.getCustomerTelphome()); showMoblieDialog(item.getCustomerMobile(), item.getCustomerTelphome(),item.getId());
} else if (!TextUtils.isEmpty(item.getCustomerTelphome())){ } else if (!TextUtils.isEmpty(item.getCustomerTelphome())){
takePhone(item.getCustomerTelphome()); takePhone(item.getCustomerTelphome(),item.getId());
}else if (!TextUtils.isEmpty(item.getCustomerMobile())){ }else if (!TextUtils.isEmpty(item.getCustomerMobile())){
takePhone(item.getCustomerMobile()); takePhone(item.getCustomerMobile(),item.getId());
} }
Map<String, String> map_ekv = new HashMap<>(); Map<String, String> map_ekv = new HashMap<>();
if (item.getStatus() == 2) { if (item.getStatus() == 2) {
...@@ -531,12 +529,12 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi ...@@ -531,12 +529,12 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
customDialog.show(); customDialog.show();
} }
private void showMoblieDialog(String mobile, String tel) { private void showMoblieDialog(String mobile, String tel, int id) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
list.add(mobile); list.add(mobile);
list.add(tel); list.add(tel);
OptionsPickerView pvOptions = new OptionsPickerBuilder(mContext, OptionsPickerView pvOptions = new OptionsPickerBuilder(mContext,
(options1, options2, options3, v) -> takePhone(list.get(options1))) (options1, options2, options3, v) -> takePhone(list.get(options1),id))
.setContentTextSize(20) .setContentTextSize(20)
.setLineSpacingMultiplier(2.0f) .setLineSpacingMultiplier(2.0f)
.setContentTextSize(20) .setContentTextSize(20)
...@@ -545,10 +543,13 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi ...@@ -545,10 +543,13 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi
pvOptions.show(); pvOptions.show();
} }
private void takePhone(String phone) { private void takePhone(String phone,int orderId) {
Intent intent = new Intent(Intent.ACTION_DIAL); Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:" + phone)); intent.setData(Uri.parse("tel:" + phone));
mContext.startActivity(intent); mContext.startActivity(intent);
if (mPresenter != null)
mPresenter.addDialRecord(phone,orderId);
} }
public void initPresenter(OrderDoingPresenter presenter) { public void initPresenter(OrderDoingPresenter presenter) {
......
...@@ -2,11 +2,8 @@ package com.dayu.order.ui.fragment; ...@@ -2,11 +2,8 @@ package com.dayu.order.ui.fragment;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.ImageView;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.dayu.base.api.APIService; import com.dayu.base.api.APIService;
...@@ -14,14 +11,15 @@ import com.dayu.base.api.Api; ...@@ -14,14 +11,15 @@ import com.dayu.base.api.Api;
import com.dayu.base.ui.activity.ImgGalleryActivty; import com.dayu.base.ui.activity.ImgGalleryActivty;
import com.dayu.base.ui.adapter.CoreAdapter; import com.dayu.base.ui.adapter.CoreAdapter;
import com.dayu.base.ui.fragment.BaseFragment; import com.dayu.base.ui.fragment.BaseFragment;
import com.dayu.base.ui.fragment.DataBindingFragment;
import com.dayu.base.ui.presenter.SImplePresenter; import com.dayu.base.ui.presenter.SImplePresenter;
import com.dayu.common.Constants; import com.dayu.common.Constants;
import com.dayu.location.base.LocationUtils; import com.dayu.location.base.LocationUtils;
import com.dayu.order.R; import com.dayu.order.R;
import com.dayu.order.api.OrderApiFactory; import com.dayu.order.api.OrderApiFactory;
import com.dayu.order.api.OrderService;
import com.dayu.order.api.protocol.OrderDetail; import com.dayu.order.api.protocol.OrderDetail;
import com.dayu.order.api.protocol.Spu; import com.dayu.order.api.protocol.Spu;
import com.dayu.order.api.protocol.data.AddDialRecordData;
import com.dayu.order.common.OperatePhoneEvent; import com.dayu.order.common.OperatePhoneEvent;
import com.dayu.order.common.OrderConstant; import com.dayu.order.common.OrderConstant;
import com.dayu.order.databinding.FragmentMultiDetailBinding; import com.dayu.order.databinding.FragmentMultiDetailBinding;
...@@ -31,17 +29,15 @@ import com.dayu.order.databinding.ItemDetailDeviceCountBinding; ...@@ -31,17 +29,15 @@ import com.dayu.order.databinding.ItemDetailDeviceCountBinding;
import com.dayu.order.databinding.ItemDetailServerInfoBinding; import com.dayu.order.databinding.ItemDetailServerInfoBinding;
import com.dayu.order.ui.activity.PdfWebViewActivity; import com.dayu.order.ui.activity.PdfWebViewActivity;
import com.dayu.order.ui.activity.QrCodeActivity; import com.dayu.order.ui.activity.QrCodeActivity;
import com.dayu.order.ui.activity.ServerInstructionActivity;
import com.dayu.provider.event.TakeOrderSuccessEvent; import com.dayu.provider.event.TakeOrderSuccessEvent;
import com.dayu.provider.router.RouterPath; import com.dayu.provider.router.RouterPath;
import com.dayu.utils.CommonUtils; import com.dayu.utils.CommonUtils;
import com.dayu.utils.GlideImageLoader;
import com.dayu.utils.ToastUtils; import com.dayu.utils.ToastUtils;
import com.dayu.utils.UIUtils; import com.dayu.utils.UIUtils;
import com.dayu.utils.UtilsDate;
import com.dayu.widgets.CustomDialog; import com.dayu.widgets.CustomDialog;
import com.dayu.widgets.TextDialog; import com.dayu.widgets.TextDialog;
import com.dayu.widgets.listener.OnItemClickListener; import com.dayu.widgets.listener.OnItemClickListener;
import com.megvii.idcardlib.util.DialogUtil;
import com.umeng.analytics.MobclickAgent; import com.umeng.analytics.MobclickAgent;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
...@@ -198,9 +194,15 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag ...@@ -198,9 +194,15 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag
} else { } else {
if (phones.size() == 1) { if (phones.size() == 1) {
CommonUtils.dialPhone(mActivity, phones.get(0)); CommonUtils.dialPhone(mActivity, phones.get(0));
addDialPhoneRecord(phones.get(0));
} else { } else {
TextDialog.getInstance().showCenterDialog(mActivity, phones, pos -> TextDialog.getInstance().showCenterDialog(mActivity, phones, pos -> {
CommonUtils.dialPhone(mActivity, phones.get(pos))); CommonUtils.dialPhone(mActivity, phones.get(pos));
addDialPhoneRecord(phones.get(pos));
}
);
} }
} }
}); });
...@@ -222,11 +224,17 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag ...@@ -222,11 +224,17 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag
}); });
} }
private void addDialPhoneRecord(String phoneNum) {
String time = UtilsDate.getCurrDate("yyyy-MM-dd HH:mm:ss");
AddDialRecordData recordData = new AddDialRecordData(mUserId, time, mUserInfo.getAccountName(),phoneNum, orderId);
Api.getService(OrderService.class).addDialRecord(recordData).compose(Api.applySchedulers()).subscribe();
}
private void takeOrder() { private void takeOrder() {
showDialog(); showDialog();
OrderApiFactory.receiveOrder(orderId, mUserId).subscribe(mPresenter.baseObserver( OrderApiFactory.receiveOrder(orderId, mUserId).subscribe(mPresenter.baseObserver(
aBoolean -> { aBoolean -> {
MobclickAgent.onEvent(mActivity,"get_serviceOrder"); MobclickAgent.onEvent(mActivity, "get_serviceOrder");
EventBus.getDefault().post(new TakeOrderSuccessEvent()); EventBus.getDefault().post(new TakeOrderSuccessEvent());
ToastUtils.showLongToast(R.string.take_oreder_success_tosee); ToastUtils.showLongToast(R.string.take_oreder_success_tosee);
mBind.tvTakeOrder.setVisibility(View.GONE); mBind.tvTakeOrder.setVisibility(View.GONE);
......
...@@ -35,6 +35,7 @@ public class OrderFirstTabFragment extends BaseFragment<OrderDoingPresenter, Fra ...@@ -35,6 +35,7 @@ public class OrderFirstTabFragment extends BaseFragment<OrderDoingPresenter, Fra
public void initView() { public void initView() {
mAdapter = new OrderAdapter(true); mAdapter = new OrderAdapter(true);
mAdapter.setViewType(R.layout.fragment_orderdoing_item); mAdapter.setViewType(R.layout.fragment_orderdoing_item);
mAdapter.initPresenter(mPresenter);
mBind.recyclerView.setAdapter(mAdapter); mBind.recyclerView.setAdapter(mAdapter);
mPresenter.refresh(); mPresenter.refresh();
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
......
...@@ -138,7 +138,7 @@ public class PosterShareActivity extends BaseActivity<SImplePresenter, ActivityP ...@@ -138,7 +138,7 @@ public class PosterShareActivity extends BaseActivity<SImplePresenter, ActivityP
mBind.ivQr.setImageBitmap(bitmap); mBind.ivQr.setImageBitmap(bitmap);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
ToastUtils.showShortToast(R.string.error_unknow); ToastUtils.showShortToast(e.toString());
} }
} }
...@@ -146,7 +146,7 @@ public class PosterShareActivity extends BaseActivity<SImplePresenter, ActivityP ...@@ -146,7 +146,7 @@ public class PosterShareActivity extends BaseActivity<SImplePresenter, ActivityP
@Override @Override
public void onFailure(Call<ResponseBody> call, Throwable t) { public void onFailure(Call<ResponseBody> call, Throwable t) {
hideDialog(); hideDialog();
ToastUtils.showShortToast(R.string.error_unknow); ToastUtils.showShortToast(t.toString());
} }
}); });
} }
......
package com.dayu.usercenter.api; package com.dayu.usercenter.api;
import com.dayu.base.api.protocol.AddressInfoBean;
import com.dayu.base.api.protocol.BasePageBean; import com.dayu.base.api.protocol.BasePageBean;
import com.dayu.base.api.protocol.BaseResponse; import com.dayu.base.api.protocol.BaseResponse;
import com.dayu.common.Constants; import com.dayu.common.Constants;
import com.dayu.usercenter.model.AddUserCardData;
import com.dayu.usercenter.model.ApplyLicenceData; import com.dayu.usercenter.model.ApplyLicenceData;
import com.dayu.usercenter.model.ApplyWithdrawData;
import com.dayu.usercenter.model.EditBankData;
import com.dayu.usercenter.model.SaveSceneData; import com.dayu.usercenter.model.SaveSceneData;
import com.dayu.base.api.protocol.AddressInfoBean;
import com.dayu.usercenter.model.bean.BusinessSceneBean; import com.dayu.usercenter.model.bean.BusinessSceneBean;
import com.dayu.usercenter.model.EditBankData;
import com.dayu.usercenter.model.bean.CommonRecordListBean; import com.dayu.usercenter.model.bean.CommonRecordListBean;
import com.dayu.usercenter.model.bean.GlobelRateBean; import com.dayu.usercenter.model.bean.GlobelRateBean;
import com.dayu.usercenter.model.bean.InviteRecordBean; import com.dayu.usercenter.model.bean.InviteRecordBean;
...@@ -24,6 +26,8 @@ import com.dayu.usercenter.model.bean.UserLicenceBean; ...@@ -24,6 +26,8 @@ import com.dayu.usercenter.model.bean.UserLicenceBean;
import java.util.List; import java.util.List;
import io.reactivex.Observable; import io.reactivex.Observable;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.POST; import retrofit2.http.POST;
...@@ -261,5 +265,22 @@ public interface UserService2 { ...@@ -261,5 +265,22 @@ public interface UserService2 {
@Query("page") int page, @Query("page") int page,
@Query("pageSize") int pageSize); @Query("pageSize") int pageSize);
/**
* 添加发名片记录
*/
@POST(Constants.API_7100+"/engnieerCardShareRecord")
Observable<BaseResponse<Boolean>> addSendUserRecord(@Body AddUserCardData data);
/**
* 申请提现
*/
@POST(Constants.API_7800+"/payAccountWithdrawRecord/apply")
Observable<BaseResponse<Boolean>> appplyWithdraw(@Body ApplyWithdrawData data);
@GET("/api-third/WXUser/getWxQrCode")
Call<ResponseBody> createWxUrl(@Query("path") String path, @Query("width") int width);
} }
package com.dayu.usercenter.model;
public class AddUserCardData {
/**
* accountId : 0
* createTime : 2020-07-17T06:43:24.487Z
* id : 0
* operatorInfo : string
*/
private int accountId;
private String operatorInfo;
public AddUserCardData() {
}
public AddUserCardData(int accountId, String operatorInfo) {
this.accountId = accountId;
this.operatorInfo = operatorInfo;
}
public int getAccountId() {
return accountId;
}
public void setAccountId(int accountId) {
this.accountId = accountId;
}
public String getOperatorInfo() {
return operatorInfo;
}
public void setOperatorInfo(String operatorInfo) {
this.operatorInfo = operatorInfo;
}
}
package com.dayu.usercenter.model;
public class ApplyWithdrawData {
public int accountId;
public int type = 1; //1:大鱼师傅 2:小程序客户 3:大鱼商家 ,
public ApplyWithdrawData() {
}
public ApplyWithdrawData(int accountId) {
this.accountId = accountId;
}
}
...@@ -15,6 +15,15 @@ public class UserIncomeBean { ...@@ -15,6 +15,15 @@ public class UserIncomeBean {
private double servicePrice; private double servicePrice;
private double inviteRewardPrice; private double inviteRewardPrice;
private double platformRewardPrice; private double platformRewardPrice;
private double unWithdrawPrice;
public double getUnWithdrawPrice() {
return unWithdrawPrice;
}
public void setUnWithdrawPrice(double unWithdrawPrice) {
this.unWithdrawPrice = unWithdrawPrice;
}
public double getWithdrawPrice() { public double getWithdrawPrice() {
return withdrawPrice; return withdrawPrice;
......
...@@ -70,14 +70,13 @@ public class LoginPresenter extends LoginContract.Presenter { ...@@ -70,14 +70,13 @@ public class LoginPresenter extends LoginContract.Presenter {
} }
mView.showDialog(); mView.showDialog();
UserApiFactory.login(userName.get(), password.get(), "mobileLogin").subscribe(baseObserver(userInfo -> { UserApiFactory.login(userName.get(), password.get(), "mobileLogin").subscribe(baseObserver(userInfo -> {
if (userInfo.getDetectStatus() == 1) { if (userInfo.getRoles() != null && (userInfo.getRoles().contains(2) || userInfo.getRoles().contains(3))){
loginHx(userInfo.getHxAccount(), userInfo.getHxPwd()); userInfo.setSiteId(-1);
dumpAndSave(userInfo); userInfo.setMobile(userName.get());
} else if (userInfo.getDetectStatus() == 2 || userInfo.getDetectStatus() == 3) {
showLoginDialog();
UserManager.getInstance().saveUser(userInfo); UserManager.getInstance().saveUser(userInfo);
} else { ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
ToastUtils.showShortToast(UIUtils.getString(R.string.login_faile)); }else {
ToastUtils.showShortToast(UIUtils.getString(R.string.login_faile_by_role));
} }
})); }));
} }
......
...@@ -12,7 +12,6 @@ import com.dayu.provider.router.RouterPath; ...@@ -12,7 +12,6 @@ import com.dayu.provider.router.RouterPath;
import com.dayu.usercenter.R; import com.dayu.usercenter.R;
import com.dayu.usercenter.api.UserApiFactory; import com.dayu.usercenter.api.UserApiFactory;
import com.dayu.usercenter.common.UserConstant; import com.dayu.usercenter.common.UserConstant;
import com.dayu.usercenter.ui.activity.IdentityCertificationActivity;
import com.dayu.utils.AppManager; import com.dayu.utils.AppManager;
import com.dayu.utils.LogUtils; import com.dayu.utils.LogUtils;
import com.dayu.utils.StationManager; import com.dayu.utils.StationManager;
...@@ -127,13 +126,13 @@ public class SmsLoginPresenter extends SmsLoginContract.Presenter { ...@@ -127,13 +126,13 @@ public class SmsLoginPresenter extends SmsLoginContract.Presenter {
@Override @Override
public void dumpAndSave(UserInfo info) { public void dumpAndSave(UserInfo info) {
if (info.getRoles() != null && info.getRoles().contains(2)){ if (info.getRoles() != null && (info.getRoles().contains(2) || info.getRoles().contains(3))){
info.setSiteId(-1); info.setSiteId(-1);
info.setMobile(phoneNume.get()); info.setMobile(phoneNume.get());
UserManager.getInstance().saveUser(info); UserManager.getInstance().saveUser(info);
ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation(); ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation();
}else { }else {
ToastUtils.showShortToast(UIUtils.getString(R.string.login_faile)); ToastUtils.showShortToast(UIUtils.getString(R.string.login_faile_by_role));
} }
//// List<Integer> role = info.getRoles(); //// List<Integer> role = info.getRoles();
......
package com.dayu.usercenter.ui.activity2;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.badoo.mobile.util.WeakHandler;
import com.dayu.base.api.Api;
import com.dayu.base.ui.activity.BaseActivity;
import com.dayu.base.ui.presenter.SImplePresenter;
import com.dayu.common.Constants;
import com.dayu.usercenter.R;
import com.dayu.usercenter.api.UserService2;
import com.dayu.usercenter.databinding.ActivityShareUserCardBinding;
import com.dayu.usercenter.model.AddUserCardData;
import com.dayu.utils.BitmapUtils;
import com.dayu.utils.CommonUtils;
import com.dayu.utils.GlideImageLoader;
import com.dayu.utils.MPermissionUtils;
import com.dayu.utils.ToastUtils;
import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.bean.SHARE_MEDIA;
import java.io.File;
import java.io.InputStream;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class ShareUserCardActivity extends BaseActivity<SImplePresenter, ActivityShareUserCardBinding> {
WeakHandler weakHandler = new WeakHandler();
@Override
public void setPresenter() {
}
@Override
public int getLayoutId() {
return R.layout.activity_share_user_card;
}
@Override
public void initView() {
initUser();
mBind.tvName.setText("我是"+mUserInfo.getAccountName()+",很高兴为您服务!");
GlideImageLoader.load(this, mBind.ivAvatar, mUserInfo.getHeaderImg(), R.drawable.user);
mBind.titleBack.setOnClickListener(v -> finish());
mBind.btnShare.setOnClickListener(v -> {
showDialog();
saveAndShare();
});
initData();
}
private void saveAndShare() {
String[] mPerArr = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE};
MPermissionUtils.requestPermissionsResult(mActivity, 1, mPerArr, new MPermissionUtils.OnPermissionListener() {
@SuppressLint("CheckResult")
@Override
public void onPermissionGranted() {
Observable.timer(200, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> {
Bitmap bitmap = BitmapUtils.getBitmap(mBind.llPoster);
File file = BitmapUtils.saveBitmap2Local(bitmap, "card"+System.currentTimeMillis()+mUserId+ ".png");
if (file != null) {
CommonUtils.shareImg(ShareUserCardActivity.this, file, SHARE_MEDIA.WEIXIN_CIRCLE, null);
addShareCardRecord();
}else {
showToast("保存失败");
}
weakHandler.postDelayed(() -> {
hideDialog();
},200);
});
}
@Override
public void onPermissionDenied() {
ToastUtils.showShortToast(R.string.request_permission_failure);
}
});
}
private void addShareCardRecord() {
AddUserCardData data = new AddUserCardData(mUserId,"朋友圈");
Api.getService(UserService2.class).addSendUserRecord(data).compose(Api.applySchedulers()).subscribe();
}
private void initData() {
showDialog();
String path = Constants.USER_PROGRAM_PATH + mUserId;
Call<ResponseBody> call = Api.getService(UserService2.class).createWxUrl(path, 470);
call.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
hideDialog();
try {
InputStream is = response.body().byteStream();
Bitmap bitmap = BitmapFactory.decodeStream(is);
is.close();
mBind.ivQr.setImageBitmap(bitmap);
} catch (Exception e) {
e.printStackTrace();
ToastUtils.showShortToast(e.toString());
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
hideDialog();
ToastUtils.showShortToast(t.toString());
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data);
}
}
package com.dayu.usercenter.ui.fragment; package com.dayu.usercenter.ui.fragment;
import android.content.Intent; import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.dayu.base.api.Api;
import com.dayu.base.api.protocol.AddressInfoBean; import com.dayu.base.api.protocol.AddressInfoBean;
import com.dayu.base.ui.fragment.BaseFragment; import com.dayu.base.ui.fragment.BaseFragment;
import com.dayu.common.Constants; import com.dayu.common.Constants;
...@@ -20,25 +16,34 @@ import com.dayu.provider.event.CertificationEvent; ...@@ -20,25 +16,34 @@ import com.dayu.provider.event.CertificationEvent;
import com.dayu.provider.router.RouterPath; import com.dayu.provider.router.RouterPath;
import com.dayu.usercenter.R; import com.dayu.usercenter.R;
import com.dayu.usercenter.adapter.ServiceWechatAdapter; import com.dayu.usercenter.adapter.ServiceWechatAdapter;
import com.dayu.usercenter.api.UserService2;
import com.dayu.usercenter.data.protocol.EngineerInfo; import com.dayu.usercenter.data.protocol.EngineerInfo;
import com.dayu.usercenter.data.protocol.OrderRecord; import com.dayu.usercenter.data.protocol.OrderRecord;
import com.dayu.usercenter.data.protocol.TodayAchievement; import com.dayu.usercenter.data.protocol.TodayAchievement;
import com.dayu.usercenter.databinding.FragmentHomeUserBinding; import com.dayu.usercenter.databinding.FragmentHomeUserBinding;
import com.dayu.usercenter.event.EditAddressEvent;
import com.dayu.usercenter.event.EditBankEvent;
import com.dayu.usercenter.event.RefreshUserInfoEvent; import com.dayu.usercenter.event.RefreshUserInfoEvent;
import com.dayu.usercenter.event.RefreshUserRecordEvent; import com.dayu.usercenter.event.RefreshUserRecordEvent;
import com.dayu.usercenter.model.AddUserCardData;
import com.dayu.usercenter.model.ApplyWithdrawData;
import com.dayu.usercenter.model.bean.UserBankInfoBean; import com.dayu.usercenter.model.bean.UserBankInfoBean;
import com.dayu.usercenter.model.bean.UserIncomeBean; import com.dayu.usercenter.model.bean.UserIncomeBean;
import com.dayu.usercenter.presenter.homeuser.HomeUserContract; import com.dayu.usercenter.presenter.homeuser.HomeUserContract;
import com.dayu.usercenter.presenter.homeuser.HomeUserPresenter; import com.dayu.usercenter.presenter.homeuser.HomeUserPresenter;
import com.dayu.usercenter.ui.activity.WithdrawalsActivity; import com.dayu.usercenter.ui.activity.PersonInfoActivity;
import com.dayu.usercenter.ui.activity2.CommonRecordActivity; import com.dayu.usercenter.ui.activity2.CommonRecordActivity;
import com.dayu.usercenter.ui.activity2.EditBankActivity;
import com.dayu.usercenter.ui.activity2.ShareUserCardActivity;
import com.dayu.usercenter.ui.activity2.UserInfoActivity; import com.dayu.usercenter.ui.activity2.UserInfoActivity;
import com.dayu.utils.CommonUtils; import com.dayu.utils.CommonUtils;
import com.dayu.utils.ProgressUtil; import com.dayu.utils.ProgressUtil;
import com.dayu.utils.SPUtils; import com.dayu.utils.SPUtils;
import com.dayu.utils.UserManager; import com.dayu.utils.UserManager;
import com.dayu.widgets.CustomDialog; import com.dayu.widgets.CustomDialog;
import com.dayu.widgets.WechatShareDialog;
import com.umeng.analytics.MobclickAgent; import com.umeng.analytics.MobclickAgent;
import com.umeng.socialize.bean.SHARE_MEDIA;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
...@@ -58,6 +63,8 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -58,6 +63,8 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
private String mUserPhone; private String mUserPhone;
private String mScore; private String mScore;
private int mAccountBalance; private int mAccountBalance;
private boolean hasBankInfo, hasAddressInfo;
private double canWithdrawMoney;
public static HomeUserFragment newInstance() { public static HomeUserFragment newInstance() {
Bundle args = new Bundle(); Bundle args = new Bundle();
...@@ -76,8 +83,17 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -76,8 +83,17 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
mBind.refreshLayout.setEnableLoadMore(false); mBind.refreshLayout.setEnableLoadMore(false);
mBind.refreshLayout.setOnRefreshListener(refreshLayout -> mPresenter.getAllData(mUserId)); mBind.refreshLayout.setOnRefreshListener(refreshLayout -> mPresenter.getAllData(mUserId));
mBind.tvStartLive.setOnClickListener(view -> ARouter.getInstance().build(RouterPath.PATH_PREPARELIVE).navigation()); mBind.tvStartLive.setOnClickListener(view -> ARouter.getInstance().build(RouterPath.PATH_PREPARELIVE).navigation());
mBind.tvSendCard.setOnClickListener(view -> sendUserCard());
mBind.tvFetch.setOnClickListener(view ->{
if (canWithdrawMoney > 0){
applyWithdraw();
}else {
showToast("无可提现金额!");
}
});
} }
@Override @Override
public void setPresenter() { public void setPresenter() {
mBind.setPresenter(mPresenter); mBind.setPresenter(mPresenter);
...@@ -98,30 +114,50 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -98,30 +114,50 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
@Override @Override
public void getBankInfoSuccess(UserBankInfoBean info) { public void getBankInfoSuccess(UserBankInfoBean info) {
if (info == null || TextUtils.isEmpty(info.getBankAccount())){ if (info == null || TextUtils.isEmpty(info.getBankAccount())) {
if (TextUtils.isEmpty((String) SPUtils.get("bank_addr_info",""))){ hasBankInfo = false;
showBankAddrDialog(); if (TextUtils.isEmpty((String) SPUtils.get("bank_addr_info", ""))) {
SPUtils.put("bank_addr_info","showed"); showBankAddrDialog("");
SPUtils.put("bank_addr_info", "showed");
} }
} else {
hasBankInfo = true;
} }
} }
@Override @Override
public void getAddrInfoSuccess(AddressInfoBean info) { public void getAddrInfoSuccess(AddressInfoBean info) {
if (info == null || TextUtils.isEmpty(info.getAddress())){ if (info == null || TextUtils.isEmpty(info.getAddress())) {
if (TextUtils.isEmpty((String) SPUtils.get("bank_addr_info",""))){ hasAddressInfo = false;
showBankAddrDialog(); if (TextUtils.isEmpty((String) SPUtils.get("bank_addr_info", ""))) {
SPUtils.put("bank_addr_info","showed"); showBankAddrDialog("");
SPUtils.put("bank_addr_info", "showed");
} }
} else {
hasAddressInfo = true;
} }
} }
private void showBankAddrDialog() { private void showBankAddrDialog(String str) {
showBankAddrDialog(str,UserInfoActivity.class);
}
private void showBankAddrDialog(String str,Class clazz) {
showBankAddrDialog(str, "去填写",clazz);
}
//完善用户信息提示框
private void showBankAddrDialog(String str,String conirmStr, Class clazz) {
if (TextUtils.isEmpty(str)) {
str = "请尽快填写您的银行卡信息和快递信息,以免影响您的提现和接单。";
}
CustomDialog dialog = new CustomDialog(mActivity, R.style.CustomDialog, CustomDialog dialog = new CustomDialog(mActivity, R.style.CustomDialog,
"请尽快填写您的银行卡信息和快递信息,以免影响您的提现和接单。" str
, (dialog1, confirm) -> { , (dialog1, confirm) -> {
if (confirm) { if (confirm) {
Intent intent = new Intent(mActivity, UserInfoActivity.class); Intent intent = new Intent(mActivity, clazz);
startActivity(intent); startActivity(intent);
dialog1.dismiss(); dialog1.dismiss();
} }
...@@ -129,14 +165,14 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -129,14 +165,14 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
}); });
dialog.setTitle("提示") dialog.setTitle("提示")
.setNegativeButton(mActivity.getString(R.string.cancle)) .setNegativeButton(mActivity.getString(R.string.cancle))
.setPositiveButton("去填写"); .setPositiveButton(conirmStr);
dialog.show(); dialog.show();
} }
@Override @Override
public void getPersonalInfoSuccess(EngineerInfo info) { public void getPersonalInfoSuccess(EngineerInfo info) {
// mBind.tvStartLive.setVisibility(View.VISIBLE); // mBind.tvStartLive.setVisibility(View.VISIBLE);
mBind.tvStartLive.setVisibility(info.getLiveStatus() == 1?View.VISIBLE:View.GONE); mBind.tvStartLive.setVisibility(info.getLiveStatus() == 1 ? View.VISIBLE : View.GONE);
if (TextUtils.isEmpty(info.getIdentity())) { if (TextUtils.isEmpty(info.getIdentity())) {
SPUtils.put("USER_IDENTITY", ""); SPUtils.put("USER_IDENTITY", "");
} else { } else {
...@@ -193,14 +229,23 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -193,14 +229,23 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
//个人评分 //个人评分
mBind.tvScore.setText(record.getScore() + mActivity.getString(R.string.score)); mBind.tvScore.setText(record.getScore() + mActivity.getString(R.string.score));
mScore = record.getScore() + ""; mScore = record.getScore() + "";
drawStars(mBind.tvStar, mScore, "5"); // UIUtils.drawStars(mBind.tvStar, mScore, "5");
setLevelDesc(record.getScore());
// mBind.tvSaleReward.setText(""+record.getSalesPrice());
//// mBind.tvSaleRecord.setText(record.getSalesCount() + "");
// mBind.tvServiceIncome.setText(""+record.getServiceTotalPrice());
mBind.tvBusinessType.setText(record.getCategoryCounts() + ""); mBind.tvBusinessType.setText(record.getCategoryCounts() + "");
} }
//师傅等级
private void setLevelDesc(double score) {
if (score > 4) {
mBind.tvLevel.setText(R.string.user_level1);
} else if (score > 3) {
mBind.tvLevel.setText(R.string.user_level2);
} else {
mBind.tvLevel.setText(R.string.user_level3);
}
}
@Override @Override
public void setIncomData(UserIncomeBean data) { public void setIncomData(UserIncomeBean data) {
mBind.tvCashArrive.setText("¥" + data.getWithdrawPrice()); mBind.tvCashArrive.setText("¥" + data.getWithdrawPrice());
...@@ -208,6 +253,8 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -208,6 +253,8 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
mBind.tvServiceIncome.setText("¥" + data.getServicePrice()); mBind.tvServiceIncome.setText("¥" + data.getServicePrice());
mBind.tvInvateReward.setText("¥" + data.getInviteRewardPrice()); mBind.tvInvateReward.setText("¥" + data.getInviteRewardPrice());
mBind.tvPlatformReward.setText("¥" + data.getPlatformRewardPrice()); mBind.tvPlatformReward.setText("¥" + data.getPlatformRewardPrice());
mBind.tvCanFetch.setText("¥" + data.getUnWithdrawPrice());
canWithdrawMoney = data.getUnWithdrawPrice();
} }
@Override @Override
...@@ -220,11 +267,6 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -220,11 +267,6 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
@Override @Override
public void showAlipayDialog() { public void showAlipayDialog() {
boolean isShow = (boolean) SPUtils.get(Constants.IS_SHOW_ALIPAY_DILAOG, true);
if (isShow) {
showAlertDialog();
SPUtils.put(Constants.IS_SHOW_ALIPAY_DILAOG, false);
}
} }
...@@ -235,7 +277,7 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -235,7 +277,7 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
@Override @Override
public void copyWechat(String wechatNum) { public void copyWechat(String wechatNum) {
CommonUtils.copyText(mActivity,wechatNum); CommonUtils.copyText(mActivity, wechatNum);
} }
...@@ -252,89 +294,83 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -252,89 +294,83 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
} }
private void showAlertDialog() { //发送个人名片
CustomDialog dialog = new CustomDialog(mActivity, R.style.CustomDialog, mActivity.getString(R.string.not_set_account) private void sendUserCard() {
, (dialog1, confirm) -> { initUser();
if (confirm) { int detectSatus = UserManager.getInstance().getUser().getDetectStatus();
Intent intent = new Intent(mActivity, WithdrawalsActivity.class); if (detectSatus == 2 || detectSatus == 3) {
startActivity(intent); showCertificationDialog();
dialog1.dismiss(); return;
MobclickAgent.onEvent(mActivity, "sure_set_account"); }
} else { if (TextUtils.isEmpty(mUserInfo.getHeaderImg()) || mUserInfo.getHeaderImg().equals(Constants.AvatarUrl)) {
MobclickAgent.onEvent(mActivity, "cancle_set_account"); String str = "请先上传您的头像";
showBankAddrDialog(str,"去上传",PersonInfoActivity.class);
return;
}
if (!hasAddressInfo || !hasBankInfo) {
String str = "请先完善您的银行卡信息和快递信息";
showBankAddrDialog(str);
return;
}
WechatShareDialog.getInstance().showBottomDialog(mActivity, pos -> {
if (pos == 0){
String path = Constants.USER_PROGRAM_PATH+mUserId;
String title = "我是"+mUserInfo.getAccountName()+",很高兴为您服务!";
CommonUtils.shareProgramPath(mActivity, mUserInfo.getHeaderImg(), title, "",path, SHARE_MEDIA.WEIXIN, null);
AddUserCardData data = new AddUserCardData(mUserId,"微信");
Api.getService(UserService2.class).addSendUserRecord(data).compose(Api.applySchedulers()).subscribe();
}else {
startActivity(ShareUserCardActivity.class);
} }
dialog1.dismiss();
}); });
dialog.setTitle(mActivity.getString(R.string.notice))
.setNegativeButton(mActivity.getString(R.string.not_set_up))
.setPositiveButton(mActivity.getString(R.string.go_set_up));
dialog.show();
} }
/** //申请提现
* drawStars. private void applyWithdraw() {
* if (!hasBankInfo) {
* @param starLinearLayout . String str = "请先完善您的银行卡信息才能提现";
* @param lev . showBankAddrDialog(str,EditBankActivity.class);
* @param totalLevel . return;
*/
private void drawStars(LinearLayout starLinearLayout, String lev, String totalLevel) {
String level = "0";
if (!TextUtils.isEmpty(lev)) {
level = lev;
}
int max = Integer.parseInt(totalLevel);
int beginNum = 0;
int endNum = max;
boolean isNedHalf = false;
if (!TextUtils.isEmpty(level)) {
if (Float.parseFloat(level) > max) {
beginNum = max;
endNum = max - beginNum;
} else {
Float levelf = Float.parseFloat(level);
int leveli = Math.round(levelf);
if (leveli > levelf) {
beginNum = leveli - 1;
endNum = (max - 1) - beginNum;
isNedHalf = true;
} else {
beginNum = leveli;
endNum = max - beginNum;
}
}
}
starLinearLayout.removeAllViews();
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(3, 0, 3, 0);
for (int i = 0; i < beginNum; i++) {
ImageView starImg = new ImageView(mActivity);
Bitmap bm = BitmapFactory.decodeResource(mActivity.getResources(), R.drawable.
person_xingxing);
starImg.setImageBitmap(bm);
starLinearLayout.addView(starImg, layoutParams);
} }
showDialog();
ApplyWithdrawData data = new ApplyWithdrawData(mUserId);
Api.getService(UserService2.class).appplyWithdraw(data).compose(Api.applySchedulers())
.subscribe(mPresenter.baseObserver(success->{
if (success)
showApplySuccessDialog();
}));
// showApplySuccessDialog();
}
if (isNedHalf) { //申请提现成功弹框
ImageView starImg = new ImageView(mActivity); private void showApplySuccessDialog() {
Bitmap bm = BitmapFactory.decodeResource(mActivity.getResources(), R.drawable.person_banxing); CustomDialog dialog = new CustomDialog(mActivity, R.style.CustomDialog,
starImg.setImageBitmap(bm); "申请提现成功,您的资金将于下月初打到您的银行卡上"
starLinearLayout.addView(starImg, layoutParams); , (dialog1, confirm) -> {
} dialog1.dismiss();
});
dialog.setOneButton(true).show();
}
for (int i = 0; i < endNum; i++) { //提示去认证身份
ImageView starImg = new ImageView(mActivity); private void showCertificationDialog() {
Bitmap bm = BitmapFactory.decodeResource(mActivity.getResources(), R.drawable. CustomDialog customDialog = new CustomDialog(mActivity, R.style.CustomDialog, getString(R.string.engineer_identity_not_audite)
person_xing); , (dialog, confirm) -> {
starImg.setImageBitmap(bm); if (confirm) {
starLinearLayout.addView(starImg, layoutParams); Bundle bundle = new Bundle();
} bundle.putInt(Constants.CETIFICATION_STATE, 1);
ARouter.getInstance().build(RouterPath.PATH_CERTIFICAITON).withBundle(Constants.BUNDLE, bundle).navigation();
}
});
customDialog.setTitle(getString(R.string.certification))
.setPositiveButton(getString(R.string.go_certification))
.setNegativeButton(getString(R.string.cancle));
customDialog.show();
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
...@@ -369,4 +405,14 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo ...@@ -369,4 +405,14 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
public void refreshUser(RefreshUserInfoEvent event) { public void refreshUser(RefreshUserInfoEvent event) {
mPresenter.getUserInfo(); mPresenter.getUserInfo();
} }
@Subscribe
public void afterEditBank(EditBankEvent event) {
mPresenter.getBankInfo();
}
@Subscribe
public void afterEditAddr(EditAddressEvent event) {
mPresenter.getAddrInfo();
}
} }
...@@ -102,6 +102,9 @@ ...@@ -102,6 +102,9 @@
android:name=".ui.activity2.InviteRecordActivity" android:name=".ui.activity2.InviteRecordActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity <activity
android:name=".ui.activity2.ShareUserCardActivity"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activity2.TestRecordActivity" android:name=".ui.activity2.TestRecordActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
</application> </application>
......
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_fa">
<RelativeLayout
android:id="@+id/rl_title"
style="@style/title">
<TextView
style="@style/text_title"
android:text="分享" />
<ImageView
android:id="@+id/title_back"
style="@style/title_image_back" />
<ImageView
style="@style/card_line"
android:layout_alignParentBottom="true" />
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_poster"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_title"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="@color/white"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingBottom="50dp">
<TextView
android:id="@+id/tv_name"
style="@style/common_text_style"
android:layout_gravity="center_horizontal"
android:layout_margin="15dp"
android:textStyle="bold"
android:lineSpacingExtra="3dp"
android:gravity="center"
android:textSize="16sp" />
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="200dp"
android:layout_gravity="center_horizontal"
android:layout_height="200dp" />
<ImageView
android:id="@+id/iv_qr"
android:layout_width="130dp"
android:layout_height="130dp"
android:layout_marginTop="15dp"
android:layout_gravity="center_horizontal"
android:scaleType="fitCenter" />
</LinearLayout>
<Button
android:id="@+id/btn_share"
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_alignParentBottom="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@drawable/btn_blue_commom"
android:gravity="center"
android:text="保存海报,分享到朋友圈"
android:textColor="@color/white" />
</RelativeLayout>
</layout>
\ No newline at end of file
...@@ -16,16 +16,16 @@ ...@@ -16,16 +16,16 @@
<RelativeLayout <RelativeLayout
android:id="@+id/rl_title" android:id="@+id/rl_title"
style="@style/title"> style="@style/title">
<TextView <TextView
android:visibility="gone"
android:id="@+id/tv_start_live" android:id="@+id/tv_start_live"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:textColor="@color/common_text_color"
android:textSize="16sp"
android:gravity="center" android:gravity="center"
android:text="开始直播" android:text="开始直播"
/> android:textColor="@color/common_text_color"
android:textSize="16sp"
android:visibility="gone" />
<TextView <TextView
style="@style/text_title" style="@style/text_title"
...@@ -39,396 +39,478 @@ ...@@ -39,396 +39,478 @@
</RelativeLayout> </RelativeLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout <com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/refresh_layout" android:id="@+id/refresh_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingBottom="2dp">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="0dp"
android:background="@color/cl_white"> android:layout_weight="1"
android:paddingBottom="2dp">
<LinearLayout <android.support.v4.widget.NestedScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center_horizontal" android:background="@color/cl_white">
android:orientation="vertical">
<LinearLayout
<ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:scaleType="fitXY" android:gravity="center_horizontal"
android:src="@drawable/person_title_view" android:orientation="vertical">
android:visibility="gone" />
<RelativeLayout
android:id="@+id/person_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/table_record_title_bg"
android:onClick="@{()->presenter.toUserSetting()}"
android:padding="10dp">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:scaleType="fitXY"
android:layout_centerVertical="true" android:src="@drawable/person_title_view"
android:layout_marginRight="10dp"
android:src="@drawable/icon_arrow_right_gray" />
<com.dayu.widgets.CircleImageView
android:id="@+id/iv_header"
imageUrl="@{presenter.mUrl}"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginLeft="10dp"
android:src="@drawable/user" />
<!--android:onClick="@{()->presenter.dumpToPersonalInfo()}"-->
<ImageView
android:layout_width="73dp"
android:layout_height="20dp"
android:layout_alignLeft="@id/iv_header"
android:layout_alignBottom="@id/iv_header"
android:layout_marginLeft="5dp"
android:src="@drawable/head_shape"
android:visibility="gone" />
<TextView
android:layout_width="44dp"
android:layout_height="15dp"
android:layout_alignLeft="@id/iv_header"
android:layout_alignBottom="@id/iv_header"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dp"
android:layout_marginBottom="3dp"
android:text="@string/personal_info"
android:textColor="@color/white"
android:textSize="11sp"
android:visibility="gone" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="25dp"
android:layout_toRightOf="@id/iv_header"
android:text="@string/tv_person_center_name"
android:textColor="@color/cl_home_title_text_color"
android:textSize="14.7sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/iv_audited"
android:layout_width="41dp"
android:layout_height="14dp"
android:layout_marginLeft="2dp"
android:layout_marginTop="17dp"
android:layout_toRightOf="@id/tv_name"
android:src="@drawable/icon_authentication"
android:visibility="gone" /> android:visibility="gone" />
<RelativeLayout <RelativeLayout
android:id="@+id/persone_two" android:id="@+id/person_one"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/tv_name" android:background="@color/table_record_title_bg"
android:layout_alignLeft="@id/tv_name" android:onClick="@{()->presenter.toUserSetting()}"
android:layout_marginTop="9.3dp"> android:padding="10dp">
<TextView <ImageView
android:id="@+id/tv_sex"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/tv_person_center_sex_value" android:layout_alignParentRight="true"
android:textColor="@color/cl_home_title_text_color" android:layout_centerVertical="true"
android:textSize="12sp" /> android:layout_marginRight="10dp"
android:src="@drawable/icon_arrow_right_gray" />
<com.dayu.widgets.CircleImageView
android:id="@+id/iv_header"
imageUrl="@{presenter.mUrl}"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:src="@drawable/user" />
<!--android:onClick="@{()->presenter.dumpToPersonalInfo()}"-->
<TextView
android:id="@+id/tv_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13"
android:layout_toRightOf="@id/tv_sex"
android:text="@string/tv_person_center_age_value"
android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" />
</RelativeLayout> <ImageView
android:layout_width="73dp"
android:layout_height="20dp"
android:layout_alignLeft="@id/iv_header"
android:layout_alignBottom="@id/iv_header"
android:layout_marginLeft="5dp"
android:src="@drawable/head_shape"
android:visibility="gone" />
<LinearLayout <TextView
android:layout_width="wrap_content" android:layout_width="44dp"
android:layout_height="wrap_content" android:layout_height="15dp"
android:layout_below="@id/persone_two" android:layout_alignLeft="@id/iv_header"
android:layout_alignLeft="@id/tv_name" android:layout_alignBottom="@id/iv_header"
android:layout_marginTop="9.3dp" android:layout_centerHorizontal="true"
android:orientation="horizontal"> android:layout_marginLeft="20dp"
android:layout_marginBottom="3dp"
android:text="@string/personal_info"
android:textColor="@color/white"
android:textSize="11sp"
android:visibility="gone" />
<TextView <TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/str_phone" android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@id/iv_header"
android:text="@string/tv_person_center_name"
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" /> android:textSize="14.7sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_phone" <ImageView
android:id="@+id/iv_audited"
android:layout_width="41dp"
android:layout_height="14dp"
android:layout_marginLeft="2dp"
android:layout_marginTop="17dp"
android:layout_toRightOf="@id/tv_name"
android:src="@drawable/icon_authentication"
android:visibility="gone" />
<RelativeLayout
android:id="@+id/persone_two"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13" android:layout_below="@id/tv_name"
android:layout_toRightOf="@id/tv_age" android:layout_alignLeft="@id/tv_name"
android:text="@string/tv_person_center_phone" android:layout_marginTop="9.3dp">
android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" /> <TextView
android:id="@+id/tv_sex"
</LinearLayout> android:layout_width="wrap_content"
android:layout_height="wrap_content"
</RelativeLayout> android:text="@string/tv_person_center_sex_value"
android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13"
android:layout_toRightOf="@id/tv_sex"
android:text="@string/tv_person_center_age_value"
android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" />
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/persone_two"
android:layout_alignLeft="@id/tv_name"
android:layout_marginTop="9.3dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_phone"
android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13"
android:layout_toRightOf="@id/tv_age"
android:text="@string/tv_person_center_phone"
android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/ll_phone"
android:layout_alignLeft="@id/ll_phone"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/user_customer_satisfied"
android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="@string/zero_score"
android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" />
<LinearLayout
android:id="@+id/tv_star"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:orientation="horizontal"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/ll_score"
android:layout_alignLeft="@id/ll_score"
android:layout_marginTop="9.3dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/user_level"
android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13"
android:layout_toRightOf="@id/tv_age"
android:textColor="@color/cl_home_title_text_color"
android:textSize="12sp" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
<TextView <ImageView
android:layout_width="wrap_content" android:id="@+id/person_line"
android:layout_height="wrap_content" android:layout_width="293.3dp"
android:text="@string/user_customer_satisfied" android:layout_height="0.6dp"
android:textColor="@color/cl_home_title_text_color" android:layout_marginTop="15dp"
android:textSize="12sp" /> android:background="@color/cl_work_raiod"
android:visibility="gone" />
<TextView <TextView
android:id="@+id/tv_score" android:id="@+id/tv_send_card"
android:layout_width="wrap_content" style="@style/btn_common"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:layout_marginLeft="10dp" android:layout_marginLeft="40dp"
android:text="@string/zero_score" android:layout_marginTop="15dp"
android:textColor="@color/cl_home_title_text_color" android:layout_marginRight="40dp"
android:textSize="12sp" /> android:layout_marginBottom="15dp"
android:background="@drawable/btn_blue_commom"
android:text="@string/send_user_card" />
<LinearLayout <RelativeLayout
android:id="@+id/tv_star" android:layout_width="match_parent"
android:layout_width="90dp" android:layout_height="50dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:orientation="horizontal" /> android:layout_marginRight="15dp"
</LinearLayout> android:background="@drawable/personal_center_selector"
android:onClick="@{()->presenter.dumpToCacheRecord()}">
<ImageView
android:id="@+id/person_line"
android:layout_width="293.3dp"
android:layout_height="0.6dp"
android:layout_marginTop="15dp"
android:background="@color/cl_work_raiod"
android:visibility="gone" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/personal_center_selector"
android:onClick="@{()->presenter.dumpToCacheRecord()}">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
style="@style/tv_user_bottom1"
android:layout_marginLeft="25dp"
android:layout_marginTop="0dp"
android:text="@string/user_cash_arrive" />
<TextView
android:id="@+id/tv_cash_arrive"
style="@style/tv_user_bottom2"
android:layout_marginLeft="10dp"
android:layout_marginTop="0dp"
android:text="0"
android:textColor="@color/cl_order_item_date"
android:textSize="26sp" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
style="@style/ll_user_bottom"
android:layout_marginTop="10dp">
<LinearLayout <LinearLayout
style="@style/ll_user_bottom2" android:layout_width="wrap_content"
android:onClick="@{()->presenter.toCommonRecord(1)}"> android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
style="@style/tv_user_bottom1"
android:layout_marginLeft="25dp"
android:layout_marginTop="0dp"
android:text="@string/user_cash_arrive" />
<TextView
android:id="@+id/tv_cash_arrive"
style="@style/tv_user_bottom2"
android:layout_marginLeft="10dp"
android:layout_marginTop="0dp"
android:text="0"
android:textColor="@color/cl_order_item_date"
android:textSize="26sp" />
</LinearLayout>
</RelativeLayout>
<TextView <RelativeLayout
style="@style/tv_user_bottom1" android:layout_width="match_parent"
android:text="@string/user_sale_reward" /> android:layout_height="50dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:layout_marginRight="15dp"
android:background="@drawable/personal_center_selector">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
style="@style/tv_user_bottom1"
android:layout_marginLeft="25dp"
android:layout_marginTop="0dp"
android:text="可提现金额:" />
<TextView
android:id="@+id/tv_can_fetch"
style="@style/tv_user_bottom1"
android:layout_marginLeft="10dp"
android:layout_marginTop="0dp"
android:text="0"
android:textSize="16sp" />
</LinearLayout>
<TextView <TextView
android:id="@+id/tv_sale_reward" android:id="@+id/tv_fetch"
style="@style/tv_user_bottom2" style="@style/btn_common"
android:text="0" android:layout_height="36dp"
android:textColor="@color/cl_order_item_date" /> android:layout_width="100dp"
</LinearLayout> android:layout_centerVertical="true"
android:background="@drawable/btn_blue_commom"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:text="@string/apply_fetch" />
</RelativeLayout>
<LinearLayout <LinearLayout
style="@style/ll_user_bottom2" style="@style/ll_user_bottom"
android:layout_marginLeft="10dp" android:layout_marginTop="10dp">
android:onClick="@{()->presenter.toCommonRecord(2)}">
<LinearLayout
<TextView style="@style/ll_user_bottom2"
style="@style/tv_user_bottom1" android:onClick="@{()->presenter.toCommonRecord(1)}">
android:text="@string/user_service_income" />
<TextView
<TextView style="@style/tv_user_bottom1"
android:id="@+id/tv_service_income" android:text="@string/user_sale_reward" />
style="@style/tv_user_bottom2"
android:text="0" <TextView
android:textColor="@color/cl_order_item_date" /> android:id="@+id/tv_sale_reward"
style="@style/tv_user_bottom2"
android:text="0"
android:textColor="@color/cl_order_item_date" />
</LinearLayout>
<LinearLayout
style="@style/ll_user_bottom2"
android:layout_marginLeft="10dp"
android:onClick="@{()->presenter.toCommonRecord(2)}">
<TextView
style="@style/tv_user_bottom1"
android:text="@string/user_service_income" />
<TextView
android:id="@+id/tv_service_income"
style="@style/tv_user_bottom2"
android:text="0"
android:textColor="@color/cl_order_item_date" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout>
<LinearLayout
style="@style/ll_user_bottom"
android:layout_marginTop="10dp">
<LinearLayout <LinearLayout
style="@style/ll_user_bottom2" style="@style/ll_user_bottom"
android:onClick="@{()->presenter.toCommonRecord(3)}"> android:layout_marginTop="10dp">
<TextView <LinearLayout
style="@style/tv_user_bottom1" style="@style/ll_user_bottom2"
android:text="@string/user_invate_reward" /> android:onClick="@{()->presenter.toCommonRecord(3)}">
<TextView <TextView
android:id="@+id/tv_invate_reward" style="@style/tv_user_bottom1"
style="@style/tv_user_bottom2" android:text="@string/user_invate_reward" />
android:text="0"
android:textColor="@color/text_common_green" /> <TextView
android:id="@+id/tv_invate_reward"
style="@style/tv_user_bottom2"
android:text="0"
android:textColor="@color/text_common_green" />
</LinearLayout>
<LinearLayout
style="@style/ll_user_bottom2"
android:layout_marginLeft="10dp"
android:onClick="@{()->presenter.toCommonRecord(4)}">
<TextView
style="@style/tv_user_bottom1"
android:text="@string/user_platform_reward" />
<TextView
android:id="@+id/tv_platform_reward"
style="@style/tv_user_bottom2"
android:text="0"
android:textColor="@color/text_common_green" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
style="@style/ll_user_bottom2" style="@style/ll_user_bottom"
android:layout_marginLeft="10dp" android:layout_marginTop="10dp"
android:onClick="@{()->presenter.toCommonRecord(4)}"> android:layout_marginBottom="10dp">
<LinearLayout
style="@style/ll_user_bottom2"
android:onClick="@{()->presenter.dumpToBusinessType()}">
<TextView
style="@style/tv_user_bottom1"
android:text="@string/user_business_type" />
<TextView
android:id="@+id/tv_business_type"
style="@style/tv_user_bottom2"
android:text="0" />
</LinearLayout>
<LinearLayout
style="@style/ll_user_bottom2"
android:layout_marginLeft="10dp"
android:onClick="@{()->presenter.dumpToLicence()}">
<TextView <TextView
style="@style/tv_user_bottom1" style="@style/tv_user_bottom1"
android:text="@string/user_platform_reward" /> android:text="@string/tv_person_center_licence" />
<TextView <TextView
android:id="@+id/tv_platform_reward" android:id="@+id/tv_licence"
style="@style/tv_user_bottom2" style="@style/tv_user_bottom2"
android:text="0" android:text="0" />
android:textColor="@color/text_common_green" /> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout>
<LinearLayout <TextView
style="@style/ll_user_bottom" style="@style/common_text_style"
android:layout_marginTop="10dp" android:layout_width="match_parent"
android:layout_marginBottom="10dp"> android:paddingLeft="18dp"
android:text="@string/add_service_wechat"
<LinearLayout android:textSize="15sp" />
style="@style/ll_user_bottom2"
android:onClick="@{()->presenter.dumpToBusinessType()}"> <android.support.v7.widget.RecyclerView
android:id="@+id/rv_wechat"
<TextView android:layout_width="match_parent"
style="@style/tv_user_bottom1" android:layout_height="wrap_content"
android:text="@string/user_business_type" /> android:focusable="false"
android:focusableInTouchMode="false" />
<TextView
android:id="@+id/tv_business_type"
style="@style/tv_user_bottom2"
android:text="0" />
</LinearLayout>
<LinearLayout <LinearLayout
style="@style/ll_user_bottom2" android:layout_width="match_parent"
android:layout_marginLeft="10dp" android:layout_height="wrap_content"
android:onClick="@{()->presenter.dumpToLicence()}"> android:layout_margin="15dp"
android:orientation="horizontal">
<TextView <TextView
style="@style/tv_user_bottom1" android:id="@+id/apply_part"
android:text="@string/tv_person_center_licence" /> android:layout_width="0dp"
android:layout_height="45dp"
android:layout_weight="2"
android:background="@drawable/btn_blue_commom"
android:gravity="center"
android:onClick="@{()->presenter.dumpToInvate()}"
android:text="@string/invate_new_reward"
android:textColor="@color/white"
android:textSize="@dimen/sp_16" />
<TextView <TextView
android:id="@+id/tv_licence" android:layout_width="0dp"
style="@style/tv_user_bottom2" android:layout_height="45dp"
android:text="0" /> android:layout_marginLeft="15dp"
android:layout_weight="1"
android:background="@drawable/btn_blue_commom"
android:gravity="center"
android:onClick="@{()->presenter.toInviteRecord()}"
android:text="@string/invite_record"
android:textColor="@color/white"
android:textSize="@dimen/sp_16" />
</LinearLayout> </LinearLayout>
</LinearLayout>
<TextView
style="@style/common_text_style"
android:layout_width="match_parent"
android:paddingLeft="18dp"
android:text="@string/add_service_wechat"
android:textSize="15sp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_wechat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="horizontal">
<TextView
android:id="@+id/apply_part"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="45dp"
android:background="@drawable/btn_blue_commom"
android:gravity="center"
android:onClick="@{()->presenter.dumpToInvate()}"
android:text="@string/invate_new_reward"
android:textColor="@color/white"
android:textSize="@dimen/sp_16" />
<TextView <TextView
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="45dp" android:layout_height="45dp"
android:background="@drawable/btn_blue_commom"
android:gravity="center"
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:onClick="@{()->presenter.toInviteRecord()}" android:layout_marginRight="15dp"
android:text="@string/invite_record" android:layout_marginBottom="15dp"
android:background="@drawable/btn_dark_red"
android:gravity="center"
android:onClick="@{()->presenter.invateProvider()}"
android:text="@string/invate_provider_title"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/sp_16" /> android:textSize="@dimen/sp_16" />
</LinearLayout> </LinearLayout>
</android.support.v4.widget.NestedScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="15dp"
android:background="@drawable/btn_dark_red"
android:gravity="center"
android:onClick="@{()->presenter.invateProvider()}"
android:text="@string/invate_provider_title"
android:textColor="@color/white"
android:textSize="@dimen/sp_16" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout> </LinearLayout>
......
...@@ -49,4 +49,11 @@ ...@@ -49,4 +49,11 @@
<string name="invite_new_share_content_business">邀请商家瓜分千万佣金!</string> <string name="invite_new_share_content_business">邀请商家瓜分千万佣金!</string>
<string name="add_service_wechat">添加客服微信获得更多派单</string> <string name="add_service_wechat">添加客服微信获得更多派单</string>
<string name="copy_wechat_num">复制微信号</string> <string name="copy_wechat_num">复制微信号</string>
<string name="send_user_card">发名片</string>
<string name="user_level">等级</string>
<string name="user_level1">金牌师傅</string>
<string name="user_level2">银牌师傅</string>
<string name="user_level3">铜牌师傅</string>
<string name="user_level4">普通师傅</string>
<string name="apply_fetch">申请提现</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment