调整个人名片

This commit is contained in:
zlzw 2022-11-10 11:17:04 +08:00
parent 7f34c50b71
commit 44a05ea0d5
25 changed files with 253 additions and 55 deletions

View File

@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
apply plugin: 'img-optimizer' apply plugin: 'img-optimizer'
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics' apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.alibaba.arouter'
android { android {
dexOptions { dexOptions {
jumboMode = true jumboMode = true

View File

@ -22,6 +22,7 @@ buildscript {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.20"
classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
classpath "com.alibaba:arouter-register:1.0.2"
} }

View File

@ -34,4 +34,29 @@ public class NobleUtil {
} }
return "未开通"; return "未开通";
} }
public static int getNobleBackgroundId(int id){
switch (id){
case 1:return R.mipmap.img_aristocrat_nanjue;
case 2:return R.mipmap.img_aristocrat_zijue;
case 3:return R.mipmap.img_aristocrat_houjue;
case 4:return R.mipmap.img_aristocrat_gongjue;
case 5:return R.mipmap.img_aristocrat_guowang;
case 6:return R.mipmap.img_aristocrat_huangdi;
case 7:return R.mipmap.img_aristocrat_chaohuang;
}
return R.mipmap.img_aristocrat_notopen;
}
public static int getUserCardTitleBackgroundId(int id) {
switch (id){
case 1:return R.drawable.bg_user_card_title_nanjue;
case 2:return R.drawable.bg_user_card_title_zijue;
case 3:return R.drawable.bg_user_card_title_houjue;
case 4:return R.drawable.bg_user_card_title_gongjue;
case 5:return R.drawable.bg_user_card_title_guowang;
case 6:return R.drawable.bg_user_card_title_huangdi;
case 7:return R.drawable.bg_user_card_title_chaohuang;
}
return 0;
}
} }

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="375dp" android:height="93dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffffff" android:endColor="#F8C4C4" android:angle="90" />
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="375dp" android:height="93dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffffff" android:endColor="#C4F8F6" android:angle="90" />
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="375dp" android:height="93dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffffff" android:endColor="#F8E4C4" android:angle="90" />
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="375dp" android:height="93dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffffff" android:endColor="#E2F6FF" android:angle="90" />
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="375dp" android:height="93dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffffff" android:endColor="#F8CEC4" android:angle="90" />
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="375dp" android:height="93dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffffff" android:endColor="#ffe9e2ff" android:angle="90" />
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
</shape>
</item>
</selector>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="375dp" android:height="93dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffffff" android:endColor="#E2FFF7" android:angle="90" />
<corners android:topLeftRadius="16dp" android:topRightRadius="16dp" android:bottomLeftRadius="0dp" android:bottomRightRadius="0dp" />
</shape>
</item>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -707,6 +707,7 @@
<string name="live_user_level_anchor">主播等級</string> <string name="live_user_level_anchor">主播等級</string>
<string name="live_user_card_level">用户等級</string> <string name="live_user_card_level">用户等級</string>
<string name="live_noble_level_anchor">貴族等級</string> <string name="live_noble_level_anchor">貴族等級</string>
<string name="live_noble_fens_anchor">粉絲團</string>
<string name="live_honor_number_anchor">榮譽墻</string> <string name="live_honor_number_anchor">榮譽墻</string>
<string name="live_anchor_error">連接已斷開,請重新開播</string> <string name="live_anchor_error">連接已斷開,請重新開播</string>
<string name="search_no_data_2">空空如也</string> <string name="search_no_data_2">空空如也</string>

View File

