From 8f82c7c785197b72180b3765498374c8acca58f0 Mon Sep 17 00:00:00 2001 From: Martin <13046765170@163.com> Date: Fri, 28 Jun 2024 17:52:41 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=9B=B4=E6=92=AD=E9=97=B4=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96=202.=E6=88=98=E4=BB=A4?= =?UTF-8?q?=E7=BB=8F=E9=AA=8C=E5=80=BC=E8=B4=AD=E4=B9=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/dialog/OrderLevelPopupWindow.java | 123 +++++++++--------- .../src/main/res/layout/order_level_popup.xml | 8 +- .../live/presenter/LiveGiftAnimPresenter.java | 16 +++ .../yunbao/live/views/LiveRoomViewHolder.java | 23 +++- live/src/main/res/layout/view_live_room.xml | 5 +- main/src/main/AndroidManifest.xml | 26 ++-- 6 files changed, 125 insertions(+), 76 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java index b190dea90..289772384 100644 --- a/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java +++ b/common/src/main/java/com/yunbao/common/dialog/OrderLevelPopupWindow.java @@ -1,8 +1,10 @@ package com.yunbao.common.dialog; -import android.app.Dialog; import android.content.Context; +import android.text.Editable; +import android.text.TextWatcher; import android.view.View; +import android.widget.EditText; import android.widget.ProgressBar; import android.widget.TextView; @@ -17,7 +19,6 @@ import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; -import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -28,18 +29,17 @@ import java.math.BigDecimal; * 战令等级 经验 */ public class OrderLevelPopupWindow extends CenterPopupView { - private TextView orderLevel, orderLevelDiamond, balanceDiamond, current, expText; + private TextView orderLevelDiamond, balanceDiamond, current, expText; private int currentExperience, totalExperience;//当前经验,全部经验 - private String buyExp = "100", currentLevel, balance; + private String buyExp = "1", currentLevel, balance; private ProgressBar progressBar; private OrderLevelCallback orderLevelCallback; private long maxExp; private BattlePassUserInfoBean userInfoBean; private Context mContext; + private EditText orderLevel; - public OrderLevelPopupWindow(@NonNull Context context, BattlePassUserInfoBean userInfoBean, - int mCurrentExperience, int mTotalExperience, - String mCurrentLevel, String mBalance, long maxExp, OrderLevelCallback mOrderLevelCallback) { + public OrderLevelPopupWindow(@NonNull Context context, BattlePassUserInfoBean userInfoBean, int mCurrentExperience, int mTotalExperience, String mCurrentLevel, String mBalance, long maxExp, OrderLevelCallback mOrderLevelCallback) { super(context); this.mContext = context; this.userInfoBean = userInfoBean; @@ -71,15 +71,15 @@ public class OrderLevelPopupWindow extends CenterPopupView { progressBar.setProgress(currentExperience); expText.setText(String.format("%s/%s", userInfoBean.getBattlePassExp(), userInfoBean.getNextLevelExp())); current.setText(String.format("Lv%s", currentLevel)); - balanceDiamond.setText(WordUtil.isNewZh()?"剩餘:":"Balance:"+balance); + balanceDiamond.setText((WordUtil.isNewZh() ? "剩餘:" : "Balance:") + balance); findViewById(R.id.sub).setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { float exp = new BigDecimal(buyExp).floatValue(); - if (exp > 100) { - BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).subtract(new BigDecimal("100")); + if (exp > 1) { + BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).subtract(new BigDecimal("1")); buyExp = String.valueOf(buyExpBigDecimal.intValue()); - orderLevelDiamond.setText("00 = "+String.valueOf(buyExpBigDecimal.floatValue())); + orderLevelDiamond.setText("00 = " + buyExp + "00"); orderLevel.setText(buyExp); } } @@ -88,15 +88,14 @@ public class OrderLevelPopupWindow extends CenterPopupView { @Override public void onClick(View view) { float exp = new BigDecimal(buyExp).floatValue(); - if (exp < maxExp && exp < 10000) { - BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).add(new BigDecimal("100")); + if (exp < maxExp && (exp + 1) < 10000) { + BigDecimal buyExpBigDecimal = new BigDecimal(buyExp).add(new BigDecimal("1")); buyExp = String.valueOf(buyExpBigDecimal.intValue()); - orderLevelDiamond.setText("00 = "+String.valueOf(buyExpBigDecimal.floatValue())); + orderLevelDiamond.setText("00 = " + buyExp + "00"); orderLevel.setText(buyExp); } else if (exp >= maxExp) { - ToastUtil.show(WordUtil.isNewZh() ? "经验已滿" : "Experience full"); + ToastUtil.show(WordUtil.isNewZh() ? "經驗超出,僅需" + maxExp + "經驗可達滿级" : "Exp exceeds.Only " + maxExp + " exp is needed to reach the max level."); } - } }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.war_order_close), new ViewClicksAntiShake.ViewClicksCallBack() { @@ -105,56 +104,58 @@ public class OrderLevelPopupWindow extends CenterPopupView { dialog.dismiss(); } }); + orderLevel.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + buyExp = charSequence.toString(); + orderLevelDiamond.setText("00 = " + charSequence.toString() + "00"); + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.buying_experience), new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { - LiveNetManager.get(getContext()) - .buyingExperiencePoint(buyExp, new HttpCallback>() { - @Override - public void onSuccess(ResponseModel data) { - - if (orderLevelCallback != null) { - orderLevelCallback.onCallback(data.getData().getCode(), data.getMsg()); - } - dialog.dismiss(); + if (Integer.parseInt(orderLevel.getText().toString()+"00") <= maxExp) { + LiveNetManager.get(getContext()).buyingExperiencePoint(buyExp + "00", new HttpCallback>() { + @Override + public void onSuccess(ResponseModel data) { + if (orderLevelCallback != null) { + orderLevelCallback.onCallback(data.getData().getCode(), data.getMsg()); } - - @Override - public void onError(String error) { - if (orderLevelCallback != null) { - orderLevelCallback.onCallback(102, error); - } - dialog.dismiss(); - } - }); - } - }); - ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.tickets_plus_minus), new ViewClicksAntiShake.ViewClicksCallBack() { - @Override - public void onViewClicks() { - DialogUitl.showSimpleInputDialog(mContext, getResources().getString(R.string.buying_experience_point), DialogUitl.INPUT_TYPE_NUMBER, 4, new DialogUitl.SimpleCallback2() { - @Override - public void onCancelClick() { - - } - - @Override - public void onConfirmClick(Dialog dialog, String content) { - orderLevel.setText(content); - } - }); - } - }); - IMLoginManager.get(getContext()) - .updateUserCoin(new OnItemClickListener() { - @Override - public void onItemClick(JSONObject bean, int position) { - if (bean != null) { - balance = bean.getString("coin"); - balanceDiamond.setText(WordUtil.isNewZh()?"剩餘:":"Balance:"+balance); + dialog.dismiss(); } - } - }); + + @Override + public void onError(String error) { + if (orderLevelCallback != null) { + orderLevelCallback.onCallback(102, error); + } + dialog.dismiss(); + } + }); + } else { + ToastUtil.show(WordUtil.isNewZh() ? "經驗超出,僅需" + maxExp + "經驗可達滿级" : "Exp exceeds.Only " + maxExp + " exp is needed to reach the max level."); + } + } + }); + IMLoginManager.get(getContext()).updateUserCoin(new OnItemClickListener() { + @Override + public void onItemClick(JSONObject bean, int position) { + if (bean != null) { + balance = bean.getString("coin"); + balanceDiamond.setText((WordUtil.isNewZh() ? "剩餘:" : "Balance:") + balance); + } + } + }); } public interface OrderLevelCallback { diff --git a/common/src/main/res/layout/order_level_popup.xml b/common/src/main/res/layout/order_level_popup.xml index 4f98a2a36..9e4ae27af 100644 --- a/common/src/main/res/layout/order_level_popup.xml +++ b/common/src/main/res/layout/order_level_popup.xml @@ -4,6 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="240dp" + android:id="@+id/root" android:layout_marginStart="17dp" android:layout_marginEnd="17dp" android:background="@drawable/background_order_dialog" @@ -70,6 +71,7 @@ android:textSize="12sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" tools:text="500/1000" /> @@ -103,7 +105,7 @@ android:layout_height="match_parent" android:layout_weight="1" /> - diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java index 2ca16c616..4fd00f1d4 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveGiftAnimPresenter.java @@ -153,6 +153,8 @@ public class LiveGiftAnimPresenter { private ObjectAnimator mGifGiftTipShowAnimatorBuyVip; private ObjectAnimator mGifGiftTipHideAnimatorBuyVip; + private ObjectAnimator mGifGiftTipShowAnimatorfull_sud_layout_name; + private LiveGiftViewHolder[] mLiveGiftViewHolders; private ConcurrentLinkedQueue mQueue; @@ -276,6 +278,7 @@ public class LiveGiftAnimPresenter { mFrameImageView = (FrameImageView) v.findViewById(R.id.all_frame_img); full_service_notice_new = v.findViewById(R.id.full_service_notice_new); + full_live_room_game_view = v.findViewById(R.id.sud_layout_name); full_service_notice_new_bg = v.findViewById(R.id.full_service_notice_new_bg); full_service_notice_new_icon = v.findViewById(R.id.full_service_notice_new_icon); full_service_notice_new_text = v.findViewById(R.id.full_service_notice_new_text); @@ -622,6 +625,15 @@ public class LiveGiftAnimPresenter { }); } + + public void startGiftTipAnimatormSud(){ + mDp500 = DpUtil.dp2px(-300); + mGifGiftTipShowAnimatorfull_sud_layout_name = ObjectAnimator.ofFloat(full_live_room_game_view, "translationX", mDp500, 0); + mGifGiftTipShowAnimatorfull_sud_layout_name.setDuration(600); + mGifGiftTipShowAnimatorfull_sud_layout_name.setInterpolator(new LinearInterpolator()); + mGifGiftTipShowAnimatorfull_sud_layout_name.start(); + } + private void setGitTipAnimatormGifGiftTipShowAnimatorfull_service_notice_new() { mDp500 = DpUtil.dp2px(500); mGifGiftTipShowAnimatorfull_service_notice_new = ObjectAnimator.ofFloat(full_service_notice_new, "translationX", mDp500, 0); @@ -656,6 +668,9 @@ public class LiveGiftAnimPresenter { } + + + /** * 釋放全局通知 */ @@ -1160,6 +1175,7 @@ public class LiveGiftAnimPresenter { AllServerNotifyFFGGGDJANEvent notifyFFGGGDJANEvent; View iv_look_full_service_notice_new3; ImageView iv_look_full_service_notice_new2; + View full_live_room_game_view; public void showAllServerNotifyFFGGGD(AllServerNotifyFFGGGDJANEvent event, boolean showB) { if (TextUtils.isEmpty(event.getBackgroundImage())) return; 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 914737b07..2af33ecc7 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -731,8 +731,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis sud_text_name = (TextView) findViewById(R.id.sud_text_name); sud_layout_name = (RelativeLayout) findViewById(R.id.sud_layout_name); iconSudClose = (ImageView) findViewById(R.id.iconSudClose); - sud_text_name.setText(WordUtil.isNewZh() ? String.format("主播创建了【%s】房间,快来与主播同玩~", sudName) : String.format("The anchor has created a 【%s】 room. Come and play with the anchor~", sudName)); - sud_layout_name.setVisibility(View.VISIBLE); + //sud_layout_name.setVisibility(View.VISIBLE); ViewClicksAntiShake.clicksAntiShake(sud_layout_name, new ViewClicksAntiShake.ViewClicksCallBack() { @Override public void onViewClicks() { @@ -759,6 +758,26 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis }); sudNameHandler.removeCallbacks(sudNameRunnable); sudNameHandler.postDelayed(sudNameRunnable, 10000); + sud_layout_name.post(new Runnable() { + @Override + public void run() { + RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) sud_layout_name.getLayoutParams(); + params1.width = mChatRecyclerView.getWidth()-DpUtil.dp2px(85); + sud_layout_name.setLayoutParams(params1); + } + }); + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + sud_text_name.setText(WordUtil.isNewZh() ? String.format("主播创建了【%s】房间,快来与主播同玩~", sudName) : String.format("The anchor created a 【%s】 room", sudName)); + sud_layout_name.setVisibility(View.VISIBLE); + mLiveGiftAnimPresenter = new LiveGiftAnimPresenter(mContext, mContentView, mGifImageView, mSVGAImageView, mLiveGiftPrizePoolContainer, windowManager); + mLiveGiftAnimPresenter.startGiftTipAnimatormSud(); + } + },2000); + + } private View sudGameMin; diff --git a/live/src/main/res/layout/view_live_room.xml b/live/src/main/res/layout/view_live_room.xml index f6483c19a..16f577b9a 100644 --- a/live/src/main/res/layout/view_live_room.xml +++ b/live/src/main/res/layout/view_live_room.xml @@ -2667,11 +2667,10 @@ + android:configChanges="locale|layoutDirection|keyboard" + android:screenOrientation="portrait" /> - + - - + + + - - - \ No newline at end of file