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 3efff68d3..c52a984e8 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -92,6 +92,7 @@ import com.yunbao.live.dialog.LiveFansFragment; import com.yunbao.live.dialog.LiveGameDialogFragment; import com.yunbao.live.dialog.LiveGiftDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment; +import com.yunbao.live.dialog.LiveInputDialogFragment; import com.yunbao.live.dialog.LiveMicUserDialogFragment; import com.yunbao.live.dialog.LiveTotalDialog; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; @@ -1408,11 +1409,27 @@ public class LiveAudienceActivity extends LiveActivity { manager.redPacketManage(event.getRedPacketModel()); } break; - case RED_PACKET_SUPER_JACKPOT: + case RED_PACKET_SUPER_JACKPOT: if (manager != null) { manager.setRedPacketInfoModel(event.getRedPacketInfoModel()); } break; + case INPUT_DIALOG: + LiveInputDialogFragment liveInputDialogFragment = new LiveInputDialogFragment(); + Bundle liveInputBundle = new Bundle(); + liveInputBundle.putString(Constants.LIVE_DANMU_PRICE, mDanmuPrice); + liveInputBundle.putString(Constants.COIN_NAME, mCoinName); + liveInputBundle.putString(Constants.LIVE_UID, mLiveUid); + liveInputBundle.putString(Constants.LIVE_STREAM, mStream); + liveInputBundle.putString(Constants.LIVE_UID, mLiveUid); + if (event.getOlineUserlistModel() == null) { + liveInputBundle.putString("TagUser", ""); + } else { + liveInputBundle.putString("TagUser", GsonUtils.toJson(event.getOlineUserlistModel())); + } + liveInputDialogFragment.setArguments(liveInputBundle); + liveInputDialogFragment.show(getSupportFragmentManager(), "LiveInputDialogFragment"); + break; } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index 60177c90e..2ebb8c568 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -41,6 +41,7 @@ import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.bean.OlineUserlistModel; import com.yunbao.common.custom.VerticalImageSpan; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.interfaces.OnItemClickListener; @@ -236,6 +237,20 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } void setData(final LiveChatBean bean, int position) { + itemView.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + if (!TextUtils.isEmpty(bean.getId())&&!TextUtils.isEmpty(bean.getUserNiceName())){ + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.INPUT_DIALOG) + .setOlineUserlistModel(new OlineUserlistModel().setId(bean.getId()).setUserNicename(bean.getUserNiceName()))); + + } + + Log.e("eqwewqeweq", bean.toString()); + return true; + } + }); mTextView.setTextSize(fountSize); automatic_chat.setTextSize(fountSize); itemView.setTag(bean); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java index 3df086e38..265dfb616 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java @@ -26,9 +26,11 @@ import android.widget.RadioGroup; import androidx.fragment.app.FragmentActivity; +import com.blankj.utilcode.util.GsonUtils; import com.yunbao.common.Constants; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.NobleTrumpetModel; +import com.yunbao.common.bean.OlineUserlistModel; import com.yunbao.common.custom.MyRadioButton; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.event.LiveInputEvent; @@ -37,7 +39,6 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; -import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.AtTextWatcher; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; @@ -168,9 +169,10 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O } String danmuPrice = bundle.getString(Constants.LIVE_DANMU_PRICE); String coinName = bundle.getString(Constants.COIN_NAME); + mLiveUid = bundle.getString(Constants.LIVE_UID); - mHint1 =mContext.getString(R.string.live_open_alba) + danmuPrice + coinName + "/" +mContext.getString(R.string.live_tiao); - mHint2 =mContext.getString(R.string.live_say_something); + mHint1 = mContext.getString(R.string.live_open_alba) + danmuPrice + coinName + "/" + mContext.getString(R.string.live_tiao); + mHint2 = mContext.getString(R.string.live_say_something); mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton button, boolean isChecked) { @@ -195,7 +197,16 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O } }); atTextWatcher = new AtTextWatcher(); + if (!TextUtils.isEmpty(bundle.getString("TagUser"))) { + OlineUserlistModel olineUserlistModel = GsonUtils.fromJson(bundle.getString("TagUser"), OlineUserlistModel.class); + atTextWatcher.insertTextForAt(olineUserlistModel, mInput); + new Handler().postDelayed(() -> { + mInput.requestFocus(); + //软键盘弹出 + imm.showSoftInput(mInput, InputMethodManager.SHOW_FORCED); + }, 600); + } } @Override @@ -218,19 +229,19 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O .nobleUseTrumpet(trumpetMsg, mLiveUid, new HttpCallback>() { @Override public void onSuccess(List data) { - // dismiss(); + // dismiss(); ToastUtil.show(getResources().getString(R.string.use_successfully)); } @Override public void onError(String error) { - // dismiss(); + // dismiss(); ToastUtil.show(error); } }); } else { ToastUtil.show(R.string.enough_speakers); - // dismiss(); + // dismiss(); } break; @@ -243,7 +254,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O /* if (imm != null) {//收软键盘 imm.hideSoftInputFromWindow(mInput.getWindowToken(), 0); }*/ - // dismiss(); + // dismiss(); break; } mInput.setText(""); @@ -312,7 +323,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O messageType = SendMessageType.POPUPSCREEN; } else { radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(worldHornP, null, null, null); - mInput.setHint(String.format(mContext.getString(R.string.whole_station_horn_hint), trumpetNum)); + mInput.setHint(String.format(mContext.getString(R.string.whole_station_horn_hint), trumpetNum + "")); messageType = SendMessageType.WORLDHORN; } } else { @@ -367,7 +378,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O @Override public void onError(String error) { - ToastUtil.show( R.string.net_error); + ToastUtil.show(R.string.net_error); } }); } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java index dc3c779cc..3d3eb8bbb 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -4,7 +4,6 @@ import android.app.Dialog; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Bundle; - import android.text.TextUtils; import android.util.Log; import android.view.Gravity; @@ -29,13 +28,14 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.FansMedalBean; import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.OlineUserlistModel; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; -import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DialogUitl; @@ -45,11 +45,11 @@ import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveReportActivity; import com.yunbao.live.activity.LiveRyAnchorActivity; -import com.yunbao.common.bean.LiveBean; import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpUtil; @@ -265,6 +265,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } });*/ + } private void initListener() { @@ -498,7 +499,17 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } } - + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.ai_te), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (!TextUtils.isEmpty(mUserBean.getId()) && !TextUtils.isEmpty(mUserBean.getUserNiceName())) { + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.INPUT_DIALOG) + .setOlineUserlistModel(new OlineUserlistModel().setId(mUserBean.getId()).setUserNicename(mUserBean.getUserNiceName()))); + dismiss(); + } + } + }); } private void updateFollow() { @@ -557,7 +568,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On updateFollow(); if (isAttention == 1 && mLiveUid.equals(mToUid)) {//关注了主播 ((LiveActivity) mContext).sendSystemMessage( - CommonAppConfig.getInstance().getUserBean().getUserNiceName() +mContext.getString(R.string.live_follow_anchor)); + CommonAppConfig.getInstance().getUserBean().getUserNiceName() + mContext.getString(R.string.live_follow_anchor)); } } }); @@ -674,7 +685,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On if (isAnchor) { dismiss(); ((LiveActivity) mContext).openFansWindow(mToUid); - }else{ + } else { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.NOBLE)); } @@ -758,7 +769,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else if (tag == R.string.live_setting_close_live_2) {//禁用直播 closeLive2(); - } else if (tag==R.string.live_setting_gap_3){ + } else if (tag == R.string.live_setting_gap_3) { setShutUp3(); } } @@ -857,14 +868,15 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On dismiss(); LiveHttpUtil.superCloseRoom(mLiveUid, 1, mSuperCloseRoomCallback); } - private void setShutUp3(){ + + private void setShutUp3() { new LiveSettingSilenceDialog(mContext) .setItemClickListener((bean, position) -> { - LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, bean+"",new HttpCallback() { + LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, bean + "", new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { if (code == 0) { - ((LiveActivity) mContext).setShutUp(mToUid, mToName, 2,bean); + ((LiveActivity) mContext).setShutUp(mToUid, mToName, 2, bean); dismiss(); } else { ToastUtil.show(msg); 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 39bf9fb48..712463b10 100644 --- a/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java +++ b/live/src/main/java/com/yunbao/live/event/LiveAudienceEvent.java @@ -7,6 +7,7 @@ import com.yunbao.common.bean.AnchorRecommendItemModel; import com.yunbao.common.bean.BaseModel; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.MsgModel; +import com.yunbao.common.bean.OlineUserlistModel; import com.yunbao.common.bean.RedPacketInfoModel; import com.yunbao.common.bean.RedPacketModel; import com.yunbao.common.bean.WishModel; @@ -47,6 +48,16 @@ public class LiveAudienceEvent extends BaseModel { private AllServerNotifyEvent allServerNotifyEvent; private RedPacketModel redPacketModel; private RedPacketInfoModel redPacketInfoModel; + private OlineUserlistModel olineUserlistModel; + + public OlineUserlistModel getOlineUserlistModel() { + return olineUserlistModel; + } + + public LiveAudienceEvent setOlineUserlistModel(OlineUserlistModel olineUserlistModel) { + this.olineUserlistModel = olineUserlistModel; + return this; + } public RedPacketInfoModel getRedPacketInfoModel() { return redPacketInfoModel; @@ -380,7 +391,8 @@ public class LiveAudienceEvent extends BaseModel { VOTE_END(67, "投票结束"), BLIND_BOX(68, "盲盒全服通知"), RED_PACKET(69, "RedPacket"), - RED_PACKET_SUPER_JACKPOT(70, "超级红包"); + RED_PACKET_SUPER_JACKPOT(70, "超级红包"), + INPUT_DIALOG(71, "输入框"); private int type; private String name; 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 ebca71e8f..d191a0f3b 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -1386,11 +1386,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private Runnable timeRunnable = new Runnable() { @Override public void run() { - if (redTimeCountdown > 0) { + if (redTimeCountdown > 1) { redTimeCountdown = redTimeCountdown - 1; timeHandler.postDelayed(timeRunnable, 1000); redPacketCountdown.setText(String.format(mContext.getString(R.string.red_packet_countdown), TimeUtils.getTime(redTimeCountdown))); } else { + redTimeCountdown = 0; timeHandler.removeCallbacks(timeRunnable); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(mRedPacketModel.getRedPacketRemain()) @@ -1492,6 +1493,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis @Override public void onSuccess(RedPacketInfoModel data) { if (TextUtils.equals(data.getReceiveStatus(), "0")) { + redTimeCountdown = redTimeCountdown - 1; new XPopup.Builder(mContext) .asCustom(new ReceiveRendPacketPopup(mContext, redTimeCountdown, mLiveUid, mStream, redPacketModel.getRedPacketId(), data, false)) .show(); diff --git a/live/src/main/res/drawable/background_fc6945.xml b/live/src/main/res/drawable/background_fc6945.xml new file mode 100644 index 000000000..e1d116ea5 --- /dev/null +++ b/live/src/main/res/drawable/background_fc6945.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_new_live_user.xml b/live/src/main/res/layout/dialog_new_live_user.xml index 5e99717cd..b10ddfbd1 100644 --- a/live/src/main/res/layout/dialog_new_live_user.xml +++ b/live/src/main/res/layout/dialog_new_live_user.xml @@ -1,7 +1,6 @@ @@ -20,18 +19,37 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + app:layout_constraintTop_toTopOf="parent"> + + + + + + + android:layout_marginStart="6dp" + android:orientation="horizontal"> + + + android:src="@mipmap/icon_user_card_t1" /> + + + android:src="@mipmap/icon_user_card_t2" />