新贵族喇叭

This commit is contained in:
18401019693 2022-08-01 17:55:43 +08:00
parent 84c8ecde30
commit ab3141f5f5
2 changed files with 40 additions and 17 deletions

View File

@ -1,7 +1,6 @@
package com.yunbao.live.dialog; package com.yunbao.live.dialog;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
@ -37,6 +36,7 @@ import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.http.LiveHttpUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -55,7 +55,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
private CheckBox mCheckBox; private CheckBox mCheckBox;
private MyRadioButton mMyRadioButton; private MyRadioButton mMyRadioButton;
private String mHint1; private String mHint1;
private String mHint2; private String mHint2, trumpetMsg;
private RadioGroup radioHornType; private RadioGroup radioHornType;
private int[] radioList = {R.id.btn_0, R.id.btn_1, R.id.btn_2}; private int[] radioList = {R.id.btn_0, R.id.btn_1, R.id.btn_2};
private List<RadioButton> radioHornTypes = new ArrayList<>(); private List<RadioButton> radioHornTypes = new ArrayList<>();
@ -67,6 +67,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
private long nobleId;//贵族等级 private long nobleId;//贵族等级
private long trumpetNum;//喇叭数量 private long trumpetNum;//喇叭数量
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.dialog_live_chat_input; return R.layout.dialog_live_chat_input;
@ -175,6 +176,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
public void onClick(View v) { public void onClick(View v) {
sendMessage(); sendMessage();
} }
//高级贵族 //高级贵族
private void sendMessage() { private void sendMessage() {
String content = mInput.getText().toString().trim(); String content = mInput.getText().toString().trim();
@ -184,7 +186,9 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
} }
switch (messageType) { switch (messageType) {
case WORLDHORN: case WORLDHORN:
trumpetMsg = content;
netHandler.post(nobleUseTrumpetRunnable);
dismiss();
break; break;
case POPUPSCREEN: case POPUPSCREEN:
((LiveActivity) mContext).sendDanmuMessage(content); ((LiveActivity) mContext).sendDanmuMessage(content);
@ -216,17 +220,17 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
@Override @Override
public void onCheckedChanged(RadioGroup group, int checkedId) { public void onCheckedChanged(RadioGroup group, int checkedId) {
changeCheckState(checkedId); changeCheckState(checkedId);
if (checkedId==R.id.btn_2) { if (checkedId == R.id.btn_2) {
if (nobleId<5){ if (nobleId < 5) {
imm.hideSoftInputFromWindow(mInput.getWindowToken(), 0); imm.hideSoftInputFromWindow(mInput.getWindowToken(), 0);
HighNobilityDialog fragment = new HighNobilityDialog(); HighNobilityDialog fragment = new HighNobilityDialog();
fragment.show(((FragmentActivity)mContext).getSupportFragmentManager(), "HighNobilityDialog"); fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HighNobilityDialog");
dismiss(); dismiss();
}
} }
}
} }
}; };
@ -304,8 +308,8 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
public void onSuccess(NobleTrumpetModel data) { public void onSuccess(NobleTrumpetModel data) {
nobleId = data.getNobleId(); nobleId = data.getNobleId();
trumpetNum = data.getTrumpetNum(); trumpetNum = data.getTrumpetNum();
Log.e("LiveInputDialogFragment","贵族等级:"+nobleId); Log.e("LiveInputDialogFragment", "贵族等级:" + nobleId);
Log.e("LiveInputDialogFragment","喇叭数量:"+trumpetNum); Log.e("LiveInputDialogFragment", "喇叭数量:" + trumpetNum);
} }
@Override @Override
@ -315,4 +319,16 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
}); });
} }
}; };
//发送全局喇叭
private Runnable nobleUseTrumpetRunnable = new Runnable() {
@Override
public void run() {
LiveHttpUtil.nobleUseTrumpet(trumpetMsg, new com.yunbao.common.http.HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
}
});
}
};
} }

View File

@ -5,7 +5,6 @@ import android.text.TextUtils;
import com.lzy.okgo.request.PostRequest; import com.lzy.okgo.request.PostRequest;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.CommonAppContext; import com.yunbao.common.CommonAppContext;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
@ -420,7 +419,7 @@ public class LiveHttpUtil {
String uid = IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getUserInfo().getId() + ""; String uid = IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getUserInfo().getId() + "";
String sign = MD5Util.getMD5("redid=" + redPackId + "&stream=" + stream + "&uid=" + uid + "&" + SALT); String sign = MD5Util.getMD5("redid=" + redPackId + "&stream=" + stream + "&uid=" + uid + "&" + SALT);
HttpClient.getInstance().get("Red.RobRed", LiveHttpConsts.ROB_RED_PACK) HttpClient.getInstance().get("Red.RobRed", LiveHttpConsts.ROB_RED_PACK)
.params("uid", uid,true) .params("uid", uid, true)
.params("stream", stream) .params("stream", stream)
.params("redid", redPackId) .params("redid", redPackId)
.params("sign", sign) .params("sign", sign)
@ -882,9 +881,17 @@ public class LiveHttpUtil {
/** /**
* 获取用户贵族喇叭的数量 * 获取用户贵族喇叭的数量
*/ */
public static void getNobleTrumpetNum( HttpCallback callback) { public static void getNobleTrumpetNum(HttpCallback callback) {
HttpClient.getInstance().get("Noble.getNobleTrumpetNum", "getNobleTrumpetNum") HttpClient.getInstance().get("Noble.getNobleTrumpetNum", "getNobleTrumpetNum")
.execute(callback); .execute(callback);
} }
/**
* 获取用户贵族喇叭的数量
*/
public static void nobleUseTrumpet(String trumpet_msg,HttpCallback callback) {
HttpClient.getInstance().get("Noble.nobleUseTrumpet", "nobleUseTrumpet")
.params("trumpet_msg", trumpet_msg)
.execute(callback);
}
} }