diff --git a/main/src/main/res/mipmap-xxhdpi/ic_zl_rule.png b/common/src/main/res/mipmap-xxhdpi/ic_zl_rule.png similarity index 100% rename from main/src/main/res/mipmap-xxhdpi/ic_zl_rule.png rename to common/src/main/res/mipmap-xxhdpi/ic_zl_rule.png diff --git a/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java index a00862fad..83901573b 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java @@ -17,6 +17,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; @@ -148,11 +149,11 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter { if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - DialogUitl.showSimpleInputDialog(mContext, "填寫整蠱內容", DialogUitl.INPUT_TYPE_TEXT, 10, new DialogUitl.SimpleCallback() { + DialogUitl.showSimpleInputDialog(mContext, WordUtil.isNewZh() ? "填寫整蠱內容" : "prank content", DialogUitl.INPUT_TYPE_TEXT, 10, new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { if (WordUtil.isSpecialChar(content)) { - ToastUtil.show("整蠱內容不能包含特殊字符"); + ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容不能包含特殊字符" : "The prank content must not contain special characters"); return; } if (content.length() >= 2 && content.length() <= 10) { @@ -205,6 +206,33 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter() { @Override @@ -141,7 +144,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } } }); - mPrankBtn.setOnClickListener(view -> { +/* mPrankBtn.setOnClickListener(view -> { if ((int) view.getTag() == 1) { if (giftBeans != null && giftBeans.size() >= 20) { @@ -173,17 +176,52 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } else { setPrankConfig(); } + });*/ + + ViewClicksAntiShake.clicksAntiShake(mPrankBtn, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (mPrankBtn.getTag() != null && Integer.parseInt(mPrankBtn.getTag().toString()) == 0) { + SocketRyChatUtil.sendPrankIcon(); + } else { + + } + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_save), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if ((int) mPrankBtn.getTag() == 0) { + setPrankConfig(); + } else { + + } + + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_clear), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if ((int) mPrankBtn.getTag() == 0) { + clearPrankConfig(); + } else { + giftBeans = new ArrayList<>(); + recyclerAdapter.setList(giftBeans); + recyclerAdapter.notifyDataSetChanged(); + } + } }); mPrankBtn.setTag(0); } + private void initTab() { TabLayout.Tab turntable = mTabLayout.newTab(); TabLayout.Tab gift = mTabLayout.newTab(); if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { turntable.setText("轉盤整蠱"); gift.setText("禮物整蠱"); - }else { + } else { turntable.setText("Turntable prank"); gift.setText("Gift prank"); } @@ -205,9 +243,9 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_TURNTABLE); mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save); if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - mPrankBtn.setText("保存設置"); + mPrankBtn.setText("發送圖標"); } else { - mPrankBtn.setText("Save Settings"); + mPrankBtn.setText("send icon"); } mPrankBtn.setTag(0); @@ -289,7 +327,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O @Override public void onError(String error) { - ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); + ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred"); } }); } @@ -324,6 +362,12 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O return bean; } + private void clearPrankConfig() { + bean = new PrankHttpTurntableBean(); + setCoin(1000); + setDate(bean); + } + private void setPrankConfig() { if (StringUtil.isEmpty(bean.getTurntable1(), bean.getTurntable2(), bean.getTurntable3(), bean.getTurntable4(), bean.getTurntable5(), bean.getTurntable6())) { diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index 9e619c162..f78a1dd5d 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -14,6 +14,7 @@ import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; +import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; @@ -104,7 +105,7 @@ public class SocketRyChatUtil { .param("uid", u.getId()) .param("liangname", u.getGoodName()) .param("vip_type", u.getVip().getType()) - .param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType()) + .param("guard_type", IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).getGuardType()) .param("medal_name", u.getMedalName()) .param("medal_level", model.getMedalLevel()) .param("good_num", u.getGoodnum()) @@ -798,4 +799,64 @@ public class SocketRyChatUtil { }); } + public static void sendPrankIcon() { + + IMLoginModel userInfo = IMLoginManager.get(AppManager.getInstance().getMainActivity()).getUserInfo(); + + final SocketSendBean msg = new SocketSendBean() + .param("_method_", Constants.SOCKET_SEND_MSG) + .param("action", 0) + .param("msgtype", 2) + .param("uid", String.valueOf(userInfo.getId())) + .param("uname", userInfo.getUserNicename()) + .param("ugood", String.valueOf(userInfo.getId())) + .param("uname", userInfo.getLevel()) + .param("tougood", "") + .param("touid", "") + .param("touname", "") + .param("liangname", "") + .param("vip_type", userInfo.getVip().getType()) + .param("usertype", Constants.SOCKET_USER_TYPE_ANCHOR) + .param("prankIcon", "https://downs.yaoulive.com/Tricky/prankIcon.png") + .param("ct", "主播发送了转盘整蛊提示,更新到最新版APP后即可查看。" + ); + msg.create(); + String targetId = "g" + userInfo.getId(); + Conversation.ConversationType conversationType = Conversation.ConversationType.CHATROOM; + TextMessage messageContent = TextMessage.obtain(msg.mResult.toString()); + Message message = Message.obtain(targetId, conversationType, messageContent); + + RongcloudIMManager.sendMessage(message, null, null, new IRongCallback.ISendMessageCallback() { + @Override + public void onAttached(Message message) { + + } + + @Override + public void onSuccess(Message message) { + Log.i("tx", "发送成功"); + if (SocketRyClient.mSocketHandler != null) { + SocketRyClient.mSocketHandler.processBroadcast(msg.mResult.toString() + ""); + } + LiveNetManager.get(CommonAppContext.sInstance) + .addChatCount(LiveActivity.mStream, new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + + } + + @Override + public void onError(String error) { + + } + }); + } + + @Override + public void onError(Message message, RongIMClient.ErrorCode errorCode) { + + } + }); + + } } diff --git a/live/src/main/res/drawable/bg_live_prank_btn_cancel.xml b/live/src/main/res/drawable/bg_live_prank_btn_cancel.xml new file mode 100644 index 000000000..822b6d96e --- /dev/null +++ b/live/src/main/res/drawable/bg_live_prank_btn_cancel.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_prank_btn_save.xml b/live/src/main/res/drawable/bg_live_prank_btn_save.xml new file mode 100644 index 000000000..df8e924da --- /dev/null +++ b/live/src/main/res/drawable/bg_live_prank_btn_save.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_live_prank_turntable_save.xml b/live/src/main/res/drawable/bg_live_prank_turntable_save.xml index 212e3cbe0..6e84e1100 100644 --- a/live/src/main/res/drawable/bg_live_prank_turntable_save.xml +++ b/live/src/main/res/drawable/bg_live_prank_turntable_save.xml @@ -2,7 +2,7 @@ - + diff --git a/live/src/main/res/layout/dialog_live_prank.xml b/live/src/main/res/layout/dialog_live_prank.xml index f1e719288..ffbb8f729 100644 --- a/live/src/main/res/layout/dialog_live_prank.xml +++ b/live/src/main/res/layout/dialog_live_prank.xml @@ -1,6 +1,7 @@ @@ -12,8 +13,8 @@ android:layout_marginStart="16dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - app:tabIndicatorColor="#F6F7FB" app:tabIndicator="@drawable/random_pk_shape_tab_indicator" + app:tabIndicatorColor="#F6F7FB" app:tabIndicatorFullWidth="false" app:tabMaxWidth="100dp" app:tabMode="scrollable" @@ -28,20 +29,67 @@ android:layout_width="67dp" android:layout_height="24dp" android:layout_marginTop="16dp" - android:layout_marginEnd="16dp" + android:layout_marginEnd="15dp" android:background="@drawable/bg_live_prank_turntable_save" android:gravity="center" android:textColor="#FFF" android:textSize="10sp" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toStartOf="@+id/help" app:layout_constraintTop_toTopOf="parent" /> + + + + + + +