From f131fcf546ea8da66564cf125c2703633a9330b9 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Wed, 12 Jun 2024 16:44:46 +0800 Subject: [PATCH] =?UTF-8?q?add[=E4=B8=BB=E6=92=AD=E7=AB=AF=EF=BC=8C?= =?UTF-8?q?=E6=95=B4=E8=9B=8A=E7=A4=BC=E7=89=A9=EF=BC=8C=E5=BE=85=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E9=A1=B9=E5=AE=8C=E6=88=90]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/http/PDLiveApi.java | 13 +++++ .../common/http/live/LiveNetManager.java | 25 ++++++++ .../main/res/drawable/live_room_menu_red.xml | 5 ++ .../res/layout/dialog_live_new_function.xml | 30 +++++++++- common/src/main/res/values-zh-rHK/strings.xml | 1 + common/src/main/res/values-zh-rTW/strings.xml | 1 + common/src/main/res/values-zh/strings.xml | 1 + common/src/main/res/values/strings.xml | 1 + config.gradle | 2 +- .../live/activity/LiveRyAnchorActivity.java | 20 ++++++- .../com/yunbao/live/adapter/PrankAdapter.java | 41 +++++++++++++ .../dialog/LiveNewFunctionDialogFragment.java | 7 +++ .../live/dialog/LivePrankDialogFragment.java | 15 ++++- .../yunbao/live/socket/SocketRyClient.java | 2 + .../yunbao/live/views/LiveRoomViewHolder.java | 57 ++++++++++++++++--- .../live/views/LiveRyAnchorViewHolder.java | 11 ++++ .../main/res/drawable/bg_prank_an_once.xml | 5 ++ .../res/drawable/bg_prank_bottom_detail.xml | 2 +- .../res/layout/dialog_live_prank_add_gift.xml | 2 +- .../main/res/layout/item_prank_progress.xml | 41 +++++++++++++ live/src/main/res/layout/view_live_room.xml | 1 + live/src/main/res/layout/view_prank_group.xml | 1 + .../main/res/layout/view_ry_live_anchor.xml | 19 +++++++ live/src/main/res/values-en/strings.xml | 1 + live/src/main/res/values/strings.xml | 2 +- 25 files changed, 287 insertions(+), 19 deletions(-) create mode 100644 common/src/main/res/drawable/live_room_menu_red.xml create mode 100644 live/src/main/res/drawable/bg_prank_an_once.xml 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"> + + + + + + + 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 f3f4d18bd..eea58ede0 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -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/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/PrankAdapter.java b/live/src/main/java/com/yunbao/live/adapter/PrankAdapter.java index 9f5dca190..1f681b1d2 100644 --- a/live/src/main/java/com/yunbao/live/adapter/PrankAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/PrankAdapter.java @@ -6,6 +6,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import androidx.annotation.NonNull; @@ -14,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.yunbao.common.bean.PrankProgressBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.MarqueeTextView; import com.yunbao.live.R; import com.yunbao.live.views.LiveRoomViewHolder; @@ -25,6 +27,8 @@ public class PrankAdapter 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整蛊礼物列表:"+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 361d38488..b52a647a4 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_add_gift.xml b/live/src/main/res/layout/dialog_live_prank_add_gift.xml index a69da4e61..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 @@ -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" 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_room.xml b/live/src/main/res/layout/view_live_room.xml index 8eb6252fc..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 @@ + + \ 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 ee71f5c1e..52e795c40 100644 --- a/live/src/main/res/values-en/strings.xml +++ b/live/src/main/res/values-en/strings.xml @@ -134,6 +134,7 @@ 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 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) 整蠱進度 - 轉盤整蠱 + 待完成整蠱 詳情> 連擊投票 連擊最多優先