6.5.4版本更新-“@”功能优化

This commit is contained in:
18401019693 2023-07-18 13:48:37 +08:00
parent 410fcb5895
commit 3376a57f9d
8 changed files with 138 additions and 38 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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<List<BaseModel>>() {
@Override
public void onSuccess(List<BaseModel> 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);
}
});
}

View File

@ -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);

View File

@ -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;

View File

@ -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();

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="13dp" />
<solid android:color="#FC6945" />
</shape>
</item>
</selector>

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -20,18 +19,37 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/btn_report"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:layout_marginEnd="14dp"
android:gravity="center"
android:text="@string/report"
android:textColor="#B1B1B1"
android:visibility="visible"
android:gravity="end"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/btn_report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/report"
android:textColor="#B1B1B1"
android:visibility="visible" />
<TextView
android:id="@+id/ai_te"
android:layout_width="41dp"
android:layout_height="25dp"
android:layout_marginTop="10dp"
android:background="@drawable/background_fc6945"
android:gravity="center"
android:text="\@TA"
android:textColor="@color/white"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_guard"
@ -154,9 +172,9 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="17dp"
android:layout_gravity="center"
android:layout_marginTop="13dp"
android:gravity="center"
android:layout_gravity="center"
android:orientation="horizontal">
<ImageView
@ -231,11 +249,11 @@
android:layout_marginLeft="4dp" />
<androidx.constraintlayout.widget.ConstraintLayout
android:orientation="horizontal"
android:layout_width="46.5dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginStart="6dp">
android:layout_marginStart="6dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/user_card_lv_icon"
@ -292,28 +310,32 @@
android:layout_marginStart="6dp"
android:src="@mipmap/emperor_rom" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp">
<ImageView
android:src="@mipmap/icon_user_card_t1"
android:layout_width="17dp"
android:layout_height="14dp"
android:layout_gravity="top"
android:layout_height="14dp"/>
android:src="@mipmap/icon_user_card_t1" />
<TextView
android:id="@+id/sign"
android:text="這家夥很懶,什麽都沒留下"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="這家夥很懶,什麽都沒留下"
android:textColor="#B1B1B1"
android:textSize="14sp" />
<ImageView
android:src="@mipmap/icon_user_card_t2"
android:layout_width="17dp"
android:layout_height="14dp"
android:layout_gravity="bottom"
android:layout_height="14dp"/>
android:src="@mipmap/icon_user_card_t2" />
</LinearLayout>
<LinearLayout