1.直播间游戏提示优化

2.战令经验值购买优化
This commit is contained in:
Martin 2024-06-28 17:52:41 +08:00
parent b68c7f1c46
commit 8f82c7c785
6 changed files with 125 additions and 76 deletions

View File

@ -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,14 +104,30 @@ 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<ResponseModel<Object>>() {
if (Integer.parseInt(orderLevel.getText().toString()+"00") <= maxExp) {
LiveNetManager.get(getContext()).buyingExperiencePoint(buyExp + "00", new HttpCallback<ResponseModel<Object>>() {
@Override
public void onSuccess(ResponseModel<Object> data) {
if (orderLevelCallback != null) {
orderLevelCallback.onCallback(data.getData().getCode(), data.getMsg());
}
@ -127,31 +142,17 @@ public class OrderLevelPopupWindow extends CenterPopupView {
dialog.dismiss();
}
});
} else {
ToastUtil.show(WordUtil.isNewZh() ? "經驗超出,僅需" + maxExp + "經驗可達滿级" : "Exp exceeds.Only " + maxExp + " exp is needed to reach the max level.");
}
}
});
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<JSONObject>() {
IMLoginManager.get(getContext()).updateUserCoin(new OnItemClickListener<JSONObject>() {
@Override
public void onItemClick(JSONObject bean, int position) {
if (bean != null) {
balance = bean.getString("coin");
balanceDiamond.setText(WordUtil.isNewZh()?"剩餘:":"Balance"+balance);
balanceDiamond.setText((WordUtil.isNewZh() ? "剩餘:" : "Balance") + balance);
}
}
});

View File

@ -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" />
</androidx.constraintlayout.widget.ConstraintLayout>
@ -103,7 +105,7 @@
android:layout_height="match_parent"
android:layout_weight="1" />
<TextView
<EditText
android:id="@+id/tickets_plus_minus"
android:layout_width="0dp"
android:layout_height="match_parent"
@ -111,6 +113,8 @@
android:background="@null"
android:gravity="center"
android:imeOptions="actionSend"
android:maxEms="4"
android:maxLength="4"
android:inputType="number"
android:singleLine="true"
android:text="0"
@ -129,7 +133,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="100"
android:text="00 = 100"
android:textColor="#000000"
android:textSize="11sp" />

View File

@ -153,6 +153,8 @@ public class LiveGiftAnimPresenter {
private ObjectAnimator mGifGiftTipShowAnimatorBuyVip;
private ObjectAnimator mGifGiftTipHideAnimatorBuyVip;
private ObjectAnimator mGifGiftTipShowAnimatorfull_sud_layout_name;
private LiveGiftViewHolder[] mLiveGiftViewHolders;
private ConcurrentLinkedQueue<LiveReceiveGiftBean> 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;

View File

@ -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;

View File

@ -2667,11 +2667,10 @@
<RelativeLayout
android:id="@+id/sud_layout_name"
android:layout_width="257dp"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:layout_marginEnd="72dp"
android:layout_marginStart="13dp"
android:background="@drawable/background_live_sud_hint"
android:paddingStart="5dp"
android:visibility="gone"

View File

@ -62,8 +62,8 @@
android:screenOrientation="portrait" />
<activity
android:name=".activity.LanguageSettingActivity"
android:screenOrientation="portrait"
android:configChanges="locale|layoutDirection|keyboard" />
android:configChanges="locale|layoutDirection|keyboard"
android:screenOrientation="portrait" />
<activity
android:name=".activity.SearchActivity"
android:screenOrientation="portrait"
@ -156,15 +156,25 @@
<activity
android:name=".activity.RedPacketUsersActivity"
android:screenOrientation="portrait" />
<activity android:name=".activity.UserAvatarSelectActivity"
<activity
android:name=".activity.UserAvatarSelectActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.BattlePassActivity"
android:screenOrientation="portrait" />
<activity android:name=".activity.BattlePassActivity" />
<activity android:name=".activity.MainHomeCommunityActivity"
<activity
android:name=".activity.MainHomeCommunityActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.FeedbackActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.FeedbackSuccessActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.FeedbackEditActivity"
android:screenOrientation="portrait" />
<activity android:name=".activity.FeedbackActivity" />
<activity android:name=".activity.FeedbackSuccessActivity" />
<activity android:name=".activity.FeedbackEditActivity" />
</application>
</manifest>