diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index c3f9e6277..5847f02f1 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1243,4 +1243,17 @@ public interface PDLiveApi { @Query("to_uid")String toUid, @Query("payload")String payload ); + + + /** + * + * @param anchor_id + * @param gift_id + * @return + */ + @GET("/api/public/?service=Prank.anchorClickFinish") + Observable>> anchorClickFinish( + @Query("anchor_id")String anchor_id, + @Query("gift_id")String gift_id + ); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 191c87a7e..46a807e22 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -3189,6 +3189,31 @@ public class LiveNetManager { } + public void anchorClickFinish(String mLiveId, String giftId, HttpCallback>callback) { + API.get().pdLiveApi(mContext) + .anchorClickFinish(mLiveId, giftId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + + } + + public void updateFile(File file, HttpCallback callback) { MultipartBody.Part uploadFile = createUploadFile(file); API.get().pdLiveApi(mContext) diff --git a/common/src/main/res/drawable/live_room_menu_red.xml b/common/src/main/res/drawable/live_room_menu_red.xml new file mode 100644 index 000000000..b45eac8b0 --- /dev/null +++ b/common/src/main/res/drawable/live_room_menu_red.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_live_new_function.xml b/common/src/main/res/layout/dialog_live_new_function.xml index e9d7d76f0..c3f4f3f5b 100644 --- a/common/src/main/res/layout/dialog_live_new_function.xml +++ b/common/src/main/res/layout/dialog_live_new_function.xml @@ -182,10 +182,34 @@ android:gravity="center" android:orientation="vertical"> - + android:layout_height="40dp"> + + + + + + + Whether to enter the live broadcast room No,only enter the game There are currently no rooms to join - Turntable prank switch - After closing, all users will not be able to see the contents of the turntable - The turntable consumes diamonds every time - Minimum requirement of 1000 diamonds - Fill in the content of the prank,Fill in a minimum of 2 words and a maximum of 10 words + Turntable Trick Switch + After turning it on, all users will not be able to see the content of the carousel. + Each turn of the wheel consumes diamonds + Starting with at least 1000 diamonds + Choose a gift You have not set up the prank content yet Choose a prank gift Enter the prank content... diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 91f92f700..f4e66e9c9 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1499,4 +1499,5 @@ 2.用戶關注主播並參與活動,將在倒計時五分鐘結束後瓜分活動金豆; 3.此活動的最終解釋權歸PDLIVE所有。 短劇 + 完成*1 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index fce6cda70..11b86f6f2 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1498,4 +1498,5 @@ 2.用戶關注主播並參與活動,將在倒計時五分鐘結束後瓜分活動金豆; 3.此活動的最終解釋權歸PDLIVE所有。 短劇 + 完成*1 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index 49eb50f29..72806f612 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1495,5 +1495,6 @@ 2.用戶關注主播並參與活動,將在倒計時五分鐘結束後瓜分活動金豆; 3.此活動的最終解釋權歸PDLIVE所有。 短劇 + 完成*1 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index c937e7e14..eea58ede0 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1356,11 +1356,11 @@ Limited ride And limited avatar frame Whether to enter the live broadcast room No,only enter the game There are currently no rooms to join - Turntable prank switch - After closing, all users will not be able to see the contents of the turntable - The turntable consumes diamonds every time - Minimum requirement of 1000 diamonds - Fill in the content of the prank,Fill in a minimum of 2 words and a maximum of 10 words + Turntable Trick Switch + After turning it on, all users will not be able to see the content of the carousel. + Each turn of the wheel consumes diamonds + Starting with at least 1000 diamonds + Choose a gift You have not set up the prank content yet Choose a prank gift Enter the prank content... @@ -1504,4 +1504,5 @@ Limited ride And limited avatar frame 2.Users who follow the anchor and participate in the activity will divide the gold beans of the activity after the countdown of five minutes ends; 3.The final interpretation of this activity belongs to PDLIVE. Theater + once diff --git a/common/src/main/res/values/style.xml b/common/src/main/res/values/style.xml index c444de78d..190d8d7e2 100644 --- a/common/src/main/res/values/style.xml +++ b/common/src/main/res/values/style.xml @@ -131,4 +131,10 @@ @anim/out_to_right_abit @anim/out_to_right + + + \ No newline at end of file diff --git a/config.gradle b/config.gradle index fe92cbdd4..cbfcfbded 100644 --- a/config.gradle +++ b/config.gradle @@ -27,6 +27,6 @@ ext { //是否上报异常日志 isUploadLog : true, //是否打包成插件包模式 - isPluginModel : true, + isPluginModel : false, ] } diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index a42bc3d71..f35818ea6 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -300,8 +300,6 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl ToastUtil.show(mContext.getString(R.string.live_push_failed)); } }); - - } private void initFaceManager() { @@ -380,8 +378,17 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl case Constants.LIVE_FUNC_ZG://zg // ToastUtil.show("開發中,敬請期待"); LivePrankDialogFragment fragment = new LivePrankDialogFragment(); + fragment.setOnPrankResultListener(new LivePrankDialogFragment.onPrankResultListener() { + @Override + public void OpenAndCloseListener() { + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.initPrankProgress(); + } + } + }); fragment.setmLiveUid(mLiveUid); fragment.show(getSupportFragmentManager(), "LivePrankDialogFragment"); + mLiveAnchorViewHolder.closeMenuRed(); break; case Constants.LIVE_FUNC_MIC://語音 //ToastUtil.show("開發中,敬請期待"); @@ -700,6 +707,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl bundle.putBoolean("isPk", isDRPK == 1 || PKing || mLivePushViewHolder.isPking()); bundle.putLong("liveTime", mLiveAnchorViewHolder.getmAnchorLiveTime()); bundle.putBoolean(Constants.OPEN_FLASH, mLivePushViewHolder != null && mLivePushViewHolder.isFlashOpen()); + bundle.putBoolean("isShowZgRed",mLiveAnchorViewHolder.isShowMenuRed()); fragment.setArguments(bundle); fragment.setFunctionClickListener(this); fragment.show(getSupportFragmentManager(), "LiveFunctionDialogFragment"); @@ -871,6 +879,10 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl getAiRobotStatus(); MicedUserManager.get().removeAllMicUserList(); MicUserManager.get().removeAllMicUserList(); + //加载整蛊 + if(mLiveRoomViewHolder!=null){ + mLiveRoomViewHolder.initPrankProgress(); + } } /** @@ -1454,7 +1466,9 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl @Override public void onUpdatePrankProgress(String prankString) { - + if (mLiveRoomViewHolder != null){ + mLiveRoomViewHolder.refreshPrank(prankString); + } } 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 d88f1c850..25cf9ef60 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LivePrankRecyclerAdapter.java @@ -235,19 +235,36 @@ public class LivePrankRecyclerAdapter extends RecyclerView.Adapter mList = new ArrayList<>(); private Context mContext; + private boolean isAn; + public PrankAdapter(Context context){ mContext = context; } @@ -35,6 +39,13 @@ public class PrankAdapter extends RecyclerView.Adapter list,boolean isAn){ + this.isAn = isAn; + mList.clear(); + mList.addAll(list); + notifyDataSetChanged(); + } + @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { @@ -54,6 +65,22 @@ public class PrankAdapter extends RecyclerView.Adapter onItemClickListener; @@ -42,7 +45,8 @@ public class LivePrankAddGiftDialog extends AbsDialogPopupWindow { } - public LivePrankAddGiftDialog setGiftBeans(List giftBeans) { + public LivePrankAddGiftDialog setGiftBeans(List giftBeans,boolean isShow) { + this.isShowGiftNumber = isShow; this.giftBeans = giftBeans; return this; } @@ -68,6 +72,10 @@ public class LivePrankAddGiftDialog extends AbsDialogPopupWindow { giftText = findViewById(R.id.gift_text); numberText = findViewById(R.id.number_text); contentText = findViewById(R.id.content_text); + giftNumberLayout= findViewById(R.id.giftNumberLayout); + if(isShowGiftNumber){ + giftNumberLayout.setVisibility(VISIBLE); + } ViewClicksAntiShake.clicksAntiShake(backBtn, new ViewClicksAntiShake.ViewClicksCallBack() { @Override @@ -131,11 +139,18 @@ public class LivePrankAddGiftDialog extends AbsDialogPopupWindow { ToastUtil.show(WordUtil.isNewZh() ? "整蠱禮物不能為空" : "A trick gift can't be empty"); return; } - if (numberText.getTag()==null||StringUtil.isEmpty(prankContent)){ - ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty"); - return; + if(isShowGiftNumber){ + if (numberText.getTag()==null||StringUtil.isEmpty(prankContent)){ + ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty"); + return; + } + bean.setNum(Integer.parseInt(numberText.getText().toString())); + }else{ + if (StringUtil.isEmpty(prankContent)){ + ToastUtil.show(WordUtil.isNewZh() ? "整蠱內容或數量不能為空" : "The content or number of pranks cannot be empty"); + return; + } } - bean.setNum(Integer.parseInt(numberText.getText().toString())); bean.setTitle(prankContent); onItemClickListener.onItemClick(bean,0); dismiss(); diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java index 45c28a730..dc3670afa 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankDialogFragment.java @@ -69,6 +69,13 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O private TextView giftTypeTodoText; private TextView giftTypeNowSwitchText; private Button mBtnAddGift; + private ImageView help; + + private onPrankResultListener onPrankResultListener; + + public void setOnPrankResultListener(LivePrankDialogFragment.onPrankResultListener onPrankResultListener) { + this.onPrankResultListener = onPrankResultListener; + } public void setmLiveUid(String mLiveUid) { this.mLiveUid = mLiveUid; @@ -109,6 +116,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } private void initView() { + help = (ImageView) findViewById(R.id.help); mTabLayout = (TabLayout) findViewById(R.id.prank_tabLayout); mTurntableConfigLayout = findViewById(R.id.turntable_layout); mGiftConfigLayout = findViewById(R.id.gift_layout); @@ -122,6 +130,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O mPrankRecyclerView.setAdapter(recyclerAdapter); mCoinTextView.setOnClickListener(this); mTurntableConfigImageView.setOnClickListener(this); + help.setOnClickListener(this); if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { mPrankBtn.setText("發送圖標"); } else { @@ -159,6 +168,15 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O giftBeans.remove(position); recyclerAdapter.setList(giftBeans); recyclerAdapter.notifyDataSetChanged(); + if (giftBeans.size() < 6) { + mBtnAddGift.setVisibility(View.VISIBLE); + mGiftNotDate.setVisibility(View.VISIBLE); + mPrankBtn.setVisibility(View.VISIBLE); + } else { + mBtnAddGift.setVisibility(View.GONE); + mGiftNotDate.setVisibility(View.GONE); + mPrankBtn.setVisibility(View.GONE); + } } } }); @@ -202,7 +220,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O if (mPrankBtn.getTag() != null && Integer.parseInt(mPrankBtn.getTag().toString()) == 0) { SocketRyChatUtil.sendPrankIcon(); } else { - + showGiftDialog(); } } }); @@ -214,7 +232,6 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } else { setGiftBean(recyclerAdapter.getList()); } - } }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_clear), new ViewClicksAntiShake.ViewClicksCallBack() { @@ -223,9 +240,14 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O if ((int) mPrankBtn.getTag() == 0) { clearPrankConfig(); } else { + giftSwitch1Btn.setTag("false"); + giftSwitch1Btn.setImageResource(R.mipmap.special_icon_off); giftBeans = new ArrayList<>(); recyclerAdapter.setList(giftBeans); recyclerAdapter.notifyDataSetChanged(); + mPrankBtn.setVisibility(View.VISIBLE); + mBtnAddGift.setVisibility(View.VISIBLE); + mGiftNotDate.setVisibility(View.VISIBLE); } } }); @@ -239,10 +261,9 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O turntable.setText("轉盤整蠱"); gift.setText("禮物整蠱"); } else { - turntable.setText("Turntable prank"); - gift.setText("Gift prank"); + turntable.setText("Turntable"); + gift.setText("Gift"); } - turntable.setTag(0); gift.setTag(1); mTabLayout.addTab(turntable); @@ -261,6 +282,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O mBtnAddGift.setVisibility(View.GONE); mGiftNotDate.setVisibility(View.GONE); recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_TURNTABLE); + mPrankBtn.setVisibility(View.VISIBLE); mPrankBtn.setBackgroundResource(R.drawable.bg_live_prank_turntable_save); if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { mPrankBtn.setText("發送圖標"); @@ -303,7 +325,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } private void showGiftDialog() { - LivePrankAddGiftDialog livePrankAddGiftDialog = new LivePrankAddGiftDialog(mContext).setGiftBeans(giftBeans); + LivePrankAddGiftDialog livePrankAddGiftDialog = new LivePrankAddGiftDialog(mContext).setGiftBeans(giftBeans, giftTypeNowText.getTag().equals("1")); livePrankAddGiftDialog.setOnItemClickListener(new OnItemClickListener() { @SuppressLint("NotifyDataSetChanged") @Override @@ -314,9 +336,11 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O if (giftBeans.size() < 6) { mBtnAddGift.setVisibility(View.VISIBLE); mGiftNotDate.setVisibility(View.VISIBLE); + mPrankBtn.setVisibility(View.VISIBLE); } else { mBtnAddGift.setVisibility(View.GONE); - mGiftNotDate.setVisibility(View.VISIBLE); + mGiftNotDate.setVisibility(View.GONE); + mPrankBtn.setVisibility(View.GONE); } } }); @@ -330,8 +354,10 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O giftTypeNowText = (TextView) findViewById(R.id.gift_type_now_text); giftTypeTodoText = (TextView) findViewById(R.id.gift_type_todo); giftTypeNowSwitchText = (TextView) findViewById(R.id.gift_type_now_switch); + giftTypeNowText.setTag("2"); mBtnAddGift = (Button) findViewById(R.id.gift_add_btn); mBtnAddGift.setVisibility(View.GONE); + mGiftNotDate.setVisibility(View.GONE); ViewClicksAntiShake.clicksAntiShake(giftSwitch1Btn, new ViewClicksAntiShake.ViewClicksCallBack() { @Override @@ -351,6 +377,12 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O CharSequence tmp = giftTypeNowText.getText(); giftTypeNowText.setText(giftTypeNowSwitchText.getText()); giftTypeNowSwitchText.setText(tmp); + if (giftTypeNowText.getTag().equals("1")) { + giftTypeNowText.setTag("2"); + } else { + giftTypeNowText.setTag("1"); + } + initGiftData(); } }); ViewClicksAntiShake.clicksAntiShake(mBtnAddGift, new ViewClicksAntiShake.ViewClicksCallBack() { @@ -378,7 +410,7 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O private void setGiftBean(List prankGiftBeans) { JSONArray prankJson = getJsonObjects(prankGiftBeans); - LiveNetManager.get(mContext).setPrankGift(mLiveUid, giftSwitch1Btn.getTag().equals("true")?"1":"0", new Gson().toJson(prankJson), "1", new HttpCallback() { + LiveNetManager.get(mContext).setPrankGift(mLiveUid, giftSwitch1Btn.getTag().equals("true") ? "1" : "0", new Gson().toJson(prankJson), giftTypeNowText.getTag().toString(), new HttpCallback() { @Override public void onSuccess(PrankHttpTurntableBean data) { initGiftData(); @@ -387,6 +419,10 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } else { ToastUtil.show("successful"); } + //通知主播刷新整蛊信息、 + if(onPrankResultListener!=null){ + onPrankResultListener.OpenAndCloseListener(); + } } @Override @@ -410,23 +446,31 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } private void initGiftData() { - LiveNetManager.get(mContext).getPrankGiftList(mLiveUid, mPrankBtn.getTag().equals("0")?"2":"1",new HttpCallback() { + LiveNetManager.get(mContext).getPrankGiftList(mLiveUid, giftTypeNowText.getTag().toString(), new HttpCallback() { @Override public void onSuccess(PrankGiftResultBean data) { - if(mPrankBtn.getTag().toString().equals("1")){ - if(data.getPrank_list()!=null){ + if (mPrankBtn.getTag().toString().equals("1")) { + if (data.getPrank_list() != null) { if (data.getPrank_list().size() < 6) { mBtnAddGift.setVisibility(View.VISIBLE); mGiftNotDate.setVisibility(View.VISIBLE); } else { mBtnAddGift.setVisibility(View.GONE); - mGiftNotDate.setVisibility(View.VISIBLE); + mGiftNotDate.setVisibility(View.GONE); + mPrankBtn.setVisibility(View.GONE); } mPrankRecyclerView.setVisibility(View.VISIBLE); recyclerAdapter.setViewType(LivePrankRecyclerAdapter.TYPE_GIFT); giftBeans = data.getPrank_list(); recyclerAdapter.setList(giftBeans); recyclerAdapter.notifyDataSetChanged(); + if (data.getStatus().equals("1")) { + giftSwitch1Btn.setTag("true"); + giftSwitch1Btn.setImageResource(R.mipmap.special_icon_on); + } else { + giftSwitch1Btn.setTag("false"); + giftSwitch1Btn.setImageResource(R.mipmap.special_icon_off); + } } } @@ -491,37 +535,26 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } return; } - LiveNetManager.get(mContext).setAnchorPrankTurntable( - mLiveUid, - bean.getCoin() + "", - bean.getTurntable1(), - bean.getTurntable2(), - bean.getTurntable3(), - bean.getTurntable4(), - bean.getTurntable5(), - bean.getTurntable6(), - bean.getStatus() + "", - new HttpCallback() { - @Override - public void onSuccess(Object data) { + LiveNetManager.get(mContext).setAnchorPrankTurntable(mLiveUid, bean.getCoin() + "", bean.getTurntable1(), bean.getTurntable2(), bean.getTurntable3(), bean.getTurntable4(), bean.getTurntable5(), bean.getTurntable6(), bean.getStatus() + "", new HttpCallback() { + @Override + public void onSuccess(Object data) { - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - ToastUtil.show("保存成功"); - } else { - ToastUtil.show("Save success"); - } - } - - @Override - public void onError(String error) { - if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { - ToastUtil.show("保存失败:" + error); - } else { - ToastUtil.show("Save failed" + error); - } - } + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + ToastUtil.show("保存成功"); + } else { + ToastUtil.show("Save success"); } - ); + } + + @Override + public void onError(String error) { + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + ToastUtil.show("保存失败:" + error); + } else { + ToastUtil.show("Save failed" + error); + } + } + }); } @Override @@ -572,7 +605,13 @@ public class LivePrankDialogFragment extends AbsDialogFragment implements View.O } }); } - + } else if (id == R.id.help) { + LivePrankExplainDialog livePrankExplainDialog = new LivePrankExplainDialog(mContext); + livePrankExplainDialog.showDialog(); } } + + public interface onPrankResultListener{ + void OpenAndCloseListener(); + } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePrankExplainDialog.java b/live/src/main/java/com/yunbao/live/dialog/LivePrankExplainDialog.java index 05fff8d0e..1d9001578 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LivePrankExplainDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/LivePrankExplainDialog.java @@ -2,35 +2,18 @@ package com.yunbao.live.dialog; import android.content.Context; import android.text.Html; +import android.view.View; import android.widget.TextView; import androidx.annotation.NonNull; import com.lxj.xpopup.XPopup; import com.yunbao.common.dialog.AbsDialogPopupWindow; +import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; public class LivePrankExplainDialog extends AbsDialogPopupWindow { TextView content; - String contentText = "" + - "1、當前整蠱分類有哪些? 當前分爲轉盤整蠱和禮物整蠱。可根據實際情況決定,例如都設置或只設置一種。" + - " " + - "2、轉盤整蠱如何填寫? \n" + - "打開開關→設置價格→填寫6個整蠱→保存設置。\n" + - "\n" + - " 注意:若有人發起整蠱,將提示你完成該整蠱,期間若有人花費鑽石拯救你,則不用完成整蠱。\n" + - "3、禮物整蠱如何填寫? \n" + - "當前分爲禮物數達成整蠱和連擊數最高整蠱。\n" + - "\n" + - "禮物數達成整蠱:打開開關→選擇禮物→填寫數量→填寫整蠱→保存設置。\n" + - "\n" + - "連擊數最高整蠱:打開開關→切換→選擇禮物→填寫整蠱→保存設置。\n" + - "4、整蠱如何填寫? \n" + - "根據你的實際情況決定。例如:唱歌、跳舞、情書、下蹲、吃辣或其他任意才藝。\n" + - "5、我怎麽知道該做哪些整蠱? \n" + - "系統將發送消息至彈幕;\n" + - "你需要做的整蠱會自動挂起。"; - public LivePrankExplainDialog(@NonNull Context context) { super(context); } @@ -42,7 +25,7 @@ public class LivePrankExplainDialog extends AbsDialogPopupWindow { @Override public int bindLayoutId() { - return R.layout.dialog_live_prank_add_gift_number; + return R.layout.dialog_live_prank_explain; } @Override @@ -58,6 +41,70 @@ public class LivePrankExplainDialog extends AbsDialogPopupWindow { void initView() { content = findViewById(R.id.content); - content.setText(Html.fromHtml(contentText)); + findViewById(R.id.back).setOnClickListener(new OnClickListener() { + @Override + public void onClick(View view) { + dialog.dismiss(); + } + }); + StringBuffer stringBuffer = new StringBuffer(); + if(WordUtil.isNewZh()){ + stringBuffer.append(getHtmlContent(true,"1、當前整蠱分類有哪些?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"當前分爲轉盤整蠱和禮物整蠱。可根據實際情況決定,例如都設置或只設置一種。","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"2、轉盤整蠱如何填寫?","\"#F9B003\"",false)); + stringBuffer.append(getHtmlContent(false,"打開開關→設置價格→填寫6個整蠱→保存設置。","\"#F9B003\"",true)); + stringBuffer.append(getHtmlContent(false,"注意:若有人發起整蠱,將提示你完成該整蠱,期間若有人花費鑽石拯救你,則不用完成整蠱。","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"3、禮物整蠱如何填寫?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"當前分爲禮物數達成整蠱和連擊數最高整蠱。","\"#FFFFFF\"",true)); + stringBuffer.append(getHtmlContent(false,"禮物數達成整蠱:打開開關→選擇禮物→填寫數量→填寫整蠱→保存設置。","\"#F9B003\"",true)); + stringBuffer.append(getHtmlContent(false,"連擊數最高整蠱:打開開關→切換→選擇禮物→填寫整蠱→保存設置。","\"#F9B003\"",true)); + + stringBuffer.append(getHtmlContent(true,"4、整蠱如何填寫?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"根據你的實際情況決定。例如:唱歌、跳舞、情書、下蹲、吃辣或其他任意才藝。","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"5、我怎麽知道該做哪些整蠱?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"系統將發送消息至彈幕;","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"你需要做的整蠱會自動挂起。","\"#FFFFFF\"",false)); + }else{ + stringBuffer.append(getHtmlContent(true,"1. What are the current categories of pranks?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"Currently it is divided into turntable tricking and gift tricking. It can be decided according to the actual situation, for example, setting both or only one type.","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"2. How to fill in the turntable trick?","\"#F9B003\"",false)); + stringBuffer.append(getHtmlContent(false,"Turn on the switch → set the price → fill in 6 tricks → save the settings.","\"#F9B003\"",true)); + stringBuffer.append(getHtmlContent(false,"Note: If someone initiates a trick, you will be prompted to complete the trick. If someone spends diamonds to save you during this period, you do not need to complete the trick.","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"3. How to fill in the gift form?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"Currently, it is divided into the number of gifts to reach Tricky and the number of combos to reach Tricky.","\"#FFFFFF\"",true)); + stringBuffer.append(getHtmlContent(false,"The number of gifts reaches Trick: turn on the switch → select the gift → fill in the quantity → fill in the trick → save the settings.","\"#F9B003\"",true)); + stringBuffer.append(getHtmlContent(false,"The trick with the highest number of combos: turn on the switch → switch → select the gift → fill in the trick → save the settings.","\"#F9B003\"",true)); + + stringBuffer.append(getHtmlContent(true,"4. How to fill in Tricky?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"Decide based on your actual situation. For example: singing, dancing, love letters, squatting, eating spicy food or any other talent.","\"#FFFFFF\"",true)); + + stringBuffer.append(getHtmlContent(true,"5. How do I know which tricks to do?","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"The system will send a message to the barrage;","\"#FFFFFF\"",false)); + stringBuffer.append(getHtmlContent(false,"The tricks you need to do will automatically hang.","\"#FFFFFF\"",false)); + } + + content.setText(Html.fromHtml(stringBuffer.toString())); } + public String getHtmlContent(boolean isTitle, String content, String color, boolean linebreak) { + StringBuffer result = new StringBuffer(); + if (isTitle) { + result.append("
"); + result.append(content); + result.append("
"); + } else { + result.append("
"); + result.append(content); + result.append("
"); + } + if (linebreak) { + result.append("

"); + } + return result.toString(); + } + } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java index 349634295..a8a8ac3c2 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyClient.java @@ -296,8 +296,10 @@ public class SocketRyClient { case Constants.PrankSendData: //整蛊礼物刷新 + L.e("整蛊礼物刷新 整蛊礼物刷新 整蛊礼物刷新"); if (map.getIntValue("action") == 13 && map.getString("msgtype").equals("4")){ String ctString = map.getString("ct"); + L.e("整蛊礼物刷新 整蛊礼物刷新 整蛊礼物刷新 "+ctString); JsonElement jsonElement = JsonParser.parseString(ctString); if (jsonElement == null) break; // LogUtils.e("yqw=====>整蛊礼物列表:"+ctString); 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 9d4236e2c..ef75dcde3 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -54,6 +54,9 @@ import com.bumptech.glide.load.resource.gif.GifDrawable; import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.target.Target; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; import com.google.gson.reflect.TypeToken; import com.lxj.xpopup.XPopup; import com.makeramen.roundedimageview.RoundedImageView; @@ -66,6 +69,7 @@ import com.opensource.svgaplayer.SVGAImageView; import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.bean.PrankProgressBean; +import com.yunbao.common.utils.L; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; @@ -406,12 +410,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis //整蛊进度列表功能 private View prank_group; - private TextView prank_group_title,prank_group_turntable; + public TextView prank_group_title,prank_group_turntable; private RecyclerView recycler_prank; private ImageView prank_group_bottom_icon,prank_group_turntable_icon,prank_small_icon; private PrankAdapter prankAdapter; private ComboAdapter comboAdapter; private List prankAndComboList = new ArrayList<>(); + private JsonElement completedList = new JsonArray(); + + private boolean prankAnisShow; public LiveRoomViewHolder setGuardType(int guardType) { this.guardType = guardType; @@ -1650,10 +1657,21 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis prank_group_bottom_icon = (ImageView) findViewById(R.id.prank_group_bottom_icon);//收起icon prank_group_turntable_icon = (ImageView) findViewById(R.id.prank_group_turntable_icon);//转盘图标 prank_small_icon = (ImageView) findViewById(R.id.prank_small_icon);//收起后图标 - //点击文字转盘整蛊(跳转转盘整蛊) prank_group_turntable.setOnClickListener(v->{ - + prankAnisShow = !prankAnisShow; + List tempList = new ArrayList<>(); + for (int i = 0; i { -// LogUtils.e("yqw=====>点击整蛊礼物:"+giftId); - openGiftDialog(String.valueOf(giftId)); + prankAdapter.addOnItemClickListener(new PrankAdapter.OnItemClickListener() { + @Override + public void onItemClick(View view, int giftId) { + openGiftDialog(String.valueOf(giftId)); + } + + @Override + public void onItemDel(int giftId) { + LiveNetManager.get(mContext).anchorClickFinish(mLiveUid, String.valueOf(giftId), new com.yunbao.common.http.base.HttpCallback>() { + @Override + public void onSuccess(List data) { + + } + + @Override + public void onError(String error) { + + } + }); + L.e("onItemDel:"+giftId); + } }); //连击投票礼物点击 @@ -1692,6 +1728,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } + + //初始化整蛊列表进度 public void initPrankProgress(){ // LogUtils.e("yqw=====>主播id:"+mLiveUid); @@ -1715,8 +1753,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); } - - //刷新整蛊礼物列表 public void refreshPrank(String newPrankData){ try { @@ -1765,6 +1801,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis sortByCompletionRate(prankAndComboList); prankAdapter.setList(prankAndComboList); recycler_prank.setAdapter(prankAdapter); + if(CommonAppConfig.getInstance().getUid().equals(mLiveUid)){ + prank_group_turntable.setVisibility(View.VISIBLE); + }else{ + prank_group_turntable.setVisibility(View.GONE); + } }else { sortBySendNum(prankAndComboList); comboAdapter.setList(prankAndComboList); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java index d2be9d442..ca89f6dc9 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRyAnchorViewHolder.java @@ -85,6 +85,7 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { private TextView mLiveTimeTextView;//主播的直播时长 private long mAnchorLiveTime;//主播直播时间 private LiveRoomHandler mLiveRoomHandler; + private TextView menuRed; public LiveRyAnchorViewHolder(Context context, ViewGroup parentView) { super(context, parentView); @@ -187,6 +188,8 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { mLiveTimeTextView = (TextView) findViewById(R.id.live_time); mLiveTimeTextView.setVisibility(View.VISIBLE); mLiveRoomHandler = new LiveRoomHandler(); + + menuRed = (TextView) findViewById(R.id.red_menu); } private Map yaoqing = new HashMap<>(); @@ -649,4 +652,12 @@ public class LiveRyAnchorViewHolder extends AbsLiveViewHolder { } return now + time + -now % 1000; } + + public void closeMenuRed(){ + menuRed.setVisibility(View.GONE); + } + + public boolean isShowMenuRed(){ + return menuRed.getVisibility()==View.VISIBLE; + } } diff --git a/live/src/main/res/drawable/bg_prank_an_once.xml b/live/src/main/res/drawable/bg_prank_an_once.xml new file mode 100644 index 000000000..0bd004a45 --- /dev/null +++ b/live/src/main/res/drawable/bg_prank_an_once.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_prank_bottom_detail.xml b/live/src/main/res/drawable/bg_prank_bottom_detail.xml index 8083e5818..aa82d3720 100644 --- a/live/src/main/res/drawable/bg_prank_bottom_detail.xml +++ b/live/src/main/res/drawable/bg_prank_bottom_detail.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_prank.xml b/live/src/main/res/layout/dialog_live_prank.xml index ffbb8f729..274df02ee 100644 --- a/live/src/main/res/layout/dialog_live_prank.xml +++ b/live/src/main/res/layout/dialog_live_prank.xml @@ -16,6 +16,7 @@ app:tabIndicator="@drawable/random_pk_shape_tab_indicator" app:tabIndicatorColor="#F6F7FB" app:tabIndicatorFullWidth="false" + app:tabTextAppearance="@style/PrankTabLayoutTextStyle" app:tabMaxWidth="100dp" app:tabMode="scrollable" app:tabSelectedTextColor="#F6F7FB" diff --git a/live/src/main/res/layout/dialog_live_prank_add_gift.xml b/live/src/main/res/layout/dialog_live_prank_add_gift.xml index 07cadbf99..1f131a424 100644 --- a/live/src/main/res/layout/dialog_live_prank_add_gift.xml +++ b/live/src/main/res/layout/dialog_live_prank_add_gift.xml @@ -65,12 +65,12 @@ android:orientation="horizontal"> @@ -83,7 +83,7 @@ android:drawableEnd="@mipmap/ic_prank_gift_add_gift_to" android:ems="10" android:gravity="start|center" - android:hint="@string/diamonds_every_time_requirement_of_hint" + android:hint="@string/live_prank_gift_add_gift_select" android:paddingStart="12dp" android:paddingEnd="12dp" android:singleLine="true" @@ -97,17 +97,19 @@ @@ -140,11 +142,11 @@ android:orientation="horizontal"> diff --git a/live/src/main/res/layout/dialog_live_prank_explain.xml b/live/src/main/res/layout/dialog_live_prank_explain.xml index 5aee17c77..848e42890 100644 --- a/live/src/main/res/layout/dialog_live_prank_explain.xml +++ b/live/src/main/res/layout/dialog_live_prank_explain.xml @@ -1,46 +1,53 @@ - + - + - + - + + + android:layout_marginTop="10dp"> - + - \ No newline at end of file + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/item_prank_progress.xml b/live/src/main/res/layout/item_prank_progress.xml index 548d2f753..815610b82 100644 --- a/live/src/main/res/layout/item_prank_progress.xml +++ b/live/src/main/res/layout/item_prank_progress.xml @@ -20,7 +20,10 @@ android:textSize="8sp"/> @@ -101,4 +107,39 @@ + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_prank_turntable.xml b/live/src/main/res/layout/view_live_prank_turntable.xml index 5b070de75..7c01875b7 100644 --- a/live/src/main/res/layout/view_live_prank_turntable.xml +++ b/live/src/main/res/layout/view_live_prank_turntable.xml @@ -22,7 +22,7 @@ android:layout_marginTop="10dp" android:orientation="vertical" android:visibility="visible" - tools:visibility="gone"> + tools:visibility="visible"> @@ -70,13 +72,15 @@ @@ -116,7 +120,7 @@ android:layout_marginTop="10dp" android:orientation="vertical" android:visibility="gone" - tools:visibility="visible"> + tools:visibility="gone"> @@ -188,7 +193,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" - android:layout_marginStart="10dp" + android:layout_marginStart="5dp" android:layout_marginEnd="16dp" android:drawableEnd="@mipmap/ic_prank_gift_switch" android:text="@string/live_prank_dialog_gift_type_number" diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index 7165d8a47..87c990e0a 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -2400,6 +2400,7 @@ diff --git a/live/src/main/res/layout/view_prank_group.xml b/live/src/main/res/layout/view_prank_group.xml index 4b2614e12..e480ad609 100644 --- a/live/src/main/res/layout/view_prank_group.xml +++ b/live/src/main/res/layout/view_prank_group.xml @@ -53,6 +53,7 @@ android:background="@drawable/bg_prank_bottom_detail" android:visibility="gone" android:padding="3dp" + tools:visibility="visible" android:textSize="8sp" android:ellipsize="end" android:singleLine="true" diff --git a/live/src/main/res/layout/view_ry_live_anchor.xml b/live/src/main/res/layout/view_ry_live_anchor.xml index b49c46d2c..3a0fffcf6 100644 --- a/live/src/main/res/layout/view_ry_live_anchor.xml +++ b/live/src/main/res/layout/view_ry_live_anchor.xml @@ -250,5 +250,24 @@ app:dt_left_drawable="@drawable/bg_push_time_point" app:dt_left_height="4dp" app:dt_left_width="4dp" /> + + \ No newline at end of file diff --git a/live/src/main/res/values-en/strings.xml b/live/src/main/res/values-en/strings.xml index 95be733a7..52e795c40 100644 --- a/live/src/main/res/values-en/strings.xml +++ b/live/src/main/res/values-en/strings.xml @@ -123,17 +123,24 @@ Details> Combo Most first - Clear - Save + Save + Clear Switch to - Highest combo + highest combo Quantity achieved gift trick switch After closing, the user cannot see the gift trick + Add gift trick You can add up to 6, and it is recommended to add 4. + Add gift + Gift + Choose a gift + Quantity + Fill in the number + Content + Please enter prank content, such as a dance. - Confirm + confirm Quantity + Set other quantity (up to 9999) Trick instructions diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index c5890fa7b..b0127a765 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -136,7 +136,7 @@ + 設置其他數量(最多9999) 整蠱進度 - 轉盤整蠱 + 待完成整蠱 詳情> 連擊投票 連擊最多優先