diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index b0082ba72..b4b8498b4 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -177,7 +177,7 @@ public class AppContext extends CommonAppContext { msg.obj = content.getContent(); if (SocketRyClient.mSocketHandler != null && (TextUtils.equals("__system__", message.getTargetId()) - || (TextUtils.equals("g" + PortraitLiveManager.liveID, message.getTargetId())))) { + || ("g" + PortraitLiveManager.liveID).contains(message.getTargetId()))) { SocketRyClient.mSocketHandler.sendMessage(msg); } } @@ -240,7 +240,7 @@ public class AppContext extends CommonAppContext { /** * 注册全局异常捕获,有需要时可以在onCreate调用 */ - private void registerError(){ + private void registerError() { NeverCrashUtils.getInstance() .setDebugMode(BuildConfig.DEBUG) .setMainCrashHandler((t, e) -> { diff --git a/common/src/main/java/com/yunbao/common/Constants.java b/common/src/main/java/com/yunbao/common/Constants.java index 1fc271e19..ab1f75031 100644 --- a/common/src/main/java/com/yunbao/common/Constants.java +++ b/common/src/main/java/com/yunbao/common/Constants.java @@ -24,6 +24,9 @@ public class Constants { public static final String STREAM = "stream"; public static final String LIMIT = "limit"; public static final String UID = "uid"; + public static final String USER_NAME = "userName";//用户名 + public static final String USER_ICON = "userIcon";//用户头像 + public static final String TIP = "tip"; public static final String SHOW_INVITE = "showInvite"; public static final String USER_BEAN = "userBean"; @@ -47,6 +50,7 @@ public class Constants { public static final String LIVE_CLASS_PREFIX = "liveClass_"; public static final String LIVE_ADMIN_ROOM = "liveAdminRoom"; public static final String LIVE_ANCHER_NAME = "ancherName";//主播名 + public static final String LIVE_ANCHER_ICON = "ancherIcon";//主播头像 public static final String HAS_GAME = "hasGame"; public static final String OPEN_FLASH = "openFlash"; public static final String SHARE_QR_CODE_FILE = "shareQrCodeFile.png"; diff --git a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java index d7e23fe33..f309a0b24 100644 --- a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java +++ b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java @@ -97,7 +97,7 @@ public class DialogUitl { } public static void showSimpleDialog(Context context, String content, SimpleCallback callback) { - showSimpleDialog(context, content, true, callback); + showSimpleDialog(context, content, false, callback); } public static void showSimpleDialog(Context context, String content, boolean cancelable, SimpleCallback callback) { @@ -114,6 +114,15 @@ public class DialogUitl { .show(); } + public static void showSimpleDialog(Context context, String title, String content, boolean cancelable, SimpleCallback3 callback) { + new Builder(context) + .setTitle(title) + .setContent(content) + .setCancelable(cancelable) + .setClickCallback3(callback) + .build() + .show(); + } public static void showSimpleInputDialog(Context context, String title, String hint, int inputType, int length, SimpleCallback callback) { new Builder(context).setTitle(title) @@ -290,6 +299,7 @@ public class DialogUitl { private int mInputType; private int mLength; private SimpleCallback mClickCallback; + private SimpleCallback3 mClickCallback3; public Builder(Context context) { mContext = context; @@ -350,6 +360,11 @@ public class DialogUitl { return this; } + public Builder setClickCallback3(SimpleCallback3 clickCallback) { + mClickCallback3 = clickCallback; + return this; + } + public Dialog build() { final Dialog dialog = new Dialog(mContext, mBackgroundDimEnabled ? R.style.dialog : R.style.dialog2); dialog.setContentView(mInput ? R.layout.dialog_input : R.layout.dialog_simple); @@ -397,12 +412,24 @@ public class DialogUitl { } } else { dialog.dismiss(); + if (mClickCallback3 != null) { + mClickCallback3.onConfirmClick(dialog); + } + } + } else { dialog.dismiss(); - if (mClickCallback instanceof SimpleCallback2) { - ((SimpleCallback2) mClickCallback).onCancelClick(); + if (mClickCallback3 != null) { + mClickCallback3.onCancel(); + + } else { + + if (mClickCallback instanceof SimpleCallback2) { + ((SimpleCallback2) mClickCallback).onCancelClick(); + } } + } } }; @@ -429,6 +456,12 @@ public class DialogUitl { void onCancelClick(); } + public interface SimpleCallback3 { + void onConfirmClick(Dialog dialog); + + void onCancel(); + } + /** * 城市选择 diff --git a/common/src/main/java/com/yunbao/common/views/weight/VerticalViewPager.java b/common/src/main/java/com/yunbao/common/views/weight/VerticalViewPager.java index d09c17b4d..60207de8c 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/VerticalViewPager.java +++ b/common/src/main/java/com/yunbao/common/views/weight/VerticalViewPager.java @@ -75,6 +75,10 @@ public class VerticalViewPager extends ViewGroup { private boolean mEnableScroll = true; + public boolean ismEnableScroll() { + return mEnableScroll; + } + /** * Used to track what the expected number of items in the adapter should be. * If the app changes this when we don't expect it, we'll throw a big obnoxious exception. diff --git a/common/src/main/res/drawable/bg_live_tota.xml b/common/src/main/res/drawable/bg_live_tota.xml index 97920b7a7..c56735473 100644 --- a/common/src/main/res/drawable/bg_live_tota.xml +++ b/common/src/main/res/drawable/bg_live_tota.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 82c0bba20..25d86311b 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -56,6 +56,7 @@ import com.yunbao.live.dialog.LiveGuardDialogFragment; import com.yunbao.live.dialog.LiveInputDialogFragment; import com.yunbao.live.dialog.LiveMoreDialogFragment; import com.yunbao.live.dialog.LiveNewGuardBuyDialogFragment; +import com.yunbao.live.dialog.LiveNewGuardListDialogFragment; import com.yunbao.live.dialog.LiveRedPackListDialogFragment; import com.yunbao.live.dialog.LiveRedPackSendDialogFragment; import com.yunbao.live.dialog.LiveShareDialogFragment; @@ -118,6 +119,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL protected int mSocketUserType;//socket用户类型 30 普通用户 40 管理员 50 主播 60超管 public static String mStream; protected String mAncherName; + protected String mAncherIcon; public static String mLiveUid; protected String mDanmuPrice;//弹幕价格 protected String mCoinName;//钻石名称 @@ -327,6 +329,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL } } + + @Override public void onBuyLiangName(LiveReceiveGiftBean bean) { if (mLiveRoomViewHolder != null) { @@ -1249,6 +1253,18 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL fragment.setArguments(bundle); fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); } + /** + * 守护列表弹窗 + */ + public void openNewGuardListWindow() { + LiveNewGuardListDialogFragment fragment = new LiveNewGuardListDialogFragment(); + fragment.setLiveGuardInfo(mLiveGuardInfo); + Bundle bundle = new Bundle(); + bundle.putString(Constants.LIVE_UID, mLiveUid); + bundle.putBoolean(Constants.ANCHOR, mIsAnchor); + fragment.setArguments(bundle); + fragment.show(getSupportFragmentManager(), "LiveGuardDialogFragment"); + } /** * 打開粉絲團 @@ -1313,6 +1329,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL bundle.putString(Constants.LIVE_UID, mLiveUid); bundle.putString(Constants.LIVE_ANCHER_NAME, mAncherName); bundle.putString(Constants.STREAM, mStream); + bundle.putString(Constants.LIVE_ANCHER_ICON,mAncherIcon); + bundle.putString(Constants.USER_ICON,CommonAppConfig.getInstance().getUserBean().getAvatar()); fragment.setArguments(bundle); fragment.show(getSupportFragmentManager(), "LiveGuardBuyDialogFragment"); } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index f55482dac..fdcda64ed 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -1,6 +1,5 @@ package com.yunbao.live.activity; -import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.media.AudioManager; @@ -62,8 +61,6 @@ import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; -import com.yunbao.live.socket.SocketSendBean; -import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.views.LiveRoomPlayViewHolder; import com.yunbao.live.views.PortraitLiveManager; @@ -73,15 +70,6 @@ import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; import java.util.List; -import cn.rongcloud.rtc.api.RCRTCEngine; -import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; -import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleCallback; -import cn.rongcloud.rtc.base.RTCErrorCode; -import io.rong.imlib.IRongCallback; -import io.rong.imlib.RongIMClient; -import io.rong.imlib.model.Conversation; -import io.rong.message.TextMessage; - import static com.yunbao.live.views.LivePlayRyViewHolder.Micing; /** @@ -110,7 +98,7 @@ public class LiveAudienceActivity extends LiveActivity { public static int fansNum; public static ProcessResultUtil mProcessResultUtil; - private LiveImDeletUtil liveImDeletUtil; + public static int isattention; private LiveBean mLiveBean; @@ -139,7 +127,7 @@ public class LiveAudienceActivity extends LiveActivity { Bus.getOn(this); super.main(); liveAudienceActivity = this; - liveImDeletUtil = new LiveImDeletUtil(); + mProcessResultUtil = new ProcessResultUtil(this); Intent intent = getIntent(); mLiveSDK = intent.getIntExtra(Constants.LIVE_SDK, Constants.LIVE_SDK_KSY); @@ -149,11 +137,6 @@ public class LiveAudienceActivity extends LiveActivity { mLiveBean = intent.getParcelableExtra(Constants.LIVE_BEAN); mLiveUid = mLiveBean.getUid(); mStream = mLiveBean.getStream(); -// if (getIntent().getIntExtra("isry", 0) == 1) { -// isRy = true; -// } else { -// isRy = false; -// } setVolumeControlStream(AudioManager.STREAM_MUSIC); manager = new PortraitLiveManager(this, intent); initView(); @@ -192,25 +175,39 @@ public class LiveAudienceActivity extends LiveActivity { verticalViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - mCurrentItem = position; - Log.e(TAG, "mCurrentItem:" + mCurrentItem); - if (mCurrentItem == itemModelList.size() - 1) { - MainNetManager.get(mContext) - .anchorRecommendType("30", new com.yunbao.common.http.base.HttpCallback() { - @Override - public void onSuccess(AnchorRecommendModel data) { - if (TextUtils.equals(data.getList().get(0).getUid(), mLiveBean.getUid())) { - data.getList().remove(0); - } - itemModelList.addAll(data.getList()); - mPagerAdapter.notifyDataSetChanged(); - } - @Override - public void onError(String error) { - } - }); + if (Micing == 1) { + + manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal); + verticalViewPager.setEnableScroll(false); + } else if (Micing == 2) { + verticalViewPager.setEnableScroll(false); + manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); + + } else { + verticalViewPager.setEnableScroll(true); + mCurrentItem = position; + Log.e(TAG, "mCurrentItem:" + mCurrentItem); + if (mCurrentItem == itemModelList.size() - 1) { + MainNetManager.get(mContext) + .anchorRecommendType("30", new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(AnchorRecommendModel data) { + if (TextUtils.equals(data.getList().get(0).getUid(), mLiveBean.getUid())) { + data.getList().remove(0); + } + itemModelList.addAll(data.getList()); + mPagerAdapter.notifyDataSetChanged(); + } + + @Override + public void onError(String error) { + } + }); + } } + + } @Override @@ -278,6 +275,7 @@ public class LiveAudienceActivity extends LiveActivity { mLiveUid = mLiveBean.getUid(); mStream = mLiveBean.getStream(); mAncherName = liveBean.getUserNiceName(); + mAncherIcon = liveBean.getAvatar(); Log.e("收到socket--->", "mLiveUid--------------------------->" + mLiveUid); //加载当前页面数据 @@ -414,115 +412,17 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void onBackPressed() { + manager.onBackPressed(); if (Micing == 1) { - DialogUitl.showSimpleDialog(mContext, "您已申請,退出將取消語音連麥申請!", new DialogUitl.SimpleCallback() { - @Override - public void onConfirmClick(Dialog dialog, String content) { - Micing = 0; - //用户申请联麦 - final SocketSendBean msg = new SocketSendBean() - .param("_method_", Constants.LIAN_MAI) - .param("action", 7) - .param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()) - .param("avatar", CommonAppConfig.getInstance().getUserBean().getAvatar()) - .param("uid", CommonAppConfig.getInstance().getUid()); - msg.create(); - - String targetId = mLiveUid; - Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE; - TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); - io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(targetId, conversationType, messageContent); - - RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { - @Override - public void onAttached(io.rong.imlib.model.Message message) { - - } - - @Override - public void onSuccess(io.rong.imlib.model.Message message) { - Log.e("ry", "发送成功"); - liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId()); - } - - @Override - public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { - Log.e("ry", "发送失敗" + errorCode.toString()); - liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId()); - } - }); - end(); - } - }); - return; + manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal); } else if (Micing == 2) { - DialogUitl.showSimpleDialog(mContext, "連麥中,退出將斷開語音連麥!", new DialogUitl.SimpleCallback() { - @Override - public void onConfirmClick(Dialog dialog, String content) { - ToastUtil.show("下麥中,稍等....."); - RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() { - - /** - * 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。 - * SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。 - */ - @Override - public void onKicked() { - - } - - @Override - public void onSuccess() { - Log.e("ry", "下麦成功"); - // 该用户切换为观众成功,可以以观众身份进行音视频 - //退出多人房间 - HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm") - .params("roomid", LiveActivity.mLiveUid) - .execute(new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - Log.e("ry", code + "退出多人"); - - } - }); - //退出rtc播放 - RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() { - @Override - public void onSuccess() { - Log.e("ry", "退出多人房间成功"); - new Handler(Looper.getMainLooper()).post(new Runnable() { - public void run() { - Micing = 0; - end(); - } - }); - } - - @Override - public void onFailed(RTCErrorCode errorCode) { - Log.e("ry", errorCode + "退出多人房间失敗"); - - } - }); - - } - - /** - * 当切换失败且不影响当前角色继续音视频时回调 - * @param errorCode 失败错误码 - */ - @Override - public void onFailed(RTCErrorCode errorCode) { - Log.e("ry", "下麦失败" + errorCode); - - } - }); - - } - }); - return; + manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal); + } else { + manager.exitLiveRoom(); + manager.onRemove(); + super.onBackPressed(); } - end(); + } public void end() { @@ -540,6 +440,7 @@ public class LiveAudienceActivity extends LiveActivity { @Override protected void onDestroy() { super.onDestroy(); + Bus.getOff(this); L.e("LiveAudienceActivity-------onDestroy------->"); } @@ -635,24 +536,35 @@ public class LiveAudienceActivity extends LiveActivity { fragment.show(getSupportFragmentManager(), "ChatChargeDialogFragment"); } + public void setEnableScroll(boolean enableScroll) { + verticalViewPager.setEnableScroll(enableScroll); + } @Subscribe(threadMode = ThreadMode.MAIN) public void onLiveRoomChangeEvent(LiveRoomChangeEvent e) { - LiveBean liveBean = e.getLiveBean(); - if (liveBean != null) { - LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); - LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); - LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); - manager.onRemove(); - mLiveType = e.getLiveType(); - mLiveTypeVal = e.getLiveTypeVal(); - mLiveBean = liveBean; - mLiveUid = liveBean.getUid(); - mStream = liveBean.getStream(); - mAncherName = liveBean.getUserNiceName(); - manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK); + if (verticalViewPager.ismEnableScroll()) { + LiveBean liveBean = e.getLiveBean(); + if (liveBean != null) { + LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE); + LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM); + LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE); + manager.onRemove(); + mLiveType = e.getLiveType(); + mLiveTypeVal = e.getLiveTypeVal(); + mLiveBean = liveBean; + mLiveUid = liveBean.getUid(); + mStream = liveBean.getStream(); + mAncherName = liveBean.getUserNiceName(); + mAncherIcon = liveBean.getAvatar(); + manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK); + + } + } else { + verticalViewPager.setEnableScroll(true); } + + } @Override @@ -673,6 +585,15 @@ public class LiveAudienceActivity extends LiveActivity { IMLoginModel userInfo = IMLoginManager.get(mContext).getUserInfo(); switch (event.getType()) { case SIDEBAR: + int userIndex = -1; + for (int i = 0; i < list.size(); i++) { + if (TextUtils.equals(list.get(i).getUid(), PortraitLiveManager.liveID)) { + userIndex = i; + } + } + if (userIndex != -1) { + list.remove(userIndex); + } //从右边打开侧边栏 SidebarLiveAudience sidebarLiveAudience = new SidebarLiveAudience(); bundle.putString("Avatar", mLiveBean.getAvatar()); @@ -749,26 +670,32 @@ public class LiveAudienceActivity extends LiveActivity { ZhuangBanActivity.forward(mContext, nobleUrl, false); break; case LIAN_MAI: - //获取房间连麦状态 - HttpClient.getInstance().get("live.getDrLm", "live.getDrLm") - .params("uid", mLiveUid, true) - .execute(new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - LiveMicUserDialogFragment fragment = new LiveMicUserDialogFragment(); - Bundle bundle = new Bundle(); - bundle.putString(Constants.LIVE_UID, mLiveUid); - bundle.putString(Constants.STREAM, mStream); - bundle.putString("By", "1"); - fragment.setArguments(bundle); - fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveUserMoreDialogFragment"); - LiveMicUserDialogFragment.activity = ((LiveAudienceActivity) mContext); - } else { - ToastUtil.show(R.string.no_mic_opn); + if (event.getMicIng() == 1) { + manager.micIngTypeOne(event.getBean(), event.getLiveType(), event.getLiveTypeVal()); + } else if (event.getMicIng() == 2) { + manager.micIngTypeTwo(event.getBean(), event.getLiveType(), event.getLiveTypeVal()); + } else { + //获取房间连麦状态 + HttpClient.getInstance().get("live.getDrLm", "live.getDrLm") + .params("uid", mLiveUid, true) + .execute(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + LiveMicUserDialogFragment fragment = new LiveMicUserDialogFragment(); + Bundle bundle = new Bundle(); + bundle.putString(Constants.LIVE_UID, mLiveUid); + bundle.putString(Constants.STREAM, mStream); + bundle.putString("By", "1"); + fragment.setArguments(bundle); + fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveUserMoreDialogFragment"); + LiveMicUserDialogFragment.activity = ((LiveAudienceActivity) mContext); + } else { + ToastUtil.show(R.string.no_mic_opn); + } } - } - }); + }); + } break; case EFFECTS_SETTINGS: EffectsSettingsDialog effectsSettingsDialog = new EffectsSettingsDialog(); @@ -779,7 +706,7 @@ public class LiveAudienceActivity extends LiveActivity { bundle.putString(Constants.LIVE_UID, mLiveUid); fragment4Audience.setArguments(bundle); if (mContext instanceof LiveAudienceActivity) { - fragment4Audience.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragmentAudience"); + fragment4Audience.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveWishListDialogFragment4Audience"); } break; case OPEN_PARAMETERS: @@ -867,15 +794,7 @@ public class LiveAudienceActivity extends LiveActivity { list.clear(); slideInfoModels.clear(); List models = anchorRecommendModel.getList(); - int userIndex = -1; - for (int i = 0; i < list.size(); i++) { - if (TextUtils.equals(list.get(i).getUid(), PortraitLiveManager.liveID)) { - userIndex = i; - } - } - if (userIndex != -1) { - models.remove(userIndex); - } + models.add(0, new AnchorRecommendItemModel()); list.addAll(models); slideInfoModels = anchorRecommendModel.getSlide(); diff --git a/live/src/main/java/com/yunbao/live/adapter/GuardAdapter.java b/live/src/main/java/com/yunbao/live/adapter/GuardAdapter.java index c9c4a57f8..119bb244c 100644 --- a/live/src/main/java/com/yunbao/live/adapter/GuardAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/GuardAdapter.java @@ -2,9 +2,11 @@ package com.yunbao.live.adapter; import android.content.Context; import android.graphics.drawable.Drawable; + import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.RecyclerView; + import android.text.Html; import android.view.View; import android.view.ViewGroup; @@ -35,9 +37,11 @@ public class GuardAdapter extends RefreshAdapter { private Drawable mGuardDrawable0; private Drawable mGuardDrawable1; private Drawable mGuardDrawable2; + private boolean isShowTitle; - public GuardAdapter(Context context, boolean dialog) { + public GuardAdapter(Context context, boolean dialog, boolean isShowTitle) { super(context); + this.isShowTitle = isShowTitle; mDialog = dialog; mVotesName = CommonAppConfig.getInstance().getVotesName(); mWeekContributeString = WordUtil.getString(R.string.guard_week_con); @@ -46,9 +50,15 @@ public class GuardAdapter extends RefreshAdapter { mGuardDrawable2 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_2); } + public GuardAdapter(Context context, boolean dialog) { + this(context, dialog, true); + } @Override public int getItemViewType(int position) { + if(!isShowTitle){ + return NORMAL; + } if (position == 0) { return HEAD; } @@ -105,7 +115,7 @@ public class GuardAdapter extends RefreshAdapter { if (levelBean != null) { ImgLoader.display(mContext, levelBean.getThumb(), mLevel); } - mVotes.setText(Html.fromHtml( " " + bean.getContribute() + " " + mVotesName)); + mVotes.setText(Html.fromHtml(" " + bean.getContribute() + " " + mVotesName)); } } @@ -142,7 +152,7 @@ public class GuardAdapter extends RefreshAdapter { mIcon.setImageDrawable(mGuardDrawable0); } else if (bean.getType() == Constants.GUARD_TYPE_MONTH) { mIcon.setImageDrawable(mGuardDrawable1); - } else if (bean.getType() == Constants.GUARD_TYPE_YEAR){ + } else if (bean.getType() == Constants.GUARD_TYPE_YEAR) { mIcon.setImageDrawable(mGuardDrawable2); } } diff --git a/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java index 8329841b6..48e1ba219 100644 --- a/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/VerticalPagerAdapter.java @@ -20,7 +20,11 @@ public class VerticalPagerAdapter extends androidx.viewpager.widget.PagerAdapter private Activity mContext; private int mPosition; - +// public void upDataBg(List models) { +// liveBeans.clear(); +// liveBeans.addAll(models); +// notifyDataSetChanged(); +// } public VerticalPagerAdapter(List liveBeans, Activity mContext) { this.liveBeans = liveBeans; diff --git a/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java b/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java index 2ff070c13..676fd1e4e 100644 --- a/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java +++ b/live/src/main/java/com/yunbao/live/bean/WishlistItemModel.java @@ -115,4 +115,8 @@ public class WishlistItemModel extends BaseModel { this.wishlistProgress = wishlistProgress; return this; } + + public String getWishlistNumP() { + return wishlistProgress + "/" + wishlistNum; + } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java index 2daf5052d..d5f3f2c84 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveMicUserDialogFragment.java @@ -212,7 +212,7 @@ public class LiveMicUserDialogFragment extends AbsDialogFragment implements View public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { Log.e("ry", "发送失敗" + errorCode.toString()); liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId()); - } + }//BIZ_ERROR_DATABASE_ERROR }); } else { ToastUtil.show(msg); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java index 0cbce77cf..39161f02e 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardBuyDialogFragment.java @@ -8,6 +8,9 @@ import android.view.Gravity; import android.view.View; import android.view.Window; import android.view.WindowManager; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; import android.widget.TextView; import androidx.annotation.Nullable; @@ -16,10 +19,13 @@ import androidx.recyclerview.widget.RecyclerView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.makeramen.roundedimageview.RoundedImageView; +import com.opensource.svgaplayer.SVGAImageView; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RouteUtil; @@ -48,17 +54,27 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements private RecyclerView mRights;//权益列表 private RecyclerView mBuys;//购买列表 + private RoundedImageView userIcon, userIconOne, userIconTwo; + private SVGAImageView iconCover; private TextView anchorName; + private TextView guardCoin2; + private TextView guardBuy; + private TextView guard_tips; + private Button submit; + private LinearLayout buy2; + private RelativeLayout buy1; private TextView mCoin; private String mCoinName; private TextView mCoinNameTextView; private View mBtnBuy; - private List mRightList=new ArrayList<>();//权限列表 + private List mRightList = new ArrayList<>();//权限列表 private List mBuyList;//商品列表 private long mCoinVal;//余额 private String mLiveUid; private String mStream; private String mAncherName; + private String mAncherIcon; + private String mUserIcon; private LiveGuardInfo mLiveGuardInfo; private GuardBuyBean mTargetBuyBean; @@ -105,11 +121,26 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements mRights = mRootView.findViewById(R.id.guard_rights); mBuys = mRootView.findViewById(R.id.guard_buys); anchorName = mRootView.findViewById(R.id.guard_anchor_name); + userIcon = mRootView.findViewById(R.id.guard_imageView); + userIconOne = mRootView.findViewById(R.id.guard_imageView_one); + userIconTwo = mRootView.findViewById(R.id.guard_imageView_two); + iconCover = mRootView.findViewById(R.id.gift_svga); + guardCoin2 = mRootView.findViewById(R.id.guard_coin2); + guardBuy = mRootView.findViewById(R.id.guard_buy); + submit = mRootView.findViewById(R.id.guard_submit); + buy1 = mRootView.findViewById(R.id.buy1); + buy2 = mRootView.findViewById(R.id.buy2); + guard_tips = mRootView.findViewById(R.id.guard_textView2); + + iconCover.setImageResource(R.drawable.guardian_img_wings); + mBtnBuy.setOnClickListener(this); + submit.setOnClickListener(this); + guardBuy.setOnClickListener(this); mRights.setHasFixedSize(true); mRights.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); mBuys.setHasFixedSize(true); - mBuys.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false){ + mBuys.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false) { @Override public boolean canScrollHorizontally() {//购买列表禁止滑动 return false; @@ -127,10 +158,13 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements if (bundle != null) { mLiveUid = bundle.getString(Constants.LIVE_UID); mStream = bundle.getString(Constants.STREAM); - mAncherName=bundle.getString(Constants.LIVE_ANCHER_NAME); + mAncherName = bundle.getString(Constants.LIVE_ANCHER_NAME); + mAncherIcon = bundle.getString(Constants.LIVE_ANCHER_ICON); + mUserIcon = bundle.getString(Constants.USER_ICON); String coinName = WordUtil.getString(R.string.diamond); mCoinName = coinName; - mCoinNameTextView.setText(WordUtil.getString(R.string.guard_my) + coinName + ":"); + // mCoinNameTextView.setText(WordUtil.getString(R.string.guard_my) + coinName + ":"); + mCoinNameTextView.setText("快为您喜欢的主播开通守护吧"); anchorName.setText(String.format("成爲%s的守護", mAncherName)); } LiveHttpUtil.getGuardBuyList(new HttpCallback() { @@ -146,6 +180,7 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements e.printStackTrace(); } mCoin.setText(String.valueOf(mCoinVal)); + guardCoin2.setText(WordUtil.getString(R.string.guard_my) + mCoinName + ":" + mCoinVal); buyItemsAdapter.setItems(mBuyList); mGuardRightAdapter.setList(mRightList); buyItemsAdapter.notifyDataSetChanged(); @@ -157,13 +192,49 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements } } }); + initView(); + } + + /** + * 根据守护类型初始化不同的底部布局 + */ + private void initView() { + int guardType = mLiveGuardInfo.getMyGuardType(); + if (guardType == Constants.GUARD_TYPE_NONE) { + iconCover.setBackgroundResource(R.drawable.guardian_img_wings); + buy1.setVisibility(View.VISIBLE); + buy2.setVisibility(View.GONE); + } else { + buy2.setVisibility(View.VISIBLE); + buy1.setVisibility(View.GONE); + userIconOne.setVisibility(View.VISIBLE); + userIconTwo.setVisibility(View.VISIBLE); + iconCover.setImageResource(R.drawable.guardian_img_two); + ImgLoader.display(mContext, mAncherIcon, userIconOne); + ImgLoader.display(mContext, mUserIcon, userIconTwo); + String title = ""; + switch (guardType) { + case Constants.GUARD_TYPE_DAY: + title = "您是當前主播的周守護"; + break; + case Constants.GUARD_TYPE_MONTH: + title = "您是當前主播的月守護"; + break; + case Constants.GUARD_TYPE_YEAR: + title = "您是當前主播的年守護"; + break; + } + anchorName.setText(title); + guard_tips.setText("守護日期截止到:"+ mLiveGuardInfo.getMyGuardEndTime()); + } + } private void refreshList(int index) { if (!mRightList.isEmpty()) { GuardBuyBean guardBuyBean = mBuyList.get(index - 1); - mTargetBuyBean=guardBuyBean; + mTargetBuyBean = guardBuyBean; for (GuardRightBean bean : mRightList) { bean.setChecked(false); } @@ -177,18 +248,15 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements } - @Override public void onClick(View view) { int i = view.getId(); - if (i == R.id.guard_btn_buy) { + if (i == R.id.guard_btn_buy || i == R.id.guard_submit) { clickBuyGuard(); + } else if (i == R.id.guard_buy) { + forwardMyCoin(); } -// else if (i == R.id.coin) { -// forwardMyCoin(); -// -// } } /** diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardListDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardListDialogFragment.java new file mode 100644 index 000000000..e8dc83c1b --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveNewGuardListDialogFragment.java @@ -0,0 +1,201 @@ +package com.yunbao.live.dialog; + +import android.os.Bundle; +import android.view.Gravity; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.ConstraintLayout; +import androidx.fragment.app.FragmentTransaction; +import androidx.recyclerview.widget.LinearLayoutManager; + +import com.alibaba.fastjson.JSON; +import com.opensource.svgaplayer.SVGAImageView; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.Constants; +import com.yunbao.common.adapter.RefreshAdapter; +import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.custom.CommonRefreshView; +import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.utils.CommonIconUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; +import com.yunbao.live.activity.LiveActivity; +import com.yunbao.live.adapter.GuardAdapter; +import com.yunbao.live.bean.GuardUserBean; +import com.yunbao.live.bean.LiveGuardInfo; +import com.yunbao.live.http.LiveHttpUtil; + +import java.util.Arrays; +import java.util.List; + +/** + * 新版守护列表 + */ +public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements View.OnClickListener { + private ImageView guardIcon, userSex, userLevel; + private ConstraintLayout mRootLayout; + private CommonRefreshView mRefreshView; + private TextView mBtnBuy, userName, userGuard,tip1, tip2; + private SVGAImageView giftSvga; + private LinearLayout userLayout; + + private GuardAdapter mGuardAdapter; + private LiveGuardInfo mLiveGuardInfo; + private String mLiveUid; + private boolean mIsAnchor;//是否是主播 + + @Override + protected int getLayoutId() { + return R.layout.dialog_new_guard_list; + } + + @Override + protected int getDialogStyle() { + return R.style.dialog2; + } + + @Override + protected boolean canCancel() { + return true; + } + + public void setLiveGuardInfo(LiveGuardInfo info) { + mLiveGuardInfo = info; + } + + @Override + protected void setWindowAttributes(Window window) { + window.setWindowAnimations(R.style.bottomToTopAnim); + WindowManager.LayoutParams params = window.getAttributes(); + params.width = WindowManager.LayoutParams.MATCH_PARENT; + params.height = WindowManager.LayoutParams.WRAP_CONTENT; + params.gravity = Gravity.BOTTOM; + window.setAttributes(params); + } + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + Bundle bundle = getArguments(); + if (bundle == null) { + return; + } + mIsAnchor = bundle.getBoolean(Constants.ANCHOR, false); + mLiveUid = bundle.getString(Constants.LIVE_UID); + guardIcon = mRootView.findViewById(R.id.guard_imageView); + mRootLayout = mRootView.findViewById(R.id.guard_constraintLayout); + mBtnBuy = mRootView.findViewById(R.id.guard_btn_buy); + giftSvga = mRootView.findViewById(R.id.gift_svga); + mRefreshView = mRootView.findViewById(R.id.refreshView); + userName = mRootView.findViewById(R.id.list_guard_list_user_name); + userGuard = mRootView.findViewById(R.id.list_guard_list_user_guard); + userLevel = mRootView.findViewById(R.id.list_guard_list_user_level); + userSex = mRootView.findViewById(R.id.list_guard_list_user_sex); + userLayout = mRootView.findViewById(R.id.guard_linearLayout); + tip1 = mRootView.findViewById(R.id.guard_tip1); + tip2 = mRootView.findViewById(R.id.guard_tip2); + mBtnBuy.setOnClickListener(this); + mBtnBuy.setEnabled(true); + mBtnBuy.setText(R.string.guard_buy_2); + initView(); + } + + private void initView() { + mRefreshView.setEmptyLayoutId(mIsAnchor ? R.layout.view_no_data_guard_anc : R.layout.view_no_data_guard_aud); + mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { + @Override + public RefreshAdapter getAdapter() { + if (mGuardAdapter == null) { + mGuardAdapter = new GuardAdapter(mContext, true, false); + } + return mGuardAdapter; + } + + @Override + public void loadData(int p, HttpCallback callback) { + LiveHttpUtil.getGuardList(mLiveUid, p, callback); + } + + @Override + public List processData(String[] info) { + List list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class); + if (list.isEmpty()) { + userLayout.setVisibility(View.INVISIBLE); + }else { + GuardUserBean bean = list.get(0); + giftSvga.setImageResource(R.drawable.guardian_img_wings_p); + ImgLoader.display(mContext, bean.getAvatar(), guardIcon); + guardIcon.setVisibility(View.VISIBLE); + userName.setText(bean.getUserNiceName()); + String guardString = WordUtil.getString(R.string.guard_week_con); + userGuard.setText(guardString + " " + bean.getContribute()); + userSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex())); + LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel()); + if (levelBean != null) { + ImgLoader.display(mContext, levelBean.getThumb(), userLevel); + } + } + if (mLiveGuardInfo != null) { + int guardType = mLiveGuardInfo.getMyGuardType(); + if (guardType == Constants.GUARD_TYPE_NONE) { + tip1.setText(R.string.guard_tip_0); + } else if (guardType == Constants.GUARD_TYPE_DAY) { + tip1.setText(WordUtil.getString(R.string.guard_tip_day) + mLiveGuardInfo.getMyGuardEndTime()); + mBtnBuy.setText(R.string.guard_buy_3); + } else if (guardType == Constants.GUARD_TYPE_MONTH) { + tip1.setText(WordUtil.getString(R.string.guard_tip_1) + mLiveGuardInfo.getMyGuardEndTime()); + mBtnBuy.setText(R.string.guard_buy_3); + } else if (guardType == Constants.GUARD_TYPE_YEAR) { + tip1.setText(WordUtil.getString(R.string.guard_tip_2) + mLiveGuardInfo.getMyGuardEndTime()); + mBtnBuy.setText(R.string.guard_buy_3); + } + } + return list; + } + + @Override + public void onRefreshSuccess(List list, int listCount) { + + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { + + } + + @Override + public void onLoadMoreFailure() { + + } + }); + mRefreshView.initData(); + } + + @Override + public void onClick(View view) { + dismiss(); + ((LiveActivity) mContext).openNewBuyGuardWindow(); + } + + @Override + public int show(@NonNull FragmentTransaction transaction, @Nullable String tag) { + int show = super.show(transaction, tag); + initView(); + return show; + } +} diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java index 70a5a88c0..cd3755697 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserMoreDialogFragment.java @@ -143,7 +143,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie ((LiveActivity) mContext).openLuckGiftTip(); } else if (Tips.equals("2")) { dismiss(); - ((LiveActivity) mContext).openGuardListWindow(); + ((LiveActivity) mContext).openNewGuardListWindow(); } else if (Tips.equals("3")) { dismiss(); ((LiveActivity) mContext).openFansWindow(); diff --git a/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java b/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java index e738164af..bd87ea77c 100644 --- a/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java +++ b/live/src/main/java/com/yunbao/live/dialog/SidebarLiveAudience.java @@ -34,6 +34,7 @@ import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; +import com.yunbao.live.views.LivePlayRyViewHolder; import com.yunbao.live.views.PortraitLiveManager; import org.greenrobot.eventbus.EventBus; @@ -202,13 +203,25 @@ public class SidebarLiveAudience extends AbsDialogFragment { if (liveBean1 == null) { return; } - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); + if (LivePlayRyViewHolder.Micing == 1) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) + .setMicIng(1) + .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal)); + } else if (LivePlayRyViewHolder.Micing == 2) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.LIAN_MAI) + .setMicIng(2) + .setBean(liveBean).setLiveType(liveType).setLiveTypeVal(liveTypeVal)); + } else { + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); + } + }); mCheckLivePresenter.checkLive(liveBean); } else { RouteUtil.forwardUserHome(getActivity(), liveId, 0); - getActivity().finish(); } } }); @@ -219,6 +232,6 @@ public class SidebarLiveAudience extends AbsDialogFragment { super.onDismiss(dialog); Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.REFRESH_THE_LIVEl_PAGE) - ); + ); } } diff --git a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java index 1471ca115..0626a282d 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -3,6 +3,7 @@ package com.yunbao.live.event; import com.yunbao.common.bean.ActiveModel; import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.BaseModel; +import com.yunbao.live.bean.LiveBean; import com.yunbao.live.bean.OpenParametersModel; public class LiveAudienceEvent extends BaseModel { @@ -11,6 +12,46 @@ public class LiveAudienceEvent extends BaseModel { private String avatar = ""; private OpenParametersModel parametersModel = new OpenParametersModel(); private AnchorRecommendItemModel anchorRecommendItemModel = new AnchorRecommendItemModel(); + private int micIng = 0;//连麦状态 + private LiveBean bean; + private int liveType; + private int liveTypeVal; + + public int getLiveType() { + return liveType; + } + + public LiveAudienceEvent setLiveType(int liveType) { + this.liveType = liveType; + return this; + } + + public int getLiveTypeVal() { + return liveTypeVal; + } + + public LiveAudienceEvent setLiveTypeVal(int liveTypeVal) { + this.liveTypeVal = liveTypeVal; + return this; + } + + public LiveBean getBean() { + return bean; + } + + public LiveAudienceEvent setBean(LiveBean bean) { + this.bean = bean; + return this; + } + + public int getMicIng() { + return micIng; + } + + public LiveAudienceEvent setMicIng(int micIng) { + this.micIng = micIng; + return this; + } public AnchorRecommendItemModel getAnchorRecommendItemModel() { return anchorRecommendItemModel; diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 24c2f8dac..3f5a15c81 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -61,7 +61,6 @@ import org.greenrobot.eventbus.ThreadMode; import java.util.Locale; import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.functions.Consumer; import io.reactivex.schedulers.Schedulers; /** @@ -377,7 +376,14 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { NewPeopleInfo peopleInfo = stringResponseModel.getData().getInfo(); if (peopleInfo.getIsShow()) { liveNewPeople.setVisibility(View.VISIBLE); - newPeopleUrl = peopleInfo.getLink(); + if(peopleInfo.getLink().startsWith("http")){ + newPeopleUrl = peopleInfo.getLink(); + if(!newPeopleUrl.contains("?")){ + newPeopleUrl+="?"; + } + }else { + newPeopleUrl = CommonAppConfig.HOST + peopleInfo.getLink(); + } } }, Throwable::printStackTrace).isDisposed(); } @@ -410,7 +416,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { showTrickeryDialog(); }else if (i==R.id.live_new_people){ Bundle bundle=new Bundle(); - String url= newPeopleUrl+"?g=Appapi&m=Turntable&a=tricky"; + String url= newPeopleUrl+"&g=Appapi&m=Turntable&a=tricky"; url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + mLiveUid; bundle.putString("url", url); diff --git a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java index 5b03ccc87..50fbf8d0a 100644 --- a/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LivePlayRyViewHolder.java @@ -415,7 +415,6 @@ public class LivePlayRyViewHolder extends LiveRoomPlayViewHolder { @Subscribe(threadMode = ThreadMode.MAIN) public void onUpdata(String str) { - ToastUtil.show("121212"); if ("UsertoRY".equals(str)) { DialogUitl.showSimpleDialog(mContext, WordUtil.getString(R.string.mic_tag), new DialogUitl.SimpleCallback() { @Override diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 56e60553f..c95f388e4 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -112,10 +112,10 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; +import java.util.Random; import pl.droidsonroids.gif.GifImageView; -import static com.blankj.utilcode.util.ActivityUtils.startActivity; import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; @@ -251,6 +251,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private RecyclerView fastMsgRecyclerView; private LiveRoomFastMessageRecyclerViewAdapter fastMessageRecyclerViewAdapter; + private LiveUserGiftBean nowGuardUser; + private ViewFlipper wishListFlipper; + private List wishlist = new ArrayList<>(); + public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) { super(context, parentView); Contexts = context; @@ -850,17 +854,18 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); loadWishlistData(); //打开活动窗口 - ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", ""))); + ViewClicksAntiShake.clicksAntiShake(wishListLayout, () -> mContext.startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", ""))); //打招呼消息 fastMsgRecyclerView = (RecyclerView) findViewById(R.id.room_fast_msg); - fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.HORIZONTAL,false)); - fastMessageRecyclerViewAdapter=new LiveRoomFastMessageRecyclerViewAdapter(mContext); + fastMsgRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false)); + fastMessageRecyclerViewAdapter = new LiveRoomFastMessageRecyclerViewAdapter(mContext); fastMsgRecyclerView.setAdapter(fastMessageRecyclerViewAdapter); fastMessageRecyclerViewAdapter.setMessageListener(msg -> { //点击的消息发送出去 ((LiveActivity) mContext).sendChatMessage(msg); + fastMsgRecyclerView.setVisibility(View.GONE); }); - fastMsgRecyclerView.setItemAnimator(new DefaultItemAnimator()); + // fastMsgRecyclerView.setItemAnimator(new DefaultItemAnimator()); } private void showBanner2() { @@ -1040,24 +1045,66 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis */ public void initWishList(List wishlist) { if (wishlist.size() > 0) { + this.wishlist = wishlist; wishListLayout.setVisibility(View.VISIBLE); } else { wishListLayout.setVisibility(View.GONE); } ((Activity) mContext).runOnUiThread(() -> { - ViewFlipper wishListFlipper = (ViewFlipper) findViewById(R.id.wish_list); + wishListFlipper = (ViewFlipper) findViewById(R.id.wish_list); for (int i = 0; i < wishlist.size(); i++) { View wish = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + wish.setTag(wishlist.get(i).getId()); ImageView wishPic = wish.findViewById(R.id.wish_pic); TextView wishIndex = wish.findViewById(R.id.wish_index); ImgLoader.display(mContext, wishlist.get(i).getWishlistIcon(), wishPic); - wishIndex.setText((i + 1) + "/" + wishlist.size()); + wishIndex.setText(wishlist.get(i).getWishlistNumP()); wishListFlipper.addView(wish); } wishListFlipper.startFlipping(); }); + } + /** + * 初始化小时榜。 + * 等待接口 + * TextView得独立出来用来替换数字 + */ + protected void initHourRankList(){ + ((Activity)mContext).runOnUiThread(()->{ + ViewFlipper flipper= (ViewFlipper) findViewById(R.id.hour_rank_list); + for (int i = 0; i < 2; i++) { + LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(DpUtil.dp2px(44),DpUtil.dp2px(16)); + View wish = LayoutInflater.from(mContext).inflate(R.layout.view_wish_list, null); + ImageView wishPic = wish.findViewById(R.id.wish_pic); + TextView wishIndex = wish.findViewById(R.id.wish_index); + if(i==0) { + wishPic.setImageResource(R.drawable.live_tags_hot); + }else{ + wishPic.setImageResource(R.drawable.live_tags_hour_list); + } + wishPic.setLayoutParams(params); + wishIndex.setText(new Random().nextInt(5000)+""); + flipper.addView(wish); + } + flipper.startFlipping(); + }); + } - + /** + * 更新心愿单进度 + * + * @param giftId 礼物ID + * @param giftCount 礼物数量 + */ + public void updataWishList(String giftId, int giftCount) { + for (WishlistItemModel model : wishlist) { + if (TextUtils.equals(giftId, model.getLid())) { + int number = Integer.parseInt(model.getWishlistProgress()) + giftCount; + model.setWishlistProgress(String.valueOf(number)); + } + } + wishListFlipper.removeAllViews(); + initWishList(wishlist); } //点击头像 @@ -1413,6 +1460,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private void setGuardIcon(LiveUserGiftBean guard) { if (guard != null) { + nowGuardUser = guard; ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard); gift_svga.setVisibility(View.VISIBLE); } @@ -1472,7 +1520,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis //直播间 粉丝排行榜 openMedalRankWindow(); } else if (i == R.id.btn_guard) { - ((LiveActivity) mContext).openGuardListWindow(); + ((LiveActivity) mContext).openNewGuardListWindow(); } else if (i == R.id.btn_red_pack) { ((LiveActivity) mContext).openRedPackListWindow(); @@ -1492,7 +1540,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis ((LiveActivity) mContext).openHotListWindow(1); } else if (i == R.id.user_guard) { // ((LiveActivity) mContext).openUserMoreListWindow(2, true); - ((LiveActivity) mContext).openGuardListWindow(); + ((LiveActivity) mContext).openNewGuardListWindow(); } } @@ -1663,7 +1711,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis public void refreshUserList(JSONObject obj) { List list = JSON.parseArray(obj.getString("userlist"), LiveUserGiftBean.class); mLiveUserAdapter.refreshList(list); - getGuardInfo(); } /** @@ -1772,6 +1819,25 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis mLiveEnterRoomAnimPresenter.enterRoom(bean); } room_hot.setText(formatBigNum.formatBigNum(bean.getLiveChatBean().getHot_num())); + LiveUserGiftBean chatBean = bean.getUserBean(); + if (chatBean != null && nowGuardUser != null) { + LiveUserGiftBean tmp = null; + if (chatBean.getGuardType() != 0 && chatBean.getGuardType() > nowGuardUser.getGuardType()) { + tmp = chatBean; + } else if (chatBean.getGuardType() != 0 && chatBean.getGuardType() == nowGuardUser.getGuardType() && chatBean.getLevel() > nowGuardUser.getLevel()) { + tmp = chatBean; + } + setGuardIcon(tmp); + } + } + + /** + * 用户离开房间 + * + * @param bean 用户 + */ + public void onExitRoom(UserBean bean) { + // getGuardInfo(); } /** diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index 79905adfb..49fc3f1a3 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -5,6 +5,8 @@ import android.app.Dialog; import android.content.Intent; import android.content.res.Configuration; import android.os.CountDownTimer; +import android.os.Handler; +import android.os.Looper; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; @@ -35,6 +37,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; +import com.yunbao.common.http.HttpClient; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DialogUitl; @@ -63,27 +66,39 @@ import com.yunbao.live.dialog.BlowkissDialog; import com.yunbao.live.dialog.NewUserDialog; import com.yunbao.live.event.LinkMicTxAccEvent; import com.yunbao.live.event.LiveAudienceEvent; +import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.presenter.LiveLinkMicAnchorPresenter; -import com.yunbao.live.presenter.LiveLinkMicPkPresenter; import com.yunbao.live.presenter.LiveLinkMicPresenter; import com.yunbao.live.presenter.LiveRyLinkMicPkPresenter; import com.yunbao.live.socket.SocketClient; import com.yunbao.live.socket.SocketMessageListener; import com.yunbao.live.socket.SocketRyChatUtil; import com.yunbao.live.socket.SocketRyClient; +import com.yunbao.live.socket.SocketSendBean; +import com.yunbao.live.utils.LiveImDeletUtil; import org.greenrobot.eventbus.EventBus; +import java.util.ArrayList; import java.util.List; +import cn.rongcloud.rtc.api.RCRTCEngine; +import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback; +import cn.rongcloud.rtc.api.callback.IRCRTCSwitchRoleCallback; +import cn.rongcloud.rtc.base.RTCErrorCode; +import io.rong.imlib.IRongCallback; import io.rong.imlib.IRongCoreCallback; import io.rong.imlib.IRongCoreEnum; +import io.rong.imlib.RongIMClient; import io.rong.imlib.chatroom.base.RongChatRoomClient; +import io.rong.imlib.model.Conversation; +import io.rong.message.TextMessage; import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; +import static com.yunbao.live.views.LivePlayRyViewHolder.Micing; import static com.yunbao.live.views.LiveRoomViewHolder.isStayRoomfive; /** @@ -123,8 +138,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe //主播与主播连麦逻辑 private LiveLinkMicAnchorPresenter mLiveLinkMicAnchorPresenter; //主播与主播PK逻辑 - private LiveLinkMicPkPresenter mLiveLinkMicPkPresenter; - //主播与主播PK逻辑 private LiveRyLinkMicPkPresenter mLiveRyLinkMicPkPresenter; //直播间的类型 普通 密码 门票 计时等 private int mLiveType; @@ -150,10 +163,13 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe private boolean mCoinNotEnough;//余额不足 private boolean mFirstConnectSocket;//是否是第一次连接成功socket private int liveBg; + private LiveImDeletUtil liveImDeletUtil; + private List greetings = new ArrayList<>(); public PortraitLiveManager(Activity context, Intent intent) { this.mContext = context; this.mIntent = intent; + liveImDeletUtil = new LiveImDeletUtil(); ininView(); } @@ -203,8 +219,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe .setmLiveType(mLiveType) .setmLiveTypeVal(mLiveTypeVal))); - mLivePlayViewHolder = new LivePlayKsyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0)); - + mLivePlayViewHolder = new LivePlayRyViewHolder(mContext, playContainer, mIntent.getIntExtra("landscape", 0)); mLivePlayViewHolder.addToParent(); mLivePlayViewHolder.subscribeActivityLifeCycle(); mLiveRoomViewHolder = new LiveRoomViewHolder(false, 1, mContext, mContainer, mSecondPage.findViewById(R.id.gift_gif), mSecondPage.findViewById(R.id.gift_svga), mContainerWrap, mContext.getWindowManager()); @@ -252,6 +267,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe enterRoom(); } }); + mLiveRoomViewHolder.initHourRankList(); } @Override @@ -307,9 +323,6 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (mLiveLinkMicAnchorPresenter != null) { mLiveLinkMicAnchorPresenter.clearData(); } - if (mLiveLinkMicPkPresenter != null) { - mLiveLinkMicPkPresenter.clearData(); - } if (mLiveRyLinkMicPkPresenter != null) { mLiveRyLinkMicPkPresenter.clearData(); } @@ -366,9 +379,146 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe } + /** + * 申请连麦但是主播还未同意的状态 + */ + public void micIngTypeOne(LiveBean bean, int liveType, int liveTypeVal) { + DialogUitl.showSimpleDialog(mContext, null, "您已申請,退出將取消語音連麥申請!", false, new DialogUitl.SimpleCallback3() { + @Override + public void onConfirmClick(Dialog dialog) { + Micing = 0; + //用户申请联麦 + final SocketSendBean msg = new SocketSendBean() + .param("_method_", Constants.LIAN_MAI) + .param("action", 7) + .param("uname", CommonAppConfig.getInstance().getUserBean().getUserNiceName()) + .param("avatar", CommonAppConfig.getInstance().getUserBean().getAvatar()) + .param("uid", CommonAppConfig.getInstance().getUid()); + msg.create(); + + Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE; + TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); + io.rong.imlib.model.Message message = io.rong.imlib.model.Message.obtain(liveID, conversationType, messageContent); + + RongIMClient.getInstance().sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + @Override + public void onAttached(io.rong.imlib.model.Message message) { + + } + + @Override + public void onSuccess(io.rong.imlib.model.Message message) { + Log.e("ry", "发送成功"); + liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId()); + if (isBackPressed) { + ((LiveAudienceActivity) mContext).onBackPressed(); + } else { + EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal)); + } + } + + @Override + public void onError(io.rong.imlib.model.Message message, RongIMClient.ErrorCode errorCode) { + Log.e("ry", "发送失敗" + errorCode.toString()); + liveImDeletUtil.deleteMessages(message.getTargetId(), message.getMessageId()); + } + }); + } + + @Override + public void onCancel() { + ((LiveAudienceActivity) mContext).setEnableScroll(true); + } + }); + + + } + + /** + * 正处于连麦中 + */ + public void micIngTypeTwo(LiveBean bean, int liveType, int liveTypeVal) { + DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() { + @Override + public void onConfirmClick(Dialog dialog) { + ToastUtil.show("下麥中,稍等....."); + RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() { + + /** + * 当切换失败且SDK处于无法回退状态时回调,该角色已经无法使用当前角色继续进行音视频。 + * SDK内部会退出房间并清理所有资源,该用户只能重新加入房间才能继续音视频。 + */ + @Override + public void onKicked() { + + } + + @Override + public void onSuccess() { + Log.e("ry", "下麦成功"); + // 该用户切换为观众成功,可以以观众身份进行音视频 + //退出多人房间 + HttpClient.getInstance().get("live.leaveDrLm", "live.leaveDrLm") + .params("roomid", liveID) + .execute(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + Log.e("ry", code + "退出多人"); + + } + }); + //退出rtc播放 + RCRTCEngine.getInstance().leaveRoom(new IRCRTCResultCallback() { + @Override + public void onSuccess() { + Log.e("ry", "退出多人房间成功"); + new Handler(Looper.getMainLooper()).post(new Runnable() { + public void run() { + Micing = 0; + } + }); + if (isBackPressed) { + ((LiveAudienceActivity) mContext).onBackPressed(); + } else { + EventBus.getDefault().post(new LiveRoomChangeEvent(bean, liveType, liveTypeVal)); + } + } + + @Override + public void onFailed(RTCErrorCode errorCode) { + Log.e("ry", errorCode + "退出多人房间失敗"); + + } + }); + + } + + /** + * 当切换失败且不影响当前角色继续音视频时回调 + * @param errorCode 失败错误码 + */ + @Override + public void onFailed(RTCErrorCode errorCode) { + Log.e("ry", "下麦失败" + errorCode); + + } + }); + } + + @Override + public void onCancel() { + ((LiveAudienceActivity) mContext).setEnableScroll(true); + } + }); + + } + + //是否处于返回键 + private boolean isBackPressed = false; + @Override public void onBackPressed() { - + isBackPressed = true; } @Override @@ -426,9 +576,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveLinkMicPresenter.onAudienceLeaveRoom(bean); } try { - if (mLiveRoomViewHolder.room_hot != null) { - if (!"".equals(bean.getHot_num()) && !"0".equals(bean.getHot_num())) { - mLiveRoomViewHolder.room_hot.setText(formatBigNum.formatBigNum(bean.getHot_num())); + if (mLiveRoomViewHolder != null) { + mLiveRoomViewHolder.onExitRoom(bean); + if (mLiveRoomViewHolder.room_hot != null) { + if (!"".equals(bean.getHot_num()) && !"0".equals(bean.getHot_num())) { + mLiveRoomViewHolder.room_hot.setText(formatBigNum.formatBigNum(bean.getHot_num())); + } } } } catch (Exception ignored) { @@ -444,13 +597,15 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.showGuardGifMessage(bean); } } else { + if (mLiveRoomViewHolder != null) { if (bean.getmLiveUId().equals(bean.getRoomnum())) { mLiveRoomViewHolder.insertChat(bean.getLiveChatBean(), 1); } mLiveRoomViewHolder.showGiftMessage(bean, false); - + mLiveRoomViewHolder.updataWishList(bean.getGiftId(), bean.getGiftCount()); } + } } @@ -750,7 +905,8 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe @Override public void onUpUserList(JSONObject obj) { - mLiveRoomViewHolder.refreshUserList(obj); + if (obj != null && mLiveRoomViewHolder != null) + mLiveRoomViewHolder.refreshUserList(obj); } @Override @@ -803,7 +959,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe LiveHttpUtil.enterRoom(mLiveBean.getUid(), mLiveBean.getStream(), new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - List greetings; + if (code == 0 && info.length > 0) { JSONObject obj = JSON.parseObject(info[0]); mDanmuPrice = obj.getString("barrage_fee"); @@ -811,7 +967,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mChatLevel = obj.getIntValue("speak_limit"); mDanMuLevel = obj.getIntValue("barrage_limit"); liveBg = obj.getIntValue("live_bg"); - greetings = JSONArray.parseArray(obj.getJSONArray("greetings").toJSONString(), String.class); + if (obj.containsKey("greetings")) { + greetings = JSONArray.parseArray(obj.getJSONArray("greetings").toJSONString(), String.class); + } + if (liveBg == 1) { //直播间背景 ImgLoader.displayBlurLive(mContext, mLiveBean.getAvatar(), liveBack); @@ -968,23 +1127,14 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe if (mLiveRoomViewHolder != null) { mLiveRoomViewHolder.setOtherInfo(pkInfo.getString("pkuid"), pkInfo.getString("pkuimg"), pkInfo.getString("pkuname")); } - if (mLiveLinkMicPkPresenter != null) { - mLiveLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean); - } else { - mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean); - } + mLiveRyLinkMicPkPresenter.onEnterRoomPkStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("pk_time"), livePKUserListBean); } else if (!pkInfo.getString("end_pk_time").equals("0")) { LivePlayRyViewHolder.setViewUP(3); //pk排名数据 LivePKUserListBean livePKUserListBean = JSON.parseObject(pkInfo.getString("pk_top_users"), LivePKUserListBean.class); - if (mLiveLinkMicPkPresenter != null) { - mLiveLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean); - } else { - mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean); - - } + mLiveRyLinkMicPkPresenter.onEnterRoomCFStart(pkUid, pkInfo.getLongValue("pk_gift_liveuid"), pkInfo.getLongValue("pk_gift_pkuid"), pkInfo.getIntValue("end_pk_time"), livePKUserListBean); } //多人PK } else if (pkInfo != null && pkInfo.getIntValue("drpk_status") == 1) { diff --git a/live/src/main/res/drawable/bg_hour_rank_list.xml b/live/src/main/res/drawable/bg_hour_rank_list.xml new file mode 100644 index 000000000..1306ca2af --- /dev/null +++ b/live/src/main/res/drawable/bg_hour_rank_list.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_new_guard_but.xml b/live/src/main/res/drawable/bg_new_guard_but.xml new file mode 100644 index 000000000..6b46ce82e --- /dev/null +++ b/live/src/main/res/drawable/bg_new_guard_but.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/guardian_img_two.png b/live/src/main/res/drawable/guardian_img_two.png new file mode 100644 index 000000000..e596bc84c Binary files /dev/null and b/live/src/main/res/drawable/guardian_img_two.png differ diff --git a/live/src/main/res/drawable/guardian_img_wings_p.png b/live/src/main/res/drawable/guardian_img_wings_p.png new file mode 100644 index 000000000..ba82895f1 Binary files /dev/null and b/live/src/main/res/drawable/guardian_img_wings_p.png differ diff --git a/live/src/main/res/drawable/icon_top_up.png b/live/src/main/res/drawable/icon_top_up.png new file mode 100644 index 000000000..32d63b8b0 Binary files /dev/null and b/live/src/main/res/drawable/icon_top_up.png differ diff --git a/live/src/main/res/drawable/live_icon_right_more.png b/live/src/main/res/drawable/live_icon_right_more.png new file mode 100644 index 000000000..b1f82a27c Binary files /dev/null and b/live/src/main/res/drawable/live_icon_right_more.png differ diff --git a/live/src/main/res/drawable/live_tags_hot.png b/live/src/main/res/drawable/live_tags_hot.png new file mode 100644 index 000000000..572dd2a2c Binary files /dev/null and b/live/src/main/res/drawable/live_tags_hot.png differ diff --git a/live/src/main/res/drawable/live_tags_hour_list.png b/live/src/main/res/drawable/live_tags_hour_list.png new file mode 100644 index 000000000..4bc867303 Binary files /dev/null and b/live/src/main/res/drawable/live_tags_hour_list.png differ diff --git a/live/src/main/res/layout/dialog_guard_list.xml b/live/src/main/res/layout/dialog_guard_list.xml index 6b97a3ee6..cdce9303d 100644 --- a/live/src/main/res/layout/dialog_guard_list.xml +++ b/live/src/main/res/layout/dialog_guard_list.xml @@ -56,11 +56,10 @@ android:layout_height="match_parent" android:layout_marginLeft="10dp" android:layout_toLeftOf="@id/btn_buy" + android:background="#161616" android:gravity="center_vertical" android:textColor="@color/gray1" - android:textSize="12sp" - android:background="#161616" - /> + android:textSize="12sp" /> diff --git a/live/src/main/res/layout/dialog_new_guard_buy.xml b/live/src/main/res/layout/dialog_new_guard_buy.xml index 702310ae3..9e881af6b 100644 --- a/live/src/main/res/layout/dialog_new_guard_buy.xml +++ b/live/src/main/res/layout/dialog_new_guard_buy.xml @@ -118,19 +118,21 @@ + app:layout_constraintStart_toStartOf="parent" + tools:visibility="gone"> + android:textSize="14sp" + android:visibility="gone" /> + + + + + + + + + + + + +