@ -98,7 +98,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private String mToUid; private String mToUid;
private String mStream; private String mStream;
private int mType; private int mType;
private int guardNumber;
private TextView mFollowText; private TextView mFollowText;
private TextView mName; private TextView mName;
private TextView mID; private TextView mID;
@ -112,6 +111,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private TextView mGuard; private TextView mGuard;
private TextView mUnion; private TextView mUnion;
private TextView mHonorVal; private TextView mHonorVal;
private TextView mNobleTitleVal;
private ImageView mFollowImage; private ImageView mFollowImage;
private ImageView mSex; private ImageView mSex;
private ImageView good_nub_ico; private ImageView good_nub_ico;
@ -122,9 +122,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private ImageView mAvatar; private ImageView mAvatar;
private ImageView shawl; private ImageView shawl;
private ImageView honorIcon; private ImageView honorIcon;
private ImageView mTitleBg;
private UserBean mUserBean; private UserBean mUserBean;
private LinearLayout mGuardLayout; private LinearLayout mGuardLayout;
private LinearLayout mUnionLayout; private LinearLayout mUnionLayout;
private LinearLayout mNobleIconLayout;
private LinearLayout mUserLevelLayout;
private LinearLayout mHonorLayout;
private boolean mFollowing; private boolean mFollowing;
GifImageView btn_live; GifImageView btn_live;
SVGAImageView gift_svga; SVGAImageView gift_svga;
@ -174,7 +178,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
getType(); getType();
initView(); initView();
initListener(); initListener();
initGuardList(); //initGuardList();
LayoutInflater inflater = LayoutInflater.from(mContext); LayoutInflater inflater = LayoutInflater.from(mContext);
View bottomView = null; View bottomView = null;
if (mType == TYPE_AUD_ANC) { if (mType == TYPE_AUD_ANC) {
@ -233,6 +237,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
mUnionLayout = mRootView.findViewById(R.id.btn_union); mUnionLayout = mRootView.findViewById(R.id.btn_union);
mUnion = mRootView.findViewById(R.id.union_val); mUnion = mRootView.findViewById(R.id.union_val);
mHonorVal = mRootView.findViewById(R.id.honor_val); mHonorVal = mRootView.findViewById(R.id.honor_val);
mUserLevelLayout = mRootView.findViewById(R.id.user_level_layout);
mNobleIconLayout = mRootView.findViewById(R.id.noble_icon_layout);
mNobleTitleVal = mRootView.findViewById(R.id.noble_title_val);
mHonorLayout = mRootView.findViewById(R.id.honor_layout);
mTitleBg = mRootView.findViewById(R.id.title_bg);
mHonorLayout.setOnClickListener(v -> forwardHomePage());
} }
private void initListener() { private void initListener() {
@ -245,6 +256,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
mAvatar.setOnClickListener(this); mAvatar.setOnClickListener(this);
mReport.setOnClickListener(this); mReport.setOnClickListener(this);
mGuardLayout.setOnClickListener(this); mGuardLayout.setOnClickListener(this);
btn_live.setOnClickListener(this);
} }
private void loadData() { private void loadData() {
@ -296,6 +308,11 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
mUnionLayout.setVisibility(View.VISIBLE); mUnionLayout.setVisibility(View.VISIBLE);
} }
mNoble.setVisibility(View.GONE); mNoble.setVisibility(View.GONE);
mUserLevelLayout.setBackgroundResource(R.drawable.bg_user_card_lv);
mNobleTitleVal.setText(R.string.live_noble_fens_anchor);
mNobleIconLayout.setBackgroundResource(R.drawable.bg_user_card_fans);
} else {
mUserLevelLayout.setBackgroundResource(R.drawable.bg_user_card_au_lv);
} }
mName.setText(obj.getString("user_nicename")); mName.setText(obj.getString("user_nicename"));
if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) { if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) {
@ -334,11 +351,18 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else { } else {
mNoble.setVisibility(View.GONE); mNoble.setVisibility(View.GONE);
} }
mGuard.setText(String.format(mGuard.getText().toString(), guardNumber)); mGuard.setText(String.format(mGuard.getText().toString(), obj.getInteger("guard_num")));
mFansVal.setText(WordUtil.getString(R.string.fans) + ":" + mUserBean.getFans()); mFansVal.setText(WordUtil.getString(R.string.fans) + ":" + mUserBean.getFans());
mPraise.setText(WordUtil.getString(R.string.praise) + ":" + obj.getInteger("user_love_num")); mPraise.setText(WordUtil.getString(R.string.praise) + ":" + obj.getInteger("user_love_num"));
mSignDesc.setText(mUserBean.getSignature()); mSignDesc.setText(mUserBean.getSignature());
mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id()))); if (isAnchor) {
mNobleVal.setText("" + obj.getInteger("level_fans_num"));
} else {
mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id())));
if (obj.getInteger("noble_id") != 0) {
mTitleBg.setBackgroundResource(NobleUtil.getUserCardTitleBackgroundId(obj.getInteger("noble_id")));
}
}
ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar); ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar);
JSONObject dress = obj.getJSONObject("dress"); JSONObject dress = obj.getJSONObject("dress");
@ -348,7 +372,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else { } else {
mLiveIcon2.setVisibility(View.INVISIBLE); mLiveIcon2.setVisibility(View.INVISIBLE);
} }
if (dress.containsKey("medal")) { if (dress.containsKey("medal") && !isAnchor) {
JSONObject item = null; JSONObject item = null;
for (Object medal : dress.getJSONArray("medal")) { for (Object medal : dress.getJSONArray("medal")) {
JSONObject _item = (JSONObject) medal; JSONObject _item = (JSONObject) medal;
@ -359,20 +383,22 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} }
if (item != null) { if (item != null) {
String url = item.getString("display_src"); String url = item.getString("display_src");
if (item.containsKey("noble_medal") && !isAnchor) { if (item.containsKey("noble_medal")) {
mNoble.setVisibility(View.VISIBLE); mNoble.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, item.getString("noble_medal"), mNoble); ImgLoader.display(mContext, item.getString("noble_medal"), mNoble);
} }
if (url != null) { if (url != null) {
url = url.replace("qny.shayucm.com", "downs.yaoulive.com"); url = url.replace("qny.shayucm.com", "downs.yaoulive.com");
mNobleIcon.setVisibility(View.VISIBLE); try {
ImgLoader.display(mContext, url, mNobleIcon); mNobleIconLayout.setBackgroundResource(NobleUtil.getNobleBackgroundId(obj.getInteger("noble_id")));
} else { } catch (Exception e) {
mNobleIcon.setVisibility(View.INVISIBLE); mNobleIconLayout.setBackgroundResource(NobleUtil.getNobleBackgroundId(0));
}
} }
} }
} else { } else {
mNobleIcon.setVisibility(View.INVISIBLE); mNobleIconLayout.setVisibility(View.VISIBLE);
mNobleIcon.setVisibility(View.VISIBLE);
} }
if (dress.containsKey("medal_no")) { if (dress.containsKey("medal_no")) {
JSONObject item = null; JSONObject item = null;
@ -380,11 +406,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
item = dress.getJSONArray("medal_no").getJSONObject(0); item = dress.getJSONArray("medal_no").getJSONObject(0);
String url = item.getString("display_src"); String url = item.getString("display_src");
url = url.replace("qny.shayucm.com", "downs.yaoulive.com"); url = url.replace("qny.shayucm.com", "downs.yaoulive.com");
honorIcon.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, url, honorIcon); ImgLoader.display(mContext, url, honorIcon);
} }
} else {
honorIcon.setVisibility(View.INVISIBLE);
} }
mFollowing = obj.getIntValue("isattention") == 1; mFollowing = obj.getIntValue("isattention") == 1;
@ -393,6 +416,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
if (dress.getJSONArray("wraps").size() >= 1) { if (dress.getJSONArray("wraps").size() >= 1) {
JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0); JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0);
shawl.setTag("test");
ImgLoader.display(mContext, display.getString("display_src"), shawl); ImgLoader.display(mContext, display.getString("display_src"), shawl);
} }
if (dress.getJSONArray("avatar_frame").size() == 1) { if (dress.getJSONArray("avatar_frame").size() == 1) {
@ -504,18 +528,78 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
LiveReportActivity.forward(mContext, mToUid); LiveReportActivity.forward(mContext, mToUid);
} }
private void initGuardList() {
LiveHttpUtil.getGuardList(mLiveUid, 1, new HttpCallback() { private void gotoLive(String live_id) {
DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() {
@Override @Override
public void onSuccess(int code, String msg, String[] info) { public void onConfirmClick(Dialog dialog, String content) {
List<GuardUserBean> list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class); RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveUid, new IRongCoreCallback.OperationCallback() {
if (list != null) { @Override
guardNumber = list.size(); public void onSuccess() {
} Log.i("tx", "退出成功");
//连接socket
LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
@Override
public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) {
}
});
V2TIMManager.getInstance().quitGroup("g" + mLiveUid, new V2TIMCallback() {
@Override
public void onSuccess() {
Log.i("tx", "退出成功" + mLiveUid);
//连接socket
LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
@Override
public void onError(int code, String desc) {
Log.i("tx", "退出失败");
}
});
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
if (mCheckLivePresenter == null) {
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
@Override
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
if (liveBean == null) {
return;
}
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
dismiss();
EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal));
}
});
}
mCheckLivePresenter.checkLive(liveBean);
}
}
});
} }
}); });
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
int i = v.getId(); int i = v.getId();
@ -529,6 +613,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
forwardHomePage(); forwardHomePage();
} else if (i == R.id.btn_guard) { } else if (i == R.id.btn_guard) {
((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity); ((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
} else if (i == R.id.btn_live) {
gotoLive(mToUid);
} }
} }
} }

