From ab3141f5f5daaa4b527ee14ad80f0fdeea5beeda Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Mon, 1 Aug 2022 17:55:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E8=B4=B5=E6=97=8F=E5=96=87=E5=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/dialog/LiveInputDialogFragment.java | 44 +++++++++++++------ .../com/yunbao/live/http/LiveHttpUtil.java | 13 ++++-- 2 files changed, 40 insertions(+), 17 deletions(-) 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 b3b575f34..256f419ac 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveInputDialogFragment.java @@ -1,7 +1,6 @@ package com.yunbao.live.dialog; import android.app.Activity; -import android.content.Context; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Bundle; @@ -37,6 +36,7 @@ import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; +import com.yunbao.live.http.LiveHttpUtil; import java.util.ArrayList; import java.util.List; @@ -55,7 +55,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O private CheckBox mCheckBox; private MyRadioButton mMyRadioButton; private String mHint1; - private String mHint2; + private String mHint2, trumpetMsg; private RadioGroup radioHornType; private int[] radioList = {R.id.btn_0, R.id.btn_1, R.id.btn_2}; private List radioHornTypes = new ArrayList<>(); @@ -67,6 +67,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O private long nobleId;//贵族等级 private long trumpetNum;//喇叭数量 + @Override protected int getLayoutId() { return R.layout.dialog_live_chat_input; @@ -175,6 +176,7 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O public void onClick(View v) { sendMessage(); } + //高级贵族 private void sendMessage() { String content = mInput.getText().toString().trim(); @@ -184,7 +186,9 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O } switch (messageType) { case WORLDHORN: - + trumpetMsg = content; + netHandler.post(nobleUseTrumpetRunnable); + dismiss(); break; case POPUPSCREEN: ((LiveActivity) mContext).sendDanmuMessage(content); @@ -216,17 +220,17 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O @Override public void onCheckedChanged(RadioGroup group, int checkedId) { changeCheckState(checkedId); - if (checkedId==R.id.btn_2) { - if (nobleId<5){ - imm.hideSoftInputFromWindow(mInput.getWindowToken(), 0); - HighNobilityDialog fragment = new HighNobilityDialog(); - fragment.show(((FragmentActivity)mContext).getSupportFragmentManager(), "HighNobilityDialog"); - dismiss(); - } - - + if (checkedId == R.id.btn_2) { + if (nobleId < 5) { + imm.hideSoftInputFromWindow(mInput.getWindowToken(), 0); + HighNobilityDialog fragment = new HighNobilityDialog(); + fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HighNobilityDialog"); + dismiss(); } + + } + } }; @@ -304,8 +308,8 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O public void onSuccess(NobleTrumpetModel data) { nobleId = data.getNobleId(); trumpetNum = data.getTrumpetNum(); - Log.e("LiveInputDialogFragment","贵族等级:"+nobleId); - Log.e("LiveInputDialogFragment","喇叭数量:"+trumpetNum); + Log.e("LiveInputDialogFragment", "贵族等级:" + nobleId); + Log.e("LiveInputDialogFragment", "喇叭数量:" + trumpetNum); } @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) { + + } + }); + } + }; } diff --git a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java index ba701c16f..220332f08 100644 --- a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java +++ b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java @@ -5,7 +5,6 @@ import android.text.TextUtils; import com.lzy.okgo.request.PostRequest; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; -import com.yunbao.common.bean.UserBean; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; @@ -420,7 +419,7 @@ public class LiveHttpUtil { String uid = IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getUserInfo().getId() + ""; String sign = MD5Util.getMD5("redid=" + redPackId + "&stream=" + stream + "&uid=" + uid + "&" + SALT); HttpClient.getInstance().get("Red.RobRed", LiveHttpConsts.ROB_RED_PACK) - .params("uid", uid,true) + .params("uid", uid, true) .params("stream", stream) .params("redid", redPackId) .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") .execute(callback); } + /** + * 获取用户贵族喇叭的数量 + */ + public static void nobleUseTrumpet(String trumpet_msg,HttpCallback callback) { + HttpClient.getInstance().get("Noble.nobleUseTrumpet", "nobleUseTrumpet") + .params("trumpet_msg", trumpet_msg) + .execute(callback); + } }