From 69d53b707a50b48d724f1387a2a7790d219e0fbf Mon Sep 17 00:00:00 2001 From: mReturn <1058851652@qq.com> Date: Tue, 28 Jul 2020 19:53:33 +0800 Subject: [PATCH] v2.6.0 --- baseSDK/build.gradle | 2 ++ baseSDK/src/main/java/com/dayu/base/api/APIException.java | 2 +- baseSDK/src/main/java/com/dayu/common/Constants.java | 4 +++- baseSDK/src/main/java/com/dayu/utils/CommonUtils.java | 6 ++++-- baseSDK/src/main/java/com/dayu/utils/UIUtils.java | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ baseSDK/src/main/res/values/strings.xml | 7 ++++--- baseSDK/src/main/res/values/styles.xml | 2 +- build.gradle | 4 ++-- learnCenter/src/main/java/com/dayu/learncenter/ui/activity/PrepareLiveActivity.java | 2 +- learnCenter/src/main/java/com/dayu/learncenter/ui/activity/VideoPlayActivity.java | 2 ++ learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/CommonLearnFragment.java | 2 +- learnCenter/src/main/res/layout/activity_prepare_live.xml | 2 +- learnCenter/src/main/res/layout/item_common_learn.xml | 2 +- liveModule/src/main/java/com/dayu/livemodule/MLVBLiveRoomImpl2.java | 455 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/anchor/TCCameraAnchorActivity2.java | 9 +++++++++ liveModule/src/main/res/layout/activity_audience2.xml | 2 +- liveModule/src/main/res/layout/activity_camera_anchor2.xml | 10 +++++++++- liveModule/src/main/res/layout/audio_ctrl2.xml | 539 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ liveModule/src/main/res/layout/dialog_input_text2.xml | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ orderCenter/src/main/java/com/dayu/order/api/OrderService.java | 7 +++++++ orderCenter/src/main/java/com/dayu/order/api/protocol/data/AddDialRecordData.java | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ orderCenter/src/main/java/com/dayu/order/presenter/orderdoing/OrderDoingPresenter.java | 13 ++++++++++++- orderCenter/src/main/java/com/dayu/order/ui/adapter/OrderAdapter.java | 19 ++++++++++--------- orderCenter/src/main/java/com/dayu/order/ui/fragment/MultiOrderDetailFragment.java | 28 ++++++++++++++++++---------- orderCenter/src/main/java/com/dayu/order/ui/fragment/OrderFirstTabFragment.java | 1 + saleCenter/src/main/java/com/bigfish/salecenter/ui/activity/PosterShareActivity.java | 4 ++-- userCenter/src/main/java/com/dayu/usercenter/api/UserService2.java | 25 +++++++++++++++++++++++-- userCenter/src/main/java/com/dayu/usercenter/model/AddUserCardData.java | 38 ++++++++++++++++++++++++++++++++++++++ userCenter/src/main/java/com/dayu/usercenter/model/ApplyWithdrawData.java | 15 +++++++++++++++ userCenter/src/main/java/com/dayu/usercenter/model/bean/UserIncomeBean.java | 9 +++++++++ userCenter/src/main/java/com/dayu/usercenter/presenter/login/LoginPresenter.java | 13 ++++++------- userCenter/src/main/java/com/dayu/usercenter/presenter/smslogin/SmsLoginPresenter.java | 5 ++--- userCenter/src/main/java/com/dayu/usercenter/ui/activity2/ShareUserCardActivity.java | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ userCenter/src/main/java/com/dayu/usercenter/ui/fragment/HomeUserFragment.java | 250 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------ userCenter/src/main/release/AndroidManifest.xml | 3 +++ userCenter/src/main/res/layout/activity_share_user_card.xml | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ userCenter/src/main/res/layout/fragment_home_user.xml | 742 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ userCenter/src/main/res/values/strings.xml | 7 +++++++ 38 files changed, 1939 insertions(+), 725 deletions(-) create mode 100644 liveModule/src/main/res/layout/audio_ctrl2.xml create mode 100644 liveModule/src/main/res/layout/dialog_input_text2.xml create mode 100644 orderCenter/src/main/java/com/dayu/order/api/protocol/data/AddDialRecordData.java create mode 100644 userCenter/src/main/java/com/dayu/usercenter/model/AddUserCardData.java create mode 100644 userCenter/src/main/java/com/dayu/usercenter/model/ApplyWithdrawData.java create mode 100644 userCenter/src/main/java/com/dayu/usercenter/ui/activity2/ShareUserCardActivity.java create mode 100644 userCenter/src/main/res/layout/activity_share_user_card.xml diff --git a/baseSDK/build.gradle b/baseSDK/build.gradle index 24071d2..c81eb85 100644 --- a/baseSDK/build.gradle +++ b/baseSDK/build.gradle @@ -85,6 +85,8 @@ dependencies { api 'com.google.android:flexbox:1.0.0' api 'com.github.chrisbanes:PhotoView:2.0.0' // api 'cjt.library.wheel:camera:1.1.9' + api 'de.hdodenhof:circleimageview:2.2.0' + api project(':umeng') diff --git a/baseSDK/src/main/java/com/dayu/base/api/APIException.java b/baseSDK/src/main/java/com/dayu/base/api/APIException.java index 849faa0..ffbfe55 100644 --- a/baseSDK/src/main/java/com/dayu/base/api/APIException.java +++ b/baseSDK/src/main/java/com/dayu/base/api/APIException.java @@ -89,7 +89,7 @@ public class APIException { return ex; } else { ex = new ResponeThrowable(e, ERROR.UNKNOWN); - ex.message = BaseApplication.getContext().getString(R.string.error_unknow); + ex.message = e.toString(); return ex; } } diff --git a/baseSDK/src/main/java/com/dayu/common/Constants.java b/baseSDK/src/main/java/com/dayu/common/Constants.java index bf010dd..aabab34 100755 --- a/baseSDK/src/main/java/com/dayu/common/Constants.java +++ b/baseSDK/src/main/java/com/dayu/common/Constants.java @@ -33,7 +33,8 @@ public class Constants { 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 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_BUSINESS = "http://app.dl.kf.ai/ext/#/merchants?code="; //邀请商家分享链接 @@ -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 AvatarUrl = "http://dl.kf.ai/test/sp/mobile/ios/business/checkApply/d1f55406ba3eeb90c4f7e8552131e623.JPG?x-oss-process=style/pic"; /***********************其他配置**********************************/ diff --git a/baseSDK/src/main/java/com/dayu/utils/CommonUtils.java b/baseSDK/src/main/java/com/dayu/utils/CommonUtils.java index 2250e95..72c03b7 100644 --- a/baseSDK/src/main/java/com/dayu/utils/CommonUtils.java +++ b/baseSDK/src/main/java/com/dayu/utils/CommonUtils.java @@ -378,7 +378,7 @@ public class CommonUtils { */ public static String getYearData(String dataStr) { if (TextUtils.isEmpty(dataStr)) { - return UIUtils.getString(R.string.unknown); + return " "; } else { SimpleDateFormat df = null; Date sDate = null; @@ -388,7 +388,9 @@ public class CommonUtils { return df.format(sDate); } catch (ParseException e) { e.printStackTrace(); - return UIUtils.getString(R.string.unknown); +// return UIUtils.getString(R.string.unknown); + return " "; + } } } diff --git a/baseSDK/src/main/java/com/dayu/utils/UIUtils.java b/baseSDK/src/main/java/com/dayu/utils/UIUtils.java index 01623f0..7f3de81 100755 --- a/baseSDK/src/main/java/com/dayu/utils/UIUtils.java +++ b/baseSDK/src/main/java/com/dayu/utils/UIUtils.java @@ -233,6 +233,70 @@ public class UIUtils { } 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); + } + } } diff --git a/baseSDK/src/main/res/values/strings.xml b/baseSDK/src/main/res/values/strings.xml index 2022e1f..bb4c27a 100644 --- a/baseSDK/src/main/res/values/strings.xml +++ b/baseSDK/src/main/res/values/strings.xml @@ -162,6 +162,7 @@ <string name="title_agreement">用户协议</string> <string name="agreement_detail">《用户协议》</string> <string name="login_faile">登录失败</string> + <string name="login_faile_by_role">该账号不是大鱼师傅</string> <string name="send_code_faile">发送验证码失败</string> <string name="voice_code_notice">收不到短信?试试语音验证</string> <string name="schedule">日程</string> @@ -679,10 +680,10 @@ <string name="agreement"> 特别提示:\n -欢迎您注册使用大鱼U服(以下简称“大鱼平台”),您在申请注册流程中点击同意本协议之前,应当认真阅读本协议。请您务必审慎阅读、充分理解各条款内容,特别是免除或者限制责任的条款、法律适用和争议解决条款。免除或者限制责任的条款将以粗体以及下划线标识,您应重点阅读。如您对本协议有任何疑问,请与kf@kf.ai联系。当您按照注册页面提示填写信息、阅读并同意本协议且完成全部注册程序后,即表示您已充分阅读、理解并接受本协议的全部内容,并与北京大鱼创想网络科技有限公司达成一致,双方同意使用互联网信息技术以数据电文形式订立本用户协议并认同其效力。\n +欢迎您注册使用大鱼云服(以下简称“大鱼平台”),您在申请注册流程中点击同意本协议之前,应当认真阅读本协议。请您务必审慎阅读、充分理解各条款内容,特别是免除或者限制责任的条款、法律适用和争议解决条款。免除或者限制责任的条款将以粗体以及下划线标识,您应重点阅读。如您对本协议有任何疑问,请与kf@kf.ai联系。当您按照注册页面提示填写信息、阅读并同意本协议且完成全部注册程序后,即表示您已充分阅读、理解并接受本协议的全部内容,并与北京大鱼创想网络科技有限公司达成一致,双方同意使用互联网信息技术以数据电文形式订立本用户协议并认同其效力。\n 您的下载、注册、登录、使用及连接大鱼平台服务等行为均将被视为您已经完全了解、接受并同意遵守本协议项下的全部内容。本协议可由本公司根据需要不时的修改,并以网站或应用程序公示的方式进行公告,不再单独通知您。修改后的协议一经公布即替代原来的协议,构成您与本公司之间就本协议主题事由的全部、最新协议。您有义务不时关注并阅读最新版的协议以及网站或应用程序的公告。如您不同意更新后的协议,可以且应立即停止接受本公司依据本协议提供的服务;如您继续使用大鱼平台的服务的,即视为您同意更新后的协议。\n 第一条 定义\n -1. 大鱼平台:大鱼平台是由北京大鱼创想科技有限公司(以下简称“本公司”或者“乙方”)开发的提供服务的互联网产品,包含大鱼U服SAAS平台和大鱼师傅app。\n +1. 大鱼平台:大鱼平台是由北京大鱼创想科技有限公司(以下简称“本公司”或者“乙方”)开发的提供服务的互联网产品,包含大鱼云服SAAS平台和大鱼师傅app。\n 2. 大客户:是指服务需求的提供方,通过派遣服务单的方式提供服务需求给服务商,并对其服务进行验收的企业或个人。\n 3. 平台用户(以下简称“甲方”):平台用户是指签署本协议并有权使用大鱼平台服务人员账户的个人,包括且不限于服务师傅,店长和服务商管理员。\n 4. 最终用户:用户是指通过大鱼平台完成全部注册程序后,提出服务申请并享受相关服务的个人。\n @@ -937,7 +938,7 @@ C) 在甲方使用大鱼平台服务过程中产生的业务数据,客户数� <string name="user_bank_account">银行账号:</string> <string name="user_bank_account_hint">请输入银行账号</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_addr_info">快递地址信息</string> <string name="user_receiver_addr">收件地址:</string> diff --git a/baseSDK/src/main/res/values/styles.xml b/baseSDK/src/main/res/values/styles.xml index 954234a..98b9dfa 100755 --- a/baseSDK/src/main/res/values/styles.xml +++ b/baseSDK/src/main/res/values/styles.xml @@ -90,7 +90,7 @@ <item name="android:layout_height">35dp</item> <item name="android:padding">3dp</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> </style> diff --git a/build.gradle b/build.gradle index 2860e43..f537477 100755 --- a/build.gradle +++ b/build.gradle @@ -5,8 +5,8 @@ buildscript { ext.build_tools_version = "27.0.3" ext.min_sdk_version = 17 ext.target_sdk_version = 26 - ext.version_code = 259 - ext.verson_name = "2.5.9" + ext.version_code = 260 + ext.verson_name = "2.6.0" ext.gradle_version = '3.1.4' ext.isReleaseMinify = false ext.isDebugMinify = false diff --git a/learnCenter/src/main/java/com/dayu/learncenter/ui/activity/PrepareLiveActivity.java b/learnCenter/src/main/java/com/dayu/learncenter/ui/activity/PrepareLiveActivity.java index d8ce660..5f34800 100644 --- a/learnCenter/src/main/java/com/dayu/learncenter/ui/activity/PrepareLiveActivity.java +++ b/learnCenter/src/main/java/com/dayu/learncenter/ui/activity/PrepareLiveActivity.java @@ -74,7 +74,7 @@ public class PrepareLiveActivity extends BaseActivity<SImplePresenter, ActivityP private void initCover() { // String strCover = TCUserMgr.getInstance().getCoverPic(); 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); } else { mBind.ivCover.setImageResource(com.dayu.livemodule.R.drawable.publish_background); diff --git a/learnCenter/src/main/java/com/dayu/learncenter/ui/activity/VideoPlayActivity.java b/learnCenter/src/main/java/com/dayu/learncenter/ui/activity/VideoPlayActivity.java index ba5deaf..08cef4c 100644 --- a/learnCenter/src/main/java/com/dayu/learncenter/ui/activity/VideoPlayActivity.java +++ b/learnCenter/src/main/java/com/dayu/learncenter/ui/activity/VideoPlayActivity.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.text.TextUtils; import android.view.View; +import android.view.WindowManager; import android.widget.ImageView; import com.dayu.base.ui.activity.BaseActivity; @@ -32,6 +33,7 @@ public class VideoPlayActivity extends BaseActivity<SImplePresenter, ActivityVid @Override public int getLayoutId() { + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); return R.layout.activity_video_play; } diff --git a/learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/CommonLearnFragment.java b/learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/CommonLearnFragment.java index b72448a..198e2e1 100644 --- a/learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/CommonLearnFragment.java +++ b/learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/CommonLearnFragment.java @@ -186,7 +186,7 @@ public class CommonLearnFragment extends BaseFragment<CommonLearnPresenter, Frag addShareRecord(data); } else { 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); AddShareRecordData data = new AddShareRecordData(mUserId, mUserInfo.getAccountName(), "朋友圈", item.getId(), 1); diff --git a/learnCenter/src/main/res/layout/activity_prepare_live.xml b/learnCenter/src/main/res/layout/activity_prepare_live.xml index 2c5e2f1..d6a9f1d 100644 --- a/learnCenter/src/main/res/layout/activity_prepare_live.xml +++ b/learnCenter/src/main/res/layout/activity_prepare_live.xml @@ -26,6 +26,7 @@ </RelativeLayout> + <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content"> @@ -36,7 +37,6 @@ android:layout_height="200dp" android:onClick="onClick" android:background="@color/black" - android:scaleType="centerCrop" /> <TextView diff --git a/learnCenter/src/main/res/layout/item_common_learn.xml b/learnCenter/src/main/res/layout/item_common_learn.xml index 08abadc..b45ad6b 100644 --- a/learnCenter/src/main/res/layout/item_common_learn.xml +++ b/learnCenter/src/main/res/layout/item_common_learn.xml @@ -49,7 +49,7 @@ android:gravity="center" android:paddingLeft="15dp" android:paddingRight="15dp" - android:text="发布时间 2020-01-01" /> + android:text="发布时间 " /> <TextView android:id="@+id/tv_disable" diff --git a/liveModule/src/main/java/com/dayu/livemodule/MLVBLiveRoomImpl2.java b/liveModule/src/main/java/com/dayu/livemodule/MLVBLiveRoomImpl2.java index b797427..ada941b 100644 --- a/liveModule/src/main/java/com/dayu/livemodule/MLVBLiveRoomImpl2.java +++ b/liveModule/src/main/java/com/dayu/livemodule/MLVBLiveRoomImpl2.java @@ -57,67 +57,67 @@ import java.util.Vector; public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.HeartBeatCallback, IMMessageMgr.IMMessageListener { protected static final String TAG = MLVBLiveRoomImpl2.class.getName(); - protected static final int LIVEROOM_ROLE_NONE = 0; - protected static final int LIVEROOM_ROLE_PUSHER = 1; - protected static final int LIVEROOM_ROLE_PLAYER = 2; + protected static final int LIVEROOM_ROLE_NONE = 0; + protected static final int LIVEROOM_ROLE_PUSHER = 1; + protected static final int LIVEROOM_ROLE_PLAYER = 2; 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 IMLVBLiveRoomListener mListener = null; - protected int mSelfRoleType = LIVEROOM_ROLE_NONE; + protected Context mAppContext = null; + protected IMLVBLiveRoomListener mListener = null; + 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 Handler mListenerHandler = null; - protected HttpRequests mHttpRequest = null; //HTTP CGI请求相关 - protected IMMessageMgr mIMMessageMgr; //IM SDK相关 - protected LoginInfo mSelfAccountInfo; - protected StreamMixturer mStreamMixturer; //混流类 - protected HeartBeatThread mHeartBeatThread; //心跳 - protected String mCurrRoomID; - protected int mRoomStatusCode = 0; - protected ArrayList<RoomInfo> mRoomList = new ArrayList<>(); + protected TXLivePlayConfig mTXLivePlayConfig; + protected Handler mListenerHandler = null; + protected HttpRequests mHttpRequest = null; //HTTP CGI请求相关 + protected IMMessageMgr mIMMessageMgr; //IM SDK相关 + protected LoginInfo mSelfAccountInfo; + protected StreamMixturer mStreamMixturer; //混流类 + protected HeartBeatThread mHeartBeatThread; //心跳 + protected String mCurrRoomID; + protected int mRoomStatusCode = 0; + protected ArrayList<RoomInfo> mRoomList = new ArrayList<>(); protected TXLivePusher mTXLivePusher; - protected TXLivePushListenerImpl mTXLivePushListener; - protected String mSelfPushUrl; - protected String mSelfAccelerateURL; - protected HashMap<String, PlayerItem> mPlayers = new LinkedHashMap<>(); - protected HashMap<String, AnchorInfo> mPushers = new LinkedHashMap<>(); + protected TXLivePushListenerImpl mTXLivePushListener; + protected String mSelfPushUrl; + protected String mSelfAccelerateURL; + protected HashMap<String, PlayerItem> mPlayers = new LinkedHashMap<>(); + protected HashMap<String, AnchorInfo> mPushers = new LinkedHashMap<>(); private IMLVBLiveRoomListener.RequestJoinAnchorCallback mJoinAnchorCallback; - private Runnable mJoinAnchorTimeoutTask; + private Runnable mJoinAnchorTimeoutTask; private IMLVBLiveRoomListener.RequestRoomPKCallback mRequestPKCallback = null; - private Runnable mRequestPKTimeoutTask = null; - private AnchorInfo mPKAnchorInfo = null; + private Runnable mRequestPKTimeoutTask = 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 long mLastEnterAudienceTimeMS = 0; - private long mLastExitAudienceTimeMS = 0; + private static final int REFRESH_AUDIENCE_INTERVAL_MS = 2000; + private long mLastEnterAudienceTimeMS = 0; + private long mLastExitAudienceTimeMS = 0; //观众列表 private LinkedHashMap<String/*userID*/, AudienceInfo> mAudiences = null; - private static final int LIVEROOM_CAMERA_PREVIEW = 0; - private static final int LIVEROOM_SCREEN_PREVIEW = 1; - private int mPreviewType = LIVEROOM_CAMERA_PREVIEW; + private static final int LIVEROOM_CAMERA_PREVIEW = 0; + private static final int LIVEROOM_SCREEN_PREVIEW = 1; + private int mPreviewType = LIVEROOM_CAMERA_PREVIEW; - protected boolean mScreenAutoEnable = true; - private boolean mHasAddAnchor = false; + protected boolean mScreenAutoEnable = true; + private boolean mHasAddAnchor = false; - private static final int STREAM_MIX_MODE_JOIN_ANCHOR = 0; - private static final int STREAM_MIX_MODE_PK = 1; - private int mMixMode = STREAM_MIX_MODE_JOIN_ANCHOR; + private static final int STREAM_MIX_MODE_JOIN_ANCHOR = 0; + private static final int STREAM_MIX_MODE_PK = 1; + private int mMixMode = STREAM_MIX_MODE_JOIN_ANCHOR; - private long mTimeDiff = 0; //客户端和服务器时间差,用户连麦和PK请求超时处理 + private long mTimeDiff = 0; //客户端和服务器时间差,用户连麦和PK请求超时处理 private boolean isFrontCamera; @@ -141,7 +141,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 设置回调接口 - * + * <p> * 您可以通过 IMLVBLiveRoomListener 获得 MLVBLiveRoom 的各种状态通知 * * @param listener 回调接口 @@ -278,7 +278,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 获取房间列表 - * + * <p> * 该接口支持分页获取房间列表,可以用 index 和 count 两个参数控制列表分页的逻辑, * - index = 0 & count = 10 代表获取第一页的10个房间。 * - index = 11 & count = 10 代表获取第二页的10个房间。 @@ -298,9 +298,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear mHttpRequest.getRoomList(index, count, new HttpRequests.OnResponseCallback<HttpResponse.RoomList>() { @Override 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 + "]"); - }else { + } else { final ArrayList<RoomInfo> arrayList = new ArrayList<>(data.rooms.size()); arrayList.addAll(data.rooms); mRoomList = arrayList; @@ -312,7 +312,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 获取观众列表 - * + * <p> * 当有观众进房时,后台会将其信息加入到指定房间的观众列表中,调入该函数即可返回指定房间的观众列表 * * @param callback 获取观众列表的结果回调。 @@ -320,7 +320,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear */ @Override 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) { callbackOnThread(callback, "onError", MLVBCommonDef.LiveRoomErrorCode.ERROR_NOT_IN_ROOM, "[LiveRoom] getAudienceList 失败[房间号为空]"); return; @@ -360,7 +360,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 创建房间(主播调用) - * + * <p> * 主播开播的正常调用流程是: * 1.【主播】调用 startLocalPreview() 打开摄像头预览,此时可以调整美颜参数。 * 2.【主播】调用 createRoom 创建直播间,房间创建成功与否会通过 {@link IMLVBLiveRoomListener.CreateRoomCallback} 通知给主播。 @@ -383,12 +383,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear public void onResponse(int retcode, String retmsg, HttpResponse.PushUrl data) { if (retcode == HttpResponse.CODE_OK && data != null && data.pushURL != null) { // 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; mSelfAccelerateURL = data.accelerateURL; - TXCLog.i(TAG, "API -> createRoom push url:" +pushURL); - TXCLog.i(TAG, "API -> createRoom push url2:" +data.pushURL); + TXCLog.i(TAG, "API -> createRoom push url:" + pushURL); + TXCLog.i(TAG, "API -> createRoom push url2:" + data.pushURL); //3.开始推流 startPushStream(pushURL, TXLiveConstants.VIDEO_QUALITY_HIGH_DEFINITION, new StandardCallback() { @@ -410,14 +410,14 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear mTXLivePusher.setConfig(config); } - EventBus.getDefault().post(new StartPushEvent(true,mSelfPushUrl,roomInfo)); + EventBus.getDefault().post(new StartPushEvent(true, mSelfPushUrl, roomInfo)); mBackground = false; //4.推流成功,请求CGI:create_room,获取roomID、roomSig String mRoomInfo = roomInfo; - if (!TextUtils.isEmpty(mRoomInfo)){ + if (!TextUtils.isEmpty(mRoomInfo)) { try { JSONObject jsonRoomInfo = new JSONObject(mRoomInfo); - jsonRoomInfo.put("playurl",data.playUrl); + jsonRoomInfo.put("playurl", data.playUrl); mRoomInfo = jsonRoomInfo.toString(); } catch (JSONException e) { e.printStackTrace(); @@ -472,8 +472,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } }); - } - else { + } else { callbackOnThread(callback, "onError", retcode, "[LiveRoom] 创建房间失败[获取推流地址失败]"); } } @@ -482,7 +481,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 进入房间(观众调用) - * + * <p> * 观众观看直播的正常调用流程是: * 1.【观众】调用 getRoomList() 刷新最新的直播房间列表,并通过 {@link IMLVBLiveRoomListener.GetRoomListCallback} 回调拿到房间列表。 * 2.【观众】选择一个直播间以后,调用 enterRoom() 进入该房间。 @@ -523,7 +522,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear int playType = getPlayType(mixedPlayUrl); mTXLivePlayer.setPlayerView(view); mTXLivePlayer.startPlay(mixedPlayUrl, playType); - TXCLog.i(TAG, "startPlay "+mixedPlayUrl+" "+playType); + TXCLog.i(TAG, "startPlay " + mixedPlayUrl + " " + playType); if (mHttpRequest != null) { String userInfo = ""; @@ -538,7 +537,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear mHttpRequest.addAudience(roomID, mSelfAccountInfo.userID, userInfo, new HttpRequests.OnResponseCallback<HttpResponse>() { @Override 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 mJoinPusher = false; mSelfRoleType = LIVEROOM_ROLE_NONE; - mCurrRoomID = ""; + mCurrRoomID = ""; mPushers.clear(); mStreamMixturer.resetMergeState(); @@ -669,16 +668,15 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 设置自定义信息 - * + * <p> * 有时候您可能需要为房间产生一些额外的信息,此接口可以将这些信息缓存到服务器。 * - * @param op 执行动作,定义请查看 {@link MLVBCommonDef.CustomFieldOp} - * @param key 自定义键 + * @param op 执行动作,定义请查看 {@link MLVBCommonDef.CustomFieldOp} + * @param key 自定义键 * @param value 数值 - * * @note op 为 {@link MLVBCommonDef.CustomFieldOp#SET} 时,value 可以是 String 或者 Integer 类型 - * op 为 {@link MLVBCommonDef.CustomFieldOp#INC} 时,value 是 Integer 类型 - * op 为 {@link MLVBCommonDef.CustomFieldOp#DEC} 时,value 是 Integer 类型 + * op 为 {@link MLVBCommonDef.CustomFieldOp#INC} 时,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) { TXCLog.i(TAG, "API -> setCustomInfo:" + op + ":" + key); @@ -734,7 +732,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 观众请求连麦 - * + * <p> * 主播和观众的连麦流程可以简单描述为如下几个步骤: * 1. 【观众】调用 requestJoinAnchor() 向主播发起连麦请求。 * 2. 【主播】会收到 {@link IMLVBLiveRoomListener#onRequestJoinAnchor(AnchorInfo, String)} 的回调通知。 @@ -789,7 +787,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear //10秒收不到主播同意/拒绝连麦的响应,则回调超时 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); IMMessageMgr imMessageMgr = mIMMessageMgr; if (imMessageMgr != null) { @@ -814,21 +813,19 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear }); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } /** * 主播处理连麦请求 - * + * <p> * 主播在收到 {@link IMLVBLiveRoomListener#onRequestJoinAnchor(AnchorInfo, String)} 回调之后会需要调用此接口来处理观众的连麦请求。 * * @param userID 观众ID * @param agree true:同意;false:拒绝 * @param reason 同意/拒绝连麦的原因描述 - * * @return 0:响应成功;非0:响应失败 */ @Override @@ -846,11 +843,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear response.cmd = "linkmic"; response.data = new JoinAnchorResponse(); response.data.type = "response"; - response.data.result = agree?"accept":"reject"; + response.data.result = agree ? "accept" : "reject"; response.data.reason = reason; response.data.roomID = mCurrRoomID; 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; if (imMessageMgr != null) { imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() { @@ -865,8 +863,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } }); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } return 0; @@ -874,13 +871,13 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 观众进入连麦状态 - * + * <p> * 进入连麦成功后,主播和其他连麦观众会收到 {@link IMLVBLiveRoomListener#onAnchorEnter(AnchorInfo)} 通知 * * @param callback 进入连麦的结果回调 */ @Override - public void joinAnchor(String roomInfo,final IMLVBLiveRoomListener.JoinAnchorCallback callback) { + public void joinAnchor(String roomInfo, final IMLVBLiveRoomListener.JoinAnchorCallback callback) { TXCLog.i(TAG, "API -> joinAnchor"); if (mCurrRoomID == null || mCurrRoomID.length() == 0) { callbackOnThread(callback, "onError", MLVBCommonDef.LiveRoomErrorCode.ERROR_NOT_IN_ROOM, "[LiveRoom] 观众进入连麦失败[房间号为空,请确认是否已经进房]"); @@ -914,12 +911,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear // mSelfPushUrl = data.pushURL; // 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; mSelfAccelerateURL = data.accelerateURL; - 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 url:" + pushURL); + TXCLog.i(TAG, "API -> createRoom push join url2:" + data.pushURL + " " + roomInfo); //5. 开始推流 startPushStream(pushURL, TXLiveConstants.VIDEO_QUALITY_LINKMIC_SUB_PUBLISHER, new StandardCallback() { @@ -931,7 +928,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear @Override public void onSuccess() { mBackground = false; - EventBus.getDefault().post(new StartPushEvent(false,mSelfPushUrl,roomInfo)); + EventBus.getDefault().post(new StartPushEvent(false, mSelfPushUrl, roomInfo)); //6. 推流成功,请求CGI:add_pusher,把自己加入房间成员列表 addAnchor(mCurrRoomID, data.pushURL, new StandardCallback() { @Override @@ -960,7 +957,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 观众退出连麦 - * + * <p> * 退出连麦成功后,主播和其他连麦观众会收到 {@link IMLVBLiveRoomListener#onAnchorExit(AnchorInfo)} 通知 * * @param callback 退出连麦的结果回调 @@ -1027,7 +1024,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 主播踢除连麦观众 - * + * <p> * 主播调用此接口踢除连麦观众后,被踢连麦观众会收到 {@link IMLVBLiveRoomListener#onKickoutJoinAnchor()} 回调通知 * * @param userID 连麦观众ID @@ -1043,30 +1040,30 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear response.data.type = "kickout"; response.data.roomID = mCurrRoomID; 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; if (imMessageMgr != null) { imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() { - @Override - public void onError(final int code, final String errInfo) { + @Override + public void onError(final int code, final String errInfo) { - } + } - @Override - public void onSuccess(Object... args) { + @Override + public void onSuccess(Object... args) { - } - }); + } + }); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } /** * 请求跨房PK - * + * <p> * 主播和主播之间可以跨房间 PK,两个正在直播中的主播 A 和 B,他们之间的跨房 PK 流程如下: * 1. 【主播 A】调用 requestRoomPK() 向主播 B 发起连麦请求。 * 2. 【主播 B】会收到 {@link IMLVBLiveRoomListener#onRequestRoomPK(AnchorInfo)} 回调通知。 @@ -1120,7 +1117,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear 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; if (imMessageMgr != null) { imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() { @@ -1135,21 +1133,19 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } }); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } /** * 响应跨房 PK 请求 - * + * <p> * 主播响应其他房间主播的 PK 请求,发起 PK 请求的主播会收到 {@link IMLVBLiveRoomListener.RequestRoomPKCallback} 回调通知。 * * @param userID 发起 PK 请求的主播 ID * @param agree true:同意;false:拒绝 * @param reason 同意/拒绝PK的原因描述 - * * @return 0:响应成功;非0:响应失败 */ @Override @@ -1167,29 +1163,29 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear response.cmd = "pk"; response.data = new PKResponse(); response.data.type = "response"; - response.data.result = agree?"accept":"reject"; - response.data.reason= reason; + response.data.result = agree ? "accept" : "reject"; + response.data.reason = reason; response.data.roomID = mCurrRoomID; response.data.accelerateURL = mSelfAccelerateURL; 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; if (imMessageMgr != null) { imMessageMgr.sendC2CCustomMessage(userID, content, new IMMessageMgr.Callback() { - @Override - public void onError(final int code, final String errInfo) { + @Override + public void onError(final int code, final String errInfo) { - } + } - @Override - public void onSuccess(Object... args) { + @Override + public void onSuccess(Object... args) { - } - }); + } + }); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } return 0; @@ -1197,7 +1193,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 退出跨房 PK - * + * <p> * 当两个主播中的任何一个退出跨房 PK 状态后,另一个主播会收到 {@link IMLVBLiveRoomListener#onQuitRoomPK(AnchorInfo)} 回调通知。 * * @param callback 退出跨房 PK 的结果回调 @@ -1219,26 +1215,26 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear request.data.accelerateURL = ""; 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; if (imMessageMgr != null) { imMessageMgr.sendC2CCustomMessage(mPKAnchorInfo.userID, content, new IMMessageMgr.Callback() { - @Override - public void onError(final int code, final String errInfo) { - callbackOnThread(callback, "onError", code, "[IM] 退出PK失败[" + errInfo + ":" + code + "]"); - } + @Override + public void onError(final int code, final String errInfo) { + callbackOnThread(callback, "onError", code, "[IM] 退出PK失败[" + errInfo + ":" + code + "]"); + } - @Override - public void onSuccess(Object... args) { - callbackOnThread(callback, "onSuccess"); - } - }); + @Override + public void onSuccess(Object... args) { + callbackOnThread(callback, "onSuccess"); + } + }); } } else { TXCLog.e(TAG, "获取不到 PK 主播信息,请确认是否已经跨房 PK"); } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -1282,7 +1278,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear * @param anchorInfo 对方的用户信息 * @param view 承载视频画面的控件 * @param callback 播放器监听器 - * * @note 在 onUserVideoAvailable 回调时,调用这个接口 */ @Override @@ -1312,7 +1307,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear mTXLivePusher.setVideoQuality(TXLiveConstants.VIDEO_QUALITY_LINKMIC_MAIN_PUBLISHER, true, true); TXLivePushConfig config = mTXLivePusher.getConfig(); // 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.setVideoBitrate(800); mTXLivePusher.setConfig(config); @@ -1347,8 +1342,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } } 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) + "]"); //结束播放 @@ -1358,8 +1352,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear // item.destroy(); // } // } - } - else { + } else { callbackOnThread(callback, "onEvent", event, param); } } @@ -1371,7 +1364,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear }); 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)); } } @@ -1393,7 +1386,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear handler.post(new Runnable() { @Override public void run() { - if (mPlayers.containsKey(anchorInfo.userID)){ + if (mPlayers.containsKey(anchorInfo.userID)) { PlayerItem pusherPlayer = mPlayers.remove(anchorInfo.userID); pusherPlayer.destroy(); } @@ -1425,7 +1418,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 启动录屏。 - * */ public synchronized void startScreenCapture() { TXCLog.i(TAG, "API -> startScreenCapture"); @@ -1438,7 +1430,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 结束录屏。 - * */ public synchronized void stopScreenCapture() { TXCLog.i(TAG, "API -> stopScreenCapture"); @@ -1478,7 +1469,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear */ @Override public void muteRemoteAudio(String userID, boolean mute) { - if (mPlayers.containsKey(userID)){ + if (mPlayers.containsKey(userID)) { PlayerItem pusherPlayer = mPlayers.get(userID); pusherPlayer.player.setMute(mute); } else if (userID == getRoomCreator(mCurrRoomID)) { @@ -1508,7 +1499,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear @Override public void switchCamera() { if (mTXLivePusher != null) { - isFrontCamera = ! isFrontCamera; + isFrontCamera = !isFrontCamera; mTXLivePusher.setMirror(isFrontCamera); mTXLivePusher.switchCamera(); } @@ -1518,7 +1509,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear * 设置摄像头缩放因子(焦距) * * @param distance 取值范围 1 - 5 ,当为1的时候为最远视角(正常镜头),当为5的时候为最近视角(放大镜头),这里最大值推荐为5,超过5后视频数据会变得模糊不清 - * * @return false:调用失败;true:调用成功 */ @Override @@ -1533,7 +1523,6 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear * 开关闪光灯 * * @param enable true:开启;false:关闭 - * * @return false:调用失败;true:调用成功 */ @Override @@ -1546,7 +1535,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 主播屏蔽摄像头期间需要显示的等待图片 - * + * <p> * 当主播屏蔽摄像头,或者由于 App 切入后台无法使用摄像头的时候,我们需要使用一张等待图片来提示观众“主播暂时离开,请不要走开”。 * * @param bitmap 位图 @@ -1563,7 +1552,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 主播屏蔽摄像头期间需要显示的等待图片 - * + * <p> * 当主播屏蔽摄像头,或者由于 App 切入后台无法使用摄像头的时候,我们需要使用一张等待图片来提示观众“主播暂时离开,请不要走开”。 * * @param id 设置默认显示图片的资源文件 @@ -1630,10 +1619,10 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 添加水印,height 不用设置,sdk 内部会根据水印宽高比自动计算 height * - * @param image 水印图片 null 表示清除水印 - * @param x 归一化水印位置的 X 轴坐标,取值[0,1] - * @param y 归一化水印位置的 Y 轴坐标,取值[0,1] - * @param width 归一化水印宽度,取值[0,1] + * @param image 水印图片 null 表示清除水印 + * @param x 归一化水印位置的 X 轴坐标,取值[0,1] + * @param y 归一化水印位置的 Y 轴坐标,取值[0,1] + * @param width 归一化水印宽度,取值[0,1] */ @Override public void setWatermark(Bitmap image, float x, float y, float width) { @@ -1658,13 +1647,12 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 设置绿幕文件 - * + * <p> * 目前图片支持jpg/png,视频支持mp4/3gp等Android系统支持的格式 * * @param file 绿幕文件位置,支持两种方式: * 1.资源文件放在assets目录,path直接取文件名 * 2.path取文件绝对路径 - * * @return false:调用失败;true:调用成功 * @note API要求18 */ @@ -1763,7 +1751,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 发送文本消息 * - * @param message 文本消息 + * @param message 文本消息 * @param callback 发送消息的结果回调 * @see {@link IMLVBLiveRoomListener#onRecvRoomTextMsg(String, String, String, String, String)} */ @@ -1790,8 +1778,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 发送自定义文本消息 * - * @param cmd 命令字,由开发者自定义,主要用于区分不同消息类型 - * @param message 文本消息 + * @param cmd 命令字,由开发者自定义,主要用于区分不同消息类型 + * @param message 文本消息 * @param callback 发送消息的结果回调 * @see {@link IMLVBLiveRoomListener#onRecvRoomCustomMsg(String, String, String, String, String, String)} */ @@ -1803,8 +1791,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear customMessage.data.userName = mSelfAccountInfo.userName; customMessage.data.userAvatar = mSelfAccountInfo.userAvatar; customMessage.data.cmd = cmd; - customMessage.data.msg = message ; - final String content = new Gson().toJson(customMessage, new TypeToken<CommonJson<CustomMessage>>(){}.getType()); + customMessage.data.msg = message; + final String content = new Gson().toJson(customMessage, new TypeToken<CommonJson<CustomMessage>>() { + }.getType()); IMMessageMgr imMessageMgr = mIMMessageMgr; if (imMessageMgr != null) { imMessageMgr.sendGroupCustomMessage(content, new IMMessageMgr.Callback() { @@ -1889,7 +1878,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear @Override public void setMicVolumeOnMixing(int volume) { 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 @Override public void setBGMVolume(int volume) { 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 * 设置混响效果 * * @param reverbType 混响类型,详见 - * {@link TXLiveConstants#REVERB_TYPE_0 } (关闭混响) - * {@link TXLiveConstants#REVERB_TYPE_1 } (KTV) - * {@link TXLiveConstants#REVERB_TYPE_2 } (小房间) - * {@link TXLiveConstants#REVERB_TYPE_3 } (大会堂) - * {@link TXLiveConstants#REVERB_TYPE_4 } (低沉) - * {@link TXLiveConstants#REVERB_TYPE_5 } (洪亮) - * {@link TXLiveConstants#REVERB_TYPE_6 } (磁性) + * {@link TXLiveConstants#REVERB_TYPE_0 } (关闭混响) + * {@link TXLiveConstants#REVERB_TYPE_1 } (KTV) + * {@link TXLiveConstants#REVERB_TYPE_2 } (小房间) + * {@link TXLiveConstants#REVERB_TYPE_3 } (大会堂) + * {@link TXLiveConstants#REVERB_TYPE_4 } (低沉) + * {@link TXLiveConstants#REVERB_TYPE_5 } (洪亮) + * {@link TXLiveConstants#REVERB_TYPE_6 } (磁性) */ @Override public void setReverbType(int reverbType) { @@ -1938,7 +1927,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 设置背景音乐的音调。 - * + * <p> * 该接口用于混音处理,比如将背景音乐与麦克风采集到的声音混合后播放。 * * @param pitch 音调,0为正常音量,范围是 -1 - 1。 @@ -1952,12 +1941,10 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear /** * 指定背景音乐的播放位置 * - * @note 请尽量避免频繁地调用该接口,因为该接口可能会再次读写 BGM 文件,耗时稍高。 - * 例如:当配合进度条使用时,请在进度条拖动完毕的回调中调用,而避免在拖动过程中实时调用。 - * * @param position 背景音乐的播放位置,单位ms。 - * * @return 结果是否成功,true:成功;false:失败。 + * @note 请尽量避免频繁地调用该接口,因为该接口可能会再次读写 BGM 文件,耗时稍高。 + * 例如:当配合进度条使用时,请在进度条拖动完毕的回调中调用,而避免在拖动过程中实时调用。 */ public boolean setBGMPosition(int position) { if (mTXLivePusher != null) { @@ -1999,7 +1986,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear if (ratio > 1.3f) { mTXLivePlayer.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN); } 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 } - - 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.post(new Runnable() { @@ -2031,18 +2019,20 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear if (ret == -5) { String msg = "[LiveRoom] 推流失败[license 校验失败]"; 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 { String msg = "[LiveRoom] 推流失败[TXLivePusher未初始化,请确保已经调用startLocalPreview]"; 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, new HttpRequests.OnResponseCallback<HttpResponse.CreateRoom>() { @Override @@ -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; if (imMessageMgr != null) { imMessageMgr.jionGroup(roomID, new IMMessageMgr.Callback() { @@ -2125,7 +2115,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear msg.cmd = "notifyPusherChange"; msg.data = new AnchorInfo(); 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; if (imMessageMgr != null) { imMessageMgr.sendGroupCustomMessage(content, new IMMessageMgr.Callback() { @@ -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>() { @Override public void onResponse(final int retcode, String retmsg, final HttpResponse.PusherList data) { @@ -2251,8 +2242,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } mPushers = mergedAnchors; - } - else { + } else { TXCLog.e(TAG, "更新主播列表返回空数据"); if (callback != null) { callback.onUpdateAnchors(-1, null, null, null, null); @@ -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 (delAnchors != null) { @@ -2274,7 +2264,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } 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 (addAnchors != null) { addAnchors.add(member); @@ -2322,7 +2312,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } protected String getRoomCreator(String roomID) { - for (RoomInfo item: mRoomList) { + for (RoomInfo item : mRoomList) { if (roomID.equalsIgnoreCase(item.roomID)) { return item.roomCreator; } @@ -2459,8 +2449,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } return; } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -2508,8 +2497,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } }); return; - } - else if (result.equalsIgnoreCase("reject")) { + } else if (result.equalsIgnoreCase("reject")) { callbackOnThread(new Runnable() { @Override public void run() { @@ -2533,8 +2521,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear }); return; } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -2569,6 +2556,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear // IMMessageMgr.IMMessageListener // ////////////////////////////////////////// + /** * IM连接成功 */ @@ -2625,7 +2613,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear */ @Override 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); } @@ -2640,8 +2628,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear public void onC2CCustomMessage(String sendID, String cmd, String message) { if (cmd.equalsIgnoreCase("linkmic")) { onRecvLinkMicMessage(message); - } - else if (cmd.equalsIgnoreCase("pk")) { + } else if (cmd.equalsIgnoreCase("pk")) { onRecvPKMessage(message); } } @@ -2719,17 +2706,17 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } private class StreamMixturer { - private String mMainStreamId = ""; - private String mPKStreamId = ""; + private String mMainStreamId = ""; + private String mPKStreamId = ""; private Vector<String> mSubStreamIds = new Vector<String>(); - private int mMainStreamWidth = 540; - private int mMainStreamHeight = 960; + private int mMainStreamWidth = 960; + private int mMainStreamHeight = 540; public StreamMixturer() { } - public void setMainVideoStream(String streamUrl) { + public void setMainVideoStream(String streamUrl) { mMainStreamId = getStreamIDByStreamUrl(streamUrl); Log.e(TAG, "MergeVideoStream: setMainVideoStream " + mMainStreamId); @@ -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) { return; } @@ -2755,7 +2742,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear return; } - for (String item: mSubStreamIds) { + for (String item : mSubStreamIds) { if (item.equalsIgnoreCase(streamId)) { return; } @@ -2765,13 +2752,13 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear sendStreamMergeRequest(5); } - public void delSubVideoStream(String streamUrl) { + public void delSubVideoStream(String streamUrl) { String streamId = getStreamIDByStreamUrl(streamUrl); Log.e(TAG, "MergeVideoStream: delSubVideoStream " + streamId); boolean bExist = false; - for (String item: mSubStreamIds) { + for (String item : mSubStreamIds) { if (item.equalsIgnoreCase(streamId)) { bExist = true; break; @@ -2822,9 +2809,9 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear mSubStreamIds.clear(); mMainStreamId = null; - mPKStreamId = null; - mMainStreamWidth = 540; - mMainStreamHeight = 960; + mPKStreamId = null; + mMainStreamWidth = 960; + mMainStreamHeight = 540; } private void sendStreamMergeRequest(final int retryCount) { @@ -2847,8 +2834,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear if (runImmediately == false) { try { sleep(2000, 0); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -2867,8 +2853,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear if (result != null && result.code == 0 && result.merge_code == 0) { return; - } - else { + } else { int tempRetryIndex = retryIndex - 1; if (tempRetryIndex > 0) { internalSendRequest(tempRetryIndex, false, requestParam); @@ -2958,22 +2943,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear JSONObject layoutParam = new JSONObject(); layoutParam.put("image_layer", 2); - if (mSubStreamIds.size()>0){ - layoutParam.put("image_width", 960); - 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("image_width", 960); + layoutParam.put("image_height", 540); layoutParam.put("location_x", 0); layoutParam.put("location_y", 0); @@ -2992,8 +2963,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear layoutParam.put("location_y", 0); JSONObject cropParam = new JSONObject(); - cropParam.put("crop_width", 240); - cropParam.put("crop_height", 270); + cropParam.put("crop_width", 280); + cropParam.put("crop_height", 320); cropParam.put("crop_x", 0); cropParam.put("crop_y", 0); @@ -3023,8 +2994,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear requestParam.put("timestamp", System.currentTimeMillis() / 1000); requestParam.put("eventId", System.currentTimeMillis() / 1000); requestParam.put("interface", interfaceObj); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } @@ -3043,7 +3013,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear // input_stream_list JSONArray inputStreamList = new JSONArray(); - if (mPKStreamId != null && mPKStreamId.length() > 0){ + if (mPKStreamId != null && mPKStreamId.length() > 0) { // 画布 { JSONObject layoutParam = new JSONObject(); @@ -3090,8 +3060,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear inputStreamList.put(mainStream); } - } - else { + } else { JSONObject layoutParam = new JSONObject(); layoutParam.put("image_layer", 1); @@ -3120,8 +3089,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear requestParam.put("timestamp", System.currentTimeMillis() / 1000); requestParam.put("eventId", System.currentTimeMillis() / 1000); requestParam.put("interface", interfaceObj); - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } @@ -3201,11 +3169,11 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } }; - public void startHeartbeat(){ + public void startHeartbeat() { synchronized (this) { if (handler != null && handler.getLooper() != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { - handler.getLooper().quitSafely(); + handler.getLooper().quitSafely(); } else { handler.getLooper().quit(); } @@ -3217,7 +3185,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear } } - public void stopHeartbeat(){ + public void stopHeartbeat() { synchronized (this) { if (handler != null) { handler.removeCallbacks(heartBeatRunnable); @@ -3254,11 +3222,11 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear callbackOnThread(mCallback, "onError", event, msg); } else if (event == TXLiveConstants.PUSH_ERR_NET_DISCONNECT || event == TXLiveConstants.PUSH_ERR_INVALID_ADDRESS) { String msg = "[LivePusher] 推流失败[网络断开]"; - TXCLog.e(TAG,msg); + TXCLog.e(TAG, msg); callbackOnThread(mCallback, "onError", event, msg); } else if (event == TXLiveConstants.PUSH_ERR_SCREEN_CAPTURE_START_FAILED) { String msg = "[LivePusher] 推流失败[录屏启动失败]"; - TXCLog.e(TAG,msg); + TXCLog.e(TAG, msg); callbackOnThread(mCallback, "onError", event, msg); } } @@ -3309,10 +3277,10 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear }); } - private class PlayerItem { + private class PlayerItem { public TXCloudVideoView view; - public AnchorInfo anchorInfo; - public TXLivePlayer player; + public AnchorInfo anchorInfo; + public TXLivePlayer player; public PlayerItem(TXCloudVideoView view, AnchorInfo anchorInfo, TXLivePlayer player) { this.view = view; @@ -3320,15 +3288,15 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear this.player = player; } - public void resume(){ + public void resume() { this.player.resume(); } - public void pause(){ + public void pause() { this.player.pause(); } - public void destroy(){ + public void destroy() { this.player.stopPlay(true); this.view.onDestroy(); } @@ -3336,7 +3304,8 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear protected class CommonJson<T> { public String cmd; - public T data; + public T data; + public CommonJson() { } } @@ -3385,7 +3354,7 @@ public class MLVBLiveRoomImpl2 extends MLVBLiveRoom implements HttpRequests.Hear public long timestamp; } - protected class CustomMessage{ + protected class CustomMessage { public String userName; public String userAvatar; public String cmd; diff --git a/liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/anchor/TCCameraAnchorActivity2.java b/liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/anchor/TCCameraAnchorActivity2.java index 7ae7da8..49609e0 100644 --- a/liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/anchor/TCCameraAnchorActivity2.java +++ b/liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/anchor/TCCameraAnchorActivity2.java @@ -500,6 +500,15 @@ public class TCCameraAnchorActivity2 extends TCBaseAnchorActivity { */ @Override 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(); if (i == R.id.switch_cam) { if (mLiveRoom != null) { diff --git a/liveModule/src/main/res/layout/activity_audience2.xml b/liveModule/src/main/res/layout/activity_audience2.xml index ffe664f..8009028 100644 --- a/liveModule/src/main/res/layout/activity_audience2.xml +++ b/liveModule/src/main/res/layout/activity_audience2.xml @@ -399,7 +399,7 @@ <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginRight="15dp" + android:layout_marginRight="125dp" android:layout_marginBottom="10dp"> <com.dayu.livemodule.xiaozhibo.common.widget.like.TCHeartLayout diff --git a/liveModule/src/main/res/layout/activity_camera_anchor2.xml b/liveModule/src/main/res/layout/activity_camera_anchor2.xml index 3801e22..be87549 100644 --- a/liveModule/src/main/res/layout/activity_camera_anchor2.xml +++ b/liveModule/src/main/res/layout/activity_camera_anchor2.xml @@ -328,16 +328,23 @@ android:stackFromBottom="true" 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 android:id="@+id/anchor_audio_control" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:background="#ffffff" android:clickable="true" android:orientation="vertical" android:padding="0dp" android:visibility="gone" /> + </ScrollView> <com.tencent.liteav.demo.beauty.BeautyPanel android:id="@+id/beauty_panel" @@ -420,6 +427,7 @@ <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_marginRight="20dp" android:layout_marginBottom="10dp"> <com.dayu.livemodule.xiaozhibo.common.widget.like.TCHeartLayout diff --git a/liveModule/src/main/res/layout/audio_ctrl2.xml b/liveModule/src/main/res/layout/audio_ctrl2.xml new file mode 100644 index 0000000..ff64b53 --- /dev/null +++ b/liveModule/src/main/res/layout/audio_ctrl2.xml @@ -0,0 +1,539 @@ +<?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 diff --git a/liveModule/src/main/res/layout/dialog_input_text2.xml b/liveModule/src/main/res/layout/dialog_input_text2.xml new file mode 100644 index 0000000..8e47eea --- /dev/null +++ b/liveModule/src/main/res/layout/dialog_input_text2.xml @@ -0,0 +1,80 @@ +<?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 diff --git a/orderCenter/src/main/java/com/dayu/order/api/OrderService.java b/orderCenter/src/main/java/com/dayu/order/api/OrderService.java index ed258eb..266d5ab 100644 --- a/orderCenter/src/main/java/com/dayu/order/api/OrderService.java +++ b/orderCenter/src/main/java/com/dayu/order/api/OrderService.java @@ -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.ServiceStationBean; 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.SendPartData; import com.dayu.order.common.OrderConstant; @@ -490,4 +491,10 @@ public interface OrderService { */ @GET(Constants.API_7200+"/ordersLogistics/{id}") Observable<BaseResponse<OrderPardDeatilBean>> getPartDetail(@Path("id") int id); + + /** + * 拨打电话记录 + */ + @POST(Constants.API_7200+"/orderDialRecord") + Observable<BaseResponse<Boolean>> addDialRecord(@Body AddDialRecordData data); } diff --git a/orderCenter/src/main/java/com/dayu/order/api/protocol/data/AddDialRecordData.java b/orderCenter/src/main/java/com/dayu/order/api/protocol/data/AddDialRecordData.java new file mode 100644 index 0000000..154d377 --- /dev/null +++ b/orderCenter/src/main/java/com/dayu/order/api/protocol/data/AddDialRecordData.java @@ -0,0 +1,70 @@ +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; + } +} diff --git a/orderCenter/src/main/java/com/dayu/order/presenter/orderdoing/OrderDoingPresenter.java b/orderCenter/src/main/java/com/dayu/order/presenter/orderdoing/OrderDoingPresenter.java index 8a75788..0f69daf 100644 --- a/orderCenter/src/main/java/com/dayu/order/presenter/orderdoing/OrderDoingPresenter.java +++ b/orderCenter/src/main/java/com/dayu/order/presenter/orderdoing/OrderDoingPresenter.java @@ -3,13 +3,16 @@ package com.dayu.order.presenter.orderdoing; import android.databinding.ObservableField; import android.os.Bundle; +import com.dayu.base.api.Api; import com.dayu.common.BaseApplication; import com.dayu.common.Constants; import com.dayu.event.UserInfo; import com.dayu.order.R; 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.Spu; +import com.dayu.order.api.protocol.data.AddDialRecordData; import com.dayu.order.common.OrderConstant; import com.dayu.order.ui.activity.MultiProcessOrderActivity; import com.dayu.order.ui.activity.OrderDetailsActivity; @@ -21,6 +24,7 @@ import com.dayu.provider.event.RefreshTab; import com.dayu.utils.AppManager; import com.dayu.utils.ToastUtils; import com.dayu.utils.UserManager; +import com.dayu.utils.UtilsDate; import com.dayu.widgets.CustomDialog; import com.megvii.idcardlib.util.ConUtil; import com.megvii.licensemanager.Manager; @@ -49,10 +53,11 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter { private int mSiteId; private int mState; private int mPage; + UserInfo userInfo; @Override public void onAttached() { - UserInfo userInfo = UserManager.getInstance().getUser(); + userInfo = UserManager.getInstance().getUser(); mUserId = Integer.parseInt(userInfo.getAccountId()); mSiteId = userInfo.getSiteId(); mState = mView.getState(); @@ -207,4 +212,10 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter { public void 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(); + } } diff --git a/orderCenter/src/main/java/com/dayu/order/ui/adapter/OrderAdapter.java b/orderCenter/src/main/java/com/dayu/order/ui/adapter/OrderAdapter.java index f2fa5e6..4e94ea4 100755 --- a/orderCenter/src/main/java/com/dayu/order/ui/adapter/OrderAdapter.java +++ b/orderCenter/src/main/java/com/dayu/order/ui/adapter/OrderAdapter.java @@ -30,7 +30,6 @@ import com.dayu.provider.event.RefreshServe; import com.dayu.provider.event.RefreshTab; import com.dayu.provider.router.RouterPath; import com.dayu.utils.CommonUtils; -import com.dayu.utils.LogUtils; import com.dayu.utils.ProgressUtil; import com.dayu.utils.SPUtils; import com.dayu.utils.UIUtils; @@ -41,9 +40,7 @@ import com.umeng.analytics.MobclickAgent; import org.greenrobot.eventbus.EventBus; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -234,6 +231,7 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi holder.tvSettlementDate.setTextColor(mContext.getResources().getColor(R.color.common_text_color)); } holder.tvSettlementPrice.setText(CommonUtils.getMoneyStr(mContext,item.getSettlementPrice())); + holder.tvSettlementDate.setText(CommonUtils.getYearData(item.getSettlementDate())); time = item.getConfirmDoorTime(); break; @@ -296,11 +294,11 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi if (item.getStatus() != 1) { holder.itemTextPhone.setOnClickListener(v -> { 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())){ - takePhone(item.getCustomerTelphome()); + takePhone(item.getCustomerTelphome(),item.getId()); }else if (!TextUtils.isEmpty(item.getCustomerMobile())){ - takePhone(item.getCustomerMobile()); + takePhone(item.getCustomerMobile(),item.getId()); } Map<String, String> map_ekv = new HashMap<>(); if (item.getStatus() == 2) { @@ -531,12 +529,12 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi customDialog.show(); } - private void showMoblieDialog(String mobile, String tel) { + private void showMoblieDialog(String mobile, String tel, int id) { List<String> list = new ArrayList<>(); list.add(mobile); list.add(tel); OptionsPickerView pvOptions = new OptionsPickerBuilder(mContext, - (options1, options2, options3, v) -> takePhone(list.get(options1))) + (options1, options2, options3, v) -> takePhone(list.get(options1),id)) .setContentTextSize(20) .setLineSpacingMultiplier(2.0f) .setContentTextSize(20) @@ -545,10 +543,13 @@ public class OrderAdapter extends CoreAdapter<Order, FragmentOrderdoingItemBindi pvOptions.show(); } - private void takePhone(String phone) { + private void takePhone(String phone,int orderId) { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + phone)); mContext.startActivity(intent); + + if (mPresenter != null) + mPresenter.addDialRecord(phone,orderId); } public void initPresenter(OrderDoingPresenter presenter) { diff --git a/orderCenter/src/main/java/com/dayu/order/ui/fragment/MultiOrderDetailFragment.java b/orderCenter/src/main/java/com/dayu/order/ui/fragment/MultiOrderDetailFragment.java index 6d3f362..12e0cc3 100644 --- a/orderCenter/src/main/java/com/dayu/order/ui/fragment/MultiOrderDetailFragment.java +++ b/orderCenter/src/main/java/com/dayu/order/ui/fragment/MultiOrderDetailFragment.java @@ -2,11 +2,8 @@ package com.dayu.order.ui.fragment; import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AlertDialog; import android.support.v7.widget.LinearLayoutManager; -import android.view.LayoutInflater; import android.view.View; -import android.widget.ImageView; import com.alibaba.android.arouter.launcher.ARouter; import com.dayu.base.api.APIService; @@ -14,14 +11,15 @@ import com.dayu.base.api.Api; import com.dayu.base.ui.activity.ImgGalleryActivty; import com.dayu.base.ui.adapter.CoreAdapter; import com.dayu.base.ui.fragment.BaseFragment; -import com.dayu.base.ui.fragment.DataBindingFragment; import com.dayu.base.ui.presenter.SImplePresenter; import com.dayu.common.Constants; import com.dayu.location.base.LocationUtils; import com.dayu.order.R; 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.Spu; +import com.dayu.order.api.protocol.data.AddDialRecordData; import com.dayu.order.common.OperatePhoneEvent; import com.dayu.order.common.OrderConstant; import com.dayu.order.databinding.FragmentMultiDetailBinding; @@ -31,17 +29,15 @@ import com.dayu.order.databinding.ItemDetailDeviceCountBinding; import com.dayu.order.databinding.ItemDetailServerInfoBinding; import com.dayu.order.ui.activity.PdfWebViewActivity; import com.dayu.order.ui.activity.QrCodeActivity; -import com.dayu.order.ui.activity.ServerInstructionActivity; import com.dayu.provider.event.TakeOrderSuccessEvent; import com.dayu.provider.router.RouterPath; import com.dayu.utils.CommonUtils; -import com.dayu.utils.GlideImageLoader; import com.dayu.utils.ToastUtils; import com.dayu.utils.UIUtils; +import com.dayu.utils.UtilsDate; import com.dayu.widgets.CustomDialog; import com.dayu.widgets.TextDialog; import com.dayu.widgets.listener.OnItemClickListener; -import com.megvii.idcardlib.util.DialogUtil; import com.umeng.analytics.MobclickAgent; import org.greenrobot.eventbus.EventBus; @@ -198,9 +194,15 @@ public class MultiOrderDetailFragment extends BaseFragment<SImplePresenter, Frag } else { if (phones.size() == 1) { CommonUtils.dialPhone(mActivity, phones.get(0)); + addDialPhoneRecord(phones.get(0)); + } else { - TextDialog.getInstance().showCenterDialog(mActivity, phones, pos -> - CommonUtils.dialPhone(mActivity, phones.get(pos))); + TextDialog.getInstance().showCenterDialog(mActivity, phones, pos -> { + CommonUtils.dialPhone(mActivity, phones.get(pos)); + addDialPhoneRecord(phones.get(pos)); + } + ); + } } }); @@ -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() { showDialog(); OrderApiFactory.receiveOrder(orderId, mUserId).subscribe(mPresenter.baseObserver( aBoolean -> { - MobclickAgent.onEvent(mActivity,"get_serviceOrder"); + MobclickAgent.onEvent(mActivity, "get_serviceOrder"); EventBus.getDefault().post(new TakeOrderSuccessEvent()); ToastUtils.showLongToast(R.string.take_oreder_success_tosee); mBind.tvTakeOrder.setVisibility(View.GONE); diff --git a/orderCenter/src/main/java/com/dayu/order/ui/fragment/OrderFirstTabFragment.java b/orderCenter/src/main/java/com/dayu/order/ui/fragment/OrderFirstTabFragment.java index 6a92931..e54ca79 100755 --- a/orderCenter/src/main/java/com/dayu/order/ui/fragment/OrderFirstTabFragment.java +++ b/orderCenter/src/main/java/com/dayu/order/ui/fragment/OrderFirstTabFragment.java @@ -35,6 +35,7 @@ public class OrderFirstTabFragment extends BaseFragment<OrderDoingPresenter, Fra public void initView() { mAdapter = new OrderAdapter(true); mAdapter.setViewType(R.layout.fragment_orderdoing_item); + mAdapter.initPresenter(mPresenter); mBind.recyclerView.setAdapter(mAdapter); mPresenter.refresh(); EventBus.getDefault().register(this); diff --git a/saleCenter/src/main/java/com/bigfish/salecenter/ui/activity/PosterShareActivity.java b/saleCenter/src/main/java/com/bigfish/salecenter/ui/activity/PosterShareActivity.java index c96f540..088949a 100644 --- a/saleCenter/src/main/java/com/bigfish/salecenter/ui/activity/PosterShareActivity.java +++ b/saleCenter/src/main/java/com/bigfish/salecenter/ui/activity/PosterShareActivity.java @@ -138,7 +138,7 @@ public class PosterShareActivity extends BaseActivity<SImplePresenter, ActivityP mBind.ivQr.setImageBitmap(bitmap); } catch (Exception e) { e.printStackTrace(); - ToastUtils.showShortToast(R.string.error_unknow); + ToastUtils.showShortToast(e.toString()); } } @@ -146,7 +146,7 @@ public class PosterShareActivity extends BaseActivity<SImplePresenter, ActivityP @Override public void onFailure(Call<ResponseBody> call, Throwable t) { hideDialog(); - ToastUtils.showShortToast(R.string.error_unknow); + ToastUtils.showShortToast(t.toString()); } }); } diff --git a/userCenter/src/main/java/com/dayu/usercenter/api/UserService2.java b/userCenter/src/main/java/com/dayu/usercenter/api/UserService2.java index 6755df8..8f148ae 100644 --- a/userCenter/src/main/java/com/dayu/usercenter/api/UserService2.java +++ b/userCenter/src/main/java/com/dayu/usercenter/api/UserService2.java @@ -1,13 +1,15 @@ 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.BaseResponse; import com.dayu.common.Constants; +import com.dayu.usercenter.model.AddUserCardData; 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.base.api.protocol.AddressInfoBean; 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.GlobelRateBean; import com.dayu.usercenter.model.bean.InviteRecordBean; @@ -24,6 +26,8 @@ import com.dayu.usercenter.model.bean.UserLicenceBean; import java.util.List; import io.reactivex.Observable; +import okhttp3.ResponseBody; +import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.POST; @@ -261,5 +265,22 @@ public interface UserService2 { @Query("page") int page, @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); } diff --git a/userCenter/src/main/java/com/dayu/usercenter/model/AddUserCardData.java b/userCenter/src/main/java/com/dayu/usercenter/model/AddUserCardData.java new file mode 100644 index 0000000..805a64a --- /dev/null +++ b/userCenter/src/main/java/com/dayu/usercenter/model/AddUserCardData.java @@ -0,0 +1,38 @@ +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; + } +} diff --git a/userCenter/src/main/java/com/dayu/usercenter/model/ApplyWithdrawData.java b/userCenter/src/main/java/com/dayu/usercenter/model/ApplyWithdrawData.java new file mode 100644 index 0000000..2af2a91 --- /dev/null +++ b/userCenter/src/main/java/com/dayu/usercenter/model/ApplyWithdrawData.java @@ -0,0 +1,15 @@ +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; + } + +} diff --git a/userCenter/src/main/java/com/dayu/usercenter/model/bean/UserIncomeBean.java b/userCenter/src/main/java/com/dayu/usercenter/model/bean/UserIncomeBean.java index 0658d5e..2a78657 100644 --- a/userCenter/src/main/java/com/dayu/usercenter/model/bean/UserIncomeBean.java +++ b/userCenter/src/main/java/com/dayu/usercenter/model/bean/UserIncomeBean.java @@ -15,6 +15,15 @@ public class UserIncomeBean { private double servicePrice; private double inviteRewardPrice; private double platformRewardPrice; + private double unWithdrawPrice; + + public double getUnWithdrawPrice() { + return unWithdrawPrice; + } + + public void setUnWithdrawPrice(double unWithdrawPrice) { + this.unWithdrawPrice = unWithdrawPrice; + } public double getWithdrawPrice() { return withdrawPrice; diff --git a/userCenter/src/main/java/com/dayu/usercenter/presenter/login/LoginPresenter.java b/userCenter/src/main/java/com/dayu/usercenter/presenter/login/LoginPresenter.java index 8c14327..e4f620e 100644 --- a/userCenter/src/main/java/com/dayu/usercenter/presenter/login/LoginPresenter.java +++ b/userCenter/src/main/java/com/dayu/usercenter/presenter/login/LoginPresenter.java @@ -70,14 +70,13 @@ public class LoginPresenter extends LoginContract.Presenter { } mView.showDialog(); UserApiFactory.login(userName.get(), password.get(), "mobileLogin").subscribe(baseObserver(userInfo -> { - if (userInfo.getDetectStatus() == 1) { - loginHx(userInfo.getHxAccount(), userInfo.getHxPwd()); - dumpAndSave(userInfo); - } else if (userInfo.getDetectStatus() == 2 || userInfo.getDetectStatus() == 3) { - showLoginDialog(); + if (userInfo.getRoles() != null && (userInfo.getRoles().contains(2) || userInfo.getRoles().contains(3))){ + userInfo.setSiteId(-1); + userInfo.setMobile(userName.get()); UserManager.getInstance().saveUser(userInfo); - } else { - ToastUtils.showShortToast(UIUtils.getString(R.string.login_faile)); + ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation(); + }else { + ToastUtils.showShortToast(UIUtils.getString(R.string.login_faile_by_role)); } })); } diff --git a/userCenter/src/main/java/com/dayu/usercenter/presenter/smslogin/SmsLoginPresenter.java b/userCenter/src/main/java/com/dayu/usercenter/presenter/smslogin/SmsLoginPresenter.java index 957a044..d935d43 100644 --- a/userCenter/src/main/java/com/dayu/usercenter/presenter/smslogin/SmsLoginPresenter.java +++ b/userCenter/src/main/java/com/dayu/usercenter/presenter/smslogin/SmsLoginPresenter.java @@ -12,7 +12,6 @@ import com.dayu.provider.router.RouterPath; import com.dayu.usercenter.R; import com.dayu.usercenter.api.UserApiFactory; import com.dayu.usercenter.common.UserConstant; -import com.dayu.usercenter.ui.activity.IdentityCertificationActivity; import com.dayu.utils.AppManager; import com.dayu.utils.LogUtils; import com.dayu.utils.StationManager; @@ -127,13 +126,13 @@ public class SmsLoginPresenter extends SmsLoginContract.Presenter { @Override 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.setMobile(phoneNume.get()); UserManager.getInstance().saveUser(info); ARouter.getInstance().build(RouterPath.PATH_MAIN).navigation(); }else { - ToastUtils.showShortToast(UIUtils.getString(R.string.login_faile)); + ToastUtils.showShortToast(UIUtils.getString(R.string.login_faile_by_role)); } //// List<Integer> role = info.getRoles(); diff --git a/userCenter/src/main/java/com/dayu/usercenter/ui/activity2/ShareUserCardActivity.java b/userCenter/src/main/java/com/dayu/usercenter/ui/activity2/ShareUserCardActivity.java new file mode 100644 index 0000000..befed4f --- /dev/null +++ b/userCenter/src/main/java/com/dayu/usercenter/ui/activity2/ShareUserCardActivity.java @@ -0,0 +1,136 @@ +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); + } +} diff --git a/userCenter/src/main/java/com/dayu/usercenter/ui/fragment/HomeUserFragment.java b/userCenter/src/main/java/com/dayu/usercenter/ui/fragment/HomeUserFragment.java index 51b020d..0139e85 100644 --- a/userCenter/src/main/java/com/dayu/usercenter/ui/fragment/HomeUserFragment.java +++ b/userCenter/src/main/java/com/dayu/usercenter/ui/fragment/HomeUserFragment.java @@ -1,17 +1,13 @@ package com.dayu.usercenter.ui.fragment; import android.content.Intent; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.text.TextUtils; 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.dayu.base.api.Api; import com.dayu.base.api.protocol.AddressInfoBean; import com.dayu.base.ui.fragment.BaseFragment; import com.dayu.common.Constants; @@ -20,25 +16,34 @@ import com.dayu.provider.event.CertificationEvent; import com.dayu.provider.router.RouterPath; import com.dayu.usercenter.R; 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.OrderRecord; import com.dayu.usercenter.data.protocol.TodayAchievement; 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.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.UserIncomeBean; import com.dayu.usercenter.presenter.homeuser.HomeUserContract; 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.EditBankActivity; +import com.dayu.usercenter.ui.activity2.ShareUserCardActivity; import com.dayu.usercenter.ui.activity2.UserInfoActivity; import com.dayu.utils.CommonUtils; import com.dayu.utils.ProgressUtil; import com.dayu.utils.SPUtils; import com.dayu.utils.UserManager; import com.dayu.widgets.CustomDialog; +import com.dayu.widgets.WechatShareDialog; import com.umeng.analytics.MobclickAgent; +import com.umeng.socialize.bean.SHARE_MEDIA; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; @@ -58,6 +63,8 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo private String mUserPhone; private String mScore; private int mAccountBalance; + private boolean hasBankInfo, hasAddressInfo; + private double canWithdrawMoney; public static HomeUserFragment newInstance() { Bundle args = new Bundle(); @@ -76,8 +83,17 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo mBind.refreshLayout.setEnableLoadMore(false); mBind.refreshLayout.setOnRefreshListener(refreshLayout -> mPresenter.getAllData(mUserId)); 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 public void setPresenter() { mBind.setPresenter(mPresenter); @@ -98,30 +114,50 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo @Override public void getBankInfoSuccess(UserBankInfoBean info) { - if (info == null || TextUtils.isEmpty(info.getBankAccount())){ - if (TextUtils.isEmpty((String) SPUtils.get("bank_addr_info",""))){ - showBankAddrDialog(); - SPUtils.put("bank_addr_info","showed"); + if (info == null || TextUtils.isEmpty(info.getBankAccount())) { + hasBankInfo = false; + if (TextUtils.isEmpty((String) SPUtils.get("bank_addr_info", ""))) { + showBankAddrDialog(""); + SPUtils.put("bank_addr_info", "showed"); } + } else { + hasBankInfo = true; } + } @Override public void getAddrInfoSuccess(AddressInfoBean info) { - if (info == null || TextUtils.isEmpty(info.getAddress())){ - if (TextUtils.isEmpty((String) SPUtils.get("bank_addr_info",""))){ - showBankAddrDialog(); - SPUtils.put("bank_addr_info","showed"); + if (info == null || TextUtils.isEmpty(info.getAddress())) { + hasAddressInfo = false; + if (TextUtils.isEmpty((String) SPUtils.get("bank_addr_info", ""))) { + 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, - "请尽快填写您的银行卡信息和快递信息,以免影响您的提现和接单。" + str , (dialog1, confirm) -> { if (confirm) { - Intent intent = new Intent(mActivity, UserInfoActivity.class); + Intent intent = new Intent(mActivity, clazz); startActivity(intent); dialog1.dismiss(); } @@ -129,14 +165,14 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo }); dialog.setTitle("提示") .setNegativeButton(mActivity.getString(R.string.cancle)) - .setPositiveButton("去填写"); + .setPositiveButton(conirmStr); dialog.show(); } @Override public void getPersonalInfoSuccess(EngineerInfo info) { // 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())) { SPUtils.put("USER_IDENTITY", ""); } else { @@ -193,14 +229,23 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo //个人评分 mBind.tvScore.setText(record.getScore() + mActivity.getString(R.string.score)); 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() + ""); } + //师傅等级 + 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 public void setIncomData(UserIncomeBean data) { mBind.tvCashArrive.setText("¥" + data.getWithdrawPrice()); @@ -208,6 +253,8 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo mBind.tvServiceIncome.setText("¥" + data.getServicePrice()); mBind.tvInvateReward.setText("¥" + data.getInviteRewardPrice()); mBind.tvPlatformReward.setText("¥" + data.getPlatformRewardPrice()); + mBind.tvCanFetch.setText("¥" + data.getUnWithdrawPrice()); + canWithdrawMoney = data.getUnWithdrawPrice(); } @Override @@ -220,11 +267,6 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo @Override 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 @Override public void copyWechat(String wechatNum) { - CommonUtils.copyText(mActivity,wechatNum); + CommonUtils.copyText(mActivity, wechatNum); } @@ -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) - , (dialog1, confirm) -> { - if (confirm) { - Intent intent = new Intent(mActivity, WithdrawalsActivity.class); - startActivity(intent); - dialog1.dismiss(); - MobclickAgent.onEvent(mActivity, "sure_set_account"); - } else { - MobclickAgent.onEvent(mActivity, "cancle_set_account"); + //发送个人名片 + private void sendUserCard() { + initUser(); + int detectSatus = UserManager.getInstance().getUser().getDetectStatus(); + if (detectSatus == 2 || detectSatus == 3) { + showCertificationDialog(); + return; + } + if (TextUtils.isEmpty(mUserInfo.getHeaderImg()) || mUserInfo.getHeaderImg().equals(Constants.AvatarUrl)) { + 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. - * - * @param starLinearLayout . - * @param lev . - * @param totalLevel . - */ - 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); + //申请提现 + private void applyWithdraw() { + if (!hasBankInfo) { + String str = "请先完善您的银行卡信息才能提现"; + showBankAddrDialog(str,EditBankActivity.class); + return; } + 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); - Bitmap bm = BitmapFactory.decodeResource(mActivity.getResources(), R.drawable.person_banxing); - starImg.setImageBitmap(bm); - starLinearLayout.addView(starImg, layoutParams); - } + //申请提现成功弹框 + private void showApplySuccessDialog() { + CustomDialog dialog = new CustomDialog(mActivity, R.style.CustomDialog, + "申请提现成功,您的资金将于下月初打到您的银行卡上" + , (dialog1, confirm) -> { + dialog1.dismiss(); + }); + dialog.setOneButton(true).show(); + } - 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); - } + //提示去认证身份 + private void showCertificationDialog() { + CustomDialog customDialog = new CustomDialog(mActivity, R.style.CustomDialog, getString(R.string.engineer_identity_not_audite) + , (dialog, confirm) -> { + if (confirm) { + 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 public void onResume() { super.onResume(); @@ -369,4 +405,14 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo public void refreshUser(RefreshUserInfoEvent event) { mPresenter.getUserInfo(); } + + @Subscribe + public void afterEditBank(EditBankEvent event) { + mPresenter.getBankInfo(); + } + + @Subscribe + public void afterEditAddr(EditAddressEvent event) { + mPresenter.getAddrInfo(); + } } diff --git a/userCenter/src/main/release/AndroidManifest.xml b/userCenter/src/main/release/AndroidManifest.xml index 8041b9d..18de264 100644 --- a/userCenter/src/main/release/AndroidManifest.xml +++ b/userCenter/src/main/release/AndroidManifest.xml @@ -102,6 +102,9 @@ android:name=".ui.activity2.InviteRecordActivity" android:screenOrientation="portrait" /> <activity + android:name=".ui.activity2.ShareUserCardActivity" + android:screenOrientation="portrait" /> + <activity android:name=".ui.activity2.TestRecordActivity" android:screenOrientation="portrait" /> </application> diff --git a/userCenter/src/main/res/layout/activity_share_user_card.xml b/userCenter/src/main/res/layout/activity_share_user_card.xml new file mode 100644 index 0000000..de556bf --- /dev/null +++ b/userCenter/src/main/res/layout/activity_share_user_card.xml @@ -0,0 +1,83 @@ +<?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 diff --git a/userCenter/src/main/res/layout/fragment_home_user.xml b/userCenter/src/main/res/layout/fragment_home_user.xml index 6d195f7..36b9fb1 100644 --- a/userCenter/src/main/res/layout/fragment_home_user.xml +++ b/userCenter/src/main/res/layout/fragment_home_user.xml @@ -16,16 +16,16 @@ <RelativeLayout android:id="@+id/rl_title" style="@style/title"> + <TextView - android:visibility="gone" android:id="@+id/tv_start_live" android:layout_width="100dp" android:layout_height="match_parent" - android:textColor="@color/common_text_color" - android:textSize="16sp" android:gravity="center" android:text="开始直播" - /> + android:textColor="@color/common_text_color" + android:textSize="16sp" + android:visibility="gone" /> <TextView style="@style/text_title" @@ -39,396 +39,478 @@ </RelativeLayout> <com.scwang.smartrefresh.layout.SmartRefreshLayout - 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:id="@+id/refresh_layout" android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@color/cl_white"> + android:layout_height="0dp" + android:layout_weight="1" + android:paddingBottom="2dp"> - <LinearLayout + <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" - android:gravity="center_horizontal" - android:orientation="vertical"> + android:background="@color/cl_white"> - - <ImageView + <LinearLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:scaleType="fitXY" - android:src="@drawable/person_title_view" - android:visibility="gone" /> + android:layout_height="match_parent" + android:gravity="center_horizontal" + android:orientation="vertical"> - <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 - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_centerVertical="true" - 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:scaleType="fitXY" + android:src="@drawable/person_title_view" android:visibility="gone" /> <RelativeLayout - android:id="@+id/persone_two" - android:layout_width="wrap_content" + android:id="@+id/person_one" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_below="@id/tv_name" - android:layout_alignLeft="@id/tv_name" - android:layout_marginTop="9.3dp"> + android:background="@color/table_record_title_bg" + android:onClick="@{()->presenter.toUserSetting()}" + android:padding="10dp"> - <TextView - android:id="@+id/tv_sex" + <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="@string/tv_person_center_sex_value" - android:textColor="@color/cl_home_title_text_color" - android:textSize="12sp" /> + android:layout_alignParentRight="true" + android:layout_centerVertical="true" + 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 - 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="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: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:textSize="12sp" /> - - <TextView - android:id="@+id/tv_phone" + 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" /> + + <RelativeLayout + android:id="@+id/persone_two" 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> - - </RelativeLayout> + android:layout_below="@id/tv_name" + android:layout_alignLeft="@id/tv_name" + android:layout_marginTop="9.3dp"> + + <TextView + android:id="@+id/tv_sex" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + 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 - 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" /> + <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" /> <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" /> + android:id="@+id/tv_send_card" + style="@style/btn_common" + android:layout_width="match_parent" + android:layout_marginLeft="40dp" + android:layout_marginTop="15dp" + android:layout_marginRight="40dp" + android:layout_marginBottom="15dp" + android:background="@drawable/btn_blue_commom" + android:text="@string/send_user_card" /> - <LinearLayout - android:id="@+id/tv_star" - android:layout_width="90dp" - android:layout_height="wrap_content" + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="50dp" android:layout_marginLeft="15dp" - android:orientation="horizontal" /> - </LinearLayout> - - - <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"> + android:layout_marginRight="15dp" + android:background="@drawable/personal_center_selector" + android:onClick="@{()->presenter.dumpToCacheRecord()}"> - <LinearLayout - style="@style/ll_user_bottom2" - android:onClick="@{()->presenter.toCommonRecord(1)}"> + <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> - <TextView - style="@style/tv_user_bottom1" - android:text="@string/user_sale_reward" /> + <RelativeLayout + android:layout_width="match_parent" + 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 - android:id="@+id/tv_sale_reward" - style="@style/tv_user_bottom2" - android:text="0" - android:textColor="@color/cl_order_item_date" /> - </LinearLayout> + android:id="@+id/tv_fetch" + style="@style/btn_common" + android:layout_height="36dp" + android:layout_width="100dp" + 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 - 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" /> + style="@style/ll_user_bottom" + android:layout_marginTop="10dp"> + + <LinearLayout + style="@style/ll_user_bottom2" + android:onClick="@{()->presenter.toCommonRecord(1)}"> + + <TextView + style="@style/tv_user_bottom1" + android:text="@string/user_sale_reward" /> + + <TextView + 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 - style="@style/ll_user_bottom" - android:layout_marginTop="10dp"> <LinearLayout - style="@style/ll_user_bottom2" - android:onClick="@{()->presenter.toCommonRecord(3)}"> - - <TextView - style="@style/tv_user_bottom1" - android:text="@string/user_invate_reward" /> - - <TextView - android:id="@+id/tv_invate_reward" - style="@style/tv_user_bottom2" - android:text="0" - android:textColor="@color/text_common_green" /> + style="@style/ll_user_bottom" + android:layout_marginTop="10dp"> + + <LinearLayout + style="@style/ll_user_bottom2" + android:onClick="@{()->presenter.toCommonRecord(3)}"> + + <TextView + style="@style/tv_user_bottom1" + android:text="@string/user_invate_reward" /> + + <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 - style="@style/ll_user_bottom2" - android:layout_marginLeft="10dp" - android:onClick="@{()->presenter.toCommonRecord(4)}"> + style="@style/ll_user_bottom" + android:layout_marginTop="10dp" + 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 - style="@style/tv_user_bottom1" - android:text="@string/user_platform_reward" /> + <TextView + style="@style/tv_user_bottom1" + android:text="@string/tv_person_center_licence" /> - <TextView - android:id="@+id/tv_platform_reward" - style="@style/tv_user_bottom2" - android:text="0" - android:textColor="@color/text_common_green" /> + <TextView + android:id="@+id/tv_licence" + style="@style/tv_user_bottom2" + android:text="0" /> + </LinearLayout> </LinearLayout> - </LinearLayout> - <LinearLayout - style="@style/ll_user_bottom" - android:layout_marginTop="10dp" - 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> + <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 - style="@style/ll_user_bottom2" - android:layout_marginLeft="10dp" - android:onClick="@{()->presenter.dumpToLicence()}"> + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_margin="15dp" + android:orientation="horizontal"> <TextView - style="@style/tv_user_bottom1" - android:text="@string/tv_person_center_licence" /> + android:id="@+id/apply_part" + 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 - android:id="@+id/tv_licence" - style="@style/tv_user_bottom2" - android:text="0" /> + android:layout_width="0dp" + android:layout_height="45dp" + 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> - - <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 - android:layout_width="0dp" - android:layout_weight="1" + android:layout_width="match_parent" android:layout_height="45dp" - android:background="@drawable/btn_blue_commom" - android:gravity="center" android:layout_marginLeft="15dp" - android:onClick="@{()->presenter.toInviteRecord()}" - android:text="@string/invite_record" + 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> - - <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> + </android.support.v4.widget.NestedScrollView> </com.scwang.smartrefresh.layout.SmartRefreshLayout> </LinearLayout> diff --git a/userCenter/src/main/res/values/strings.xml b/userCenter/src/main/res/values/strings.xml index a36493c..07c263d 100644 --- a/userCenter/src/main/res/values/strings.xml +++ b/userCenter/src/main/res/values/strings.xml @@ -49,4 +49,11 @@ <string name="invite_new_share_content_business">邀请商家瓜分千万佣金!</string> <string name="add_service_wechat">添加客服微信获得更多派单</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> -- libgit2 0.25.0