View File

@ -1,6 +1,13 @@
package com.yunbao.live.views; package com.yunbao.live.views;
import android.app.Activity; import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.live.activity.LiveActivity.mLiveRyLinkMicPkPresenter;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList1;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.leaveDRRoom;
import static cn.rongcloud.rtc.base.RCRTCLiveRole.BROADCASTER;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
@ -39,7 +46,6 @@ import com.yunbao.live.http.LiveHttpConsts;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.momo.TencentTRTCBeautyManager; import com.yunbao.live.momo.TencentTRTCBeautyManager;
import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter; import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter;
import com.yunbao.live.socket.SocketRyLinkMicPkUtil;
import com.yunbao.live.socket.SocketSendBean; import com.yunbao.live.socket.SocketSendBean;
import java.util.ArrayList; import java.util.ArrayList;
@ -48,38 +54,22 @@ import java.util.List;
import cn.rongcloud.rtc.api.RCRTCConfig; import cn.rongcloud.rtc.api.RCRTCConfig;
import cn.rongcloud.rtc.api.RCRTCEngine; import cn.rongcloud.rtc.api.RCRTCEngine;
import cn.rongcloud.rtc.api.RCRTCMixConfig; import cn.rongcloud.rtc.api.RCRTCMixConfig;
import cn.rongcloud.rtc.api.RCRTCOtherRoom;
import cn.rongcloud.rtc.api.RCRTCRemoteUser; import cn.rongcloud.rtc.api.RCRTCRemoteUser;
import cn.rongcloud.rtc.api.RCRTCRoom; import cn.rongcloud.rtc.api.RCRTCRoom;
import cn.rongcloud.rtc.api.RCRTCRoomConfig; import cn.rongcloud.rtc.api.RCRTCRoomConfig;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback; import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener; import cn.rongcloud.rtc.api.callback.IRCRTCRoomEventsListener;
import cn.rongcloud.rtc.api.callback.IRCRTCVideoOutputFrameListener;
import cn.rongcloud.rtc.api.stream.RCRTCInputStream; import cn.rongcloud.rtc.api.stream.RCRTCInputStream;
import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo; import cn.rongcloud.rtc.api.stream.RCRTCLiveInfo;
import cn.rongcloud.rtc.api.stream.RCRTCVideoInputStream;
import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig; import cn.rongcloud.rtc.api.stream.RCRTCVideoStreamConfig;
import cn.rongcloud.rtc.api.stream.RCRTCVideoView; import cn.rongcloud.rtc.api.stream.RCRTCVideoView;
import cn.rongcloud.rtc.base.RCRTCMediaType;
import cn.rongcloud.rtc.base.RCRTCParamsType; import cn.rongcloud.rtc.base.RCRTCParamsType;
import cn.rongcloud.rtc.base.RCRTCRoomType; import cn.rongcloud.rtc.base.RCRTCRoomType;
import cn.rongcloud.rtc.base.RCRTCStream;
import cn.rongcloud.rtc.base.RCRTCVideoFrame;
import cn.rongcloud.rtc.base.RTCErrorCode; import cn.rongcloud.rtc.base.RTCErrorCode;
import cn.rongcloud.rtc.core.CameraVideoCapturer; import cn.rongcloud.rtc.core.CameraVideoCapturer;
import cn.rongcloud.rtc.core.RendererCommon; import cn.rongcloud.rtc.core.RendererCommon;
import static cn.rongcloud.rtc.base.RCRTCLiveRole.BROADCASTER;
import static cn.rongcloud.rtc.core.RendererCommon.ScalingType.SCALE_ASPECT_FILL;
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
import static com.yunbao.common.Constants.SOCKET_LIVE_DRPK;
import static com.yunbao.live.activity.LiveActivity.mLiveRyLinkMicPkPresenter;
import static com.yunbao.live.activity.LiveRyAnchorActivity.mLivePushViewHolder;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.inputStreamList1;
import static com.yunbao.live.presenter.LiveRyLinkMicPkPresenter.leaveDRRoom;
/** /**
* Created by cxf on 2018/10/7. * Created by cxf on 2018/10/7.
* 腾讯云直播推流 * 腾讯云直播推流
@ -200,7 +190,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
if (mLiveRyLinkMicPkPresenter != null) { if (mLiveRyLinkMicPkPresenter != null) {
mLiveRyLinkMicPkPresenter.onLinkDRMicPkApply(userBean); mLiveRyLinkMicPkPresenter.onLinkDRMicPkApply(userBean);
} else { } else {
mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, mLivePushViewHolder, true, liveActivityContainer); mLiveRyLinkMicPkPresenter = new LiveRyLinkMicPkPresenter(mContext, LivePushRyViewHolder.this, true, liveActivityContainer);
mLiveRyLinkMicPkPresenter.onLinkDRMicPkApply(userBean); mLiveRyLinkMicPkPresenter.onLinkDRMicPkApply(userBean);
} }
} else if (extra.equals("LiveDRPK1")) { } else if (extra.equals("LiveDRPK1")) {
@ -504,7 +494,7 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
RCRTCVideoStreamConfig videoConfigBuilder = RCRTCVideoStreamConfig.Builder.create() RCRTCVideoStreamConfig videoConfigBuilder = RCRTCVideoStreamConfig.Builder.create()
//设置分辨率 //设置分辨率
.setVideoResolution(RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_720) .setVideoResolution(RCRTCParamsType.RCRTCVideoResolution.RESOLUTION_480_640)
//设置帧率 //设置帧率
.setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_30) .setVideoFps(RCRTCParamsType.RCRTCVideoFps.Fps_30)
//设置最小码率480P下推荐200 //设置最小码率480P下推荐200
@ -519,9 +509,20 @@ public class LivePushRyViewHolder extends AbsRyLivePushViewHolder implements ITX
RCRTCVideoView rongRTCVideoView = new RCRTCVideoView(contexts); RCRTCVideoView rongRTCVideoView = new RCRTCVideoView(contexts);
rongRTCVideoView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL); rongRTCVideoView.setScalingType(RendererCommon.ScalingType.SCALE_ASPECT_FILL);
RCRTCEngine.getInstance().getDefaultVideoStream().setVideoView(rongRTCVideoView); RCRTCEngine.getInstance().getDefaultVideoStream().setVideoView(rongRTCVideoView);
RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(null); RCRTCEngine.getInstance().getDefaultVideoStream().startCamera(new IRCRTCResultDataCallback<Boolean>() {
@Override
public void onSuccess(Boolean data) {
//设置摄像头最大缩放比例
boolean zoom = RCRTCEngine.getInstance().getDefaultVideoStream().setCameraZoomFactor(1.0f);
// ToastUtil.show("设置比例="+zoom);
}
@Override
public void onFailed(RTCErrorCode errorCode) {
}
});
//设置摄像头最大缩放比例 //设置摄像头最大缩放比例
RCRTCEngine.getInstance().getDefaultVideoStream().setCameraZoomFactor(RCRTCEngine.getInstance().getDefaultVideoStream().getCameraMaxZoomFactor()); // RCRTCEngine.getInstance().getDefaultVideoStream().setCameraZoomFactor(RCRTCEngine.getInstance().getDefaultVideoStream().getCameraMaxZoomFactor());
mPreView.addView(rongRTCVideoView); mPreView.addView(rongRTCVideoView);
tencentTRTCBeautyManager = new TencentTRTCBeautyManager(mContext); tencentTRTCBeautyManager = new TencentTRTCBeautyManager(mContext);

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="112dp" android:height="56dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ff95b6ff" android:endColor="#ff69adfe" android:angle="90" />
<corners android:radius="6dp" />
</shape>
</item>
</selector>

View File

@ -11,6 +11,14 @@
android:layout_marginTop="52dp" android:layout_marginTop="52dp"
android:background="@drawable/bg_live_user"> android:background="@drawable/bg_live_user">
<ImageView
android:id="@+id/title_bg"
android:layout_width="match_parent"
android:layout_height="93dp"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/btn_report" android:id="@+id/btn_report"
@ -137,7 +145,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="17dp" android:layout_height="17dp"
android:layout_marginTop="13dp" android:layout_marginTop="13dp"
android:gravity="center_horizontal" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
@ -219,7 +227,7 @@
android:layout_width="46.5dp" android:layout_width="46.5dp"
android:layout_height="17.5dp" android:layout_height="17.5dp"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="6dp"/> android:layout_marginStart="6dp" />
<LinearLayout <LinearLayout
android:id="@+id/btn_union" android:id="@+id/btn_union"
@ -329,6 +337,7 @@
android:visibility="visible"> android:visibility="visible">
<LinearLayout <LinearLayout
android:id="@+id/user_level_layout"
android:layout_width="112dp" android:layout_width="112dp"
android:layout_height="56dp" android:layout_height="56dp"
android:background="@drawable/bg_user_card_lv" android:background="@drawable/bg_user_card_lv"
@ -338,8 +347,8 @@
android:id="@+id/live_icon" android:id="@+id/live_icon"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:visibility="visible" android:src="@mipmap/icon_chat_face"
android:src="@mipmap/icon_chat_face" /> android:visibility="visible" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -367,19 +376,20 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/noble_icon_layout"
android:layout_width="112dp" android:layout_width="112dp"
android:layout_height="56dp" android:layout_height="56dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:background="@drawable/bg_user_card_fans" android:background="@mipmap/img_aristocrat_notopen"
android:gravity="center"> android:gravity="center">
<ImageView <ImageView
android:id="@+id/noble_icon" android:id="@+id/noble_icon"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:visibility="visible" android:src="@mipmap/img_fans_default"
android:src="@mipmap/icon_chat_face" /> android:visibility="invisible" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -388,6 +398,7 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/noble_title_val"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/live_noble_level_anchor" android:text="@string/live_noble_level_anchor"
@ -406,6 +417,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/honor_layout"
android:layout_width="112dp" android:layout_width="112dp"
android:layout_height="56dp" android:layout_height="56dp"
android:background="@drawable/bg_user_card_honor" android:background="@drawable/bg_user_card_honor"
@ -415,8 +427,8 @@
android:id="@+id/honor_icon" android:id="@+id/honor_icon"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:visibility="visible" android:src="@mipmap/img_honor_default"
android:src="@mipmap/icon_chat_face"/> android:visibility="visible" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -447,9 +459,9 @@
<FrameLayout <FrameLayout
android:id="@+id/bottom_container" android:id="@+id/bottom_container"
android:layout_marginTop="13dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_marginTop="13dp" />
</LinearLayout> </LinearLayout>