新增战令购买经验对话框经验条上加入经验文本

This commit is contained in:
zlzw 2024-01-05 13:57:55 +08:00
parent 8a7b65955c
commit 4a5e581978
3 changed files with 37 additions and 12 deletions

View File

@ -22,7 +22,7 @@ import java.math.BigDecimal;
* 战令等级 经验 * 战令等级 经验
*/ */
public class OrderLevelPopupWindow extends CenterPopupView { public class OrderLevelPopupWindow extends CenterPopupView {
private TextView orderLevel, orderLevelDiamond, balanceDiamond, current; private TextView orderLevel, orderLevelDiamond, balanceDiamond, current,expText;
private int currentExperience, totalExperience;//当前经验全部经验 private int currentExperience, totalExperience;//当前经验全部经验
private String buyExp = "100", currentLevel, balance; private String buyExp = "100", currentLevel, balance;
private ProgressBar progressBar; private ProgressBar progressBar;
@ -55,9 +55,11 @@ public class OrderLevelPopupWindow extends CenterPopupView {
balanceDiamond = findViewById(R.id.balance_diamond); balanceDiamond = findViewById(R.id.balance_diamond);
current = findViewById(R.id.current); current = findViewById(R.id.current);
progressBar = findViewById(R.id.progressBar); progressBar = findViewById(R.id.progressBar);
expText = findViewById(R.id.exp_text);
orderLevel.setText(buyExp); orderLevel.setText(buyExp);
progressBar.setMax(totalExperience); progressBar.setMax(totalExperience);
progressBar.setProgress(currentExperience); progressBar.setProgress(currentExperience);
expText.setText(String.format("%s/%s", currentExperience, totalExperience));
current.setText(String.format("Lv%s", currentLevel)); current.setText(String.format("Lv%s", currentLevel));
balanceDiamond.setText(balance); balanceDiamond.setText(balance);
findViewById(R.id.sub).setOnClickListener(new OnClickListener() { findViewById(R.id.sub).setOnClickListener(new OnClickListener() {

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="218dp" android:layout_height="218dp"
android:layout_marginStart="17dp" android:layout_marginStart="17dp"
@ -40,26 +42,47 @@
android:textColor="#CE2BFF" android:textColor="#CE2BFF"
android:textSize="14sp" /> android:textSize="14sp" />
<ProgressBar <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="221dp" android:layout_width="221dp"
android:layout_height="6dp" android:layout_height="wrap_content"
android:layout_marginStart="7dp" android:layout_marginStart="7dp">
android:max="100"
android:progress="10"
android:progressDrawable="@drawable/order_level_progress_bg" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="221dp"
android:layout_height="6dp"
android:max="100"
android:progress="10"
android:progressDrawable="@drawable/order_level_progress_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/exp_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="#000"
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>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:gravity="center"> android:gravity="center">
<TextView <TextView

View File

@ -78,7 +78,7 @@ public class BattlePassMissionFragment extends BaseFragment {
return; return;
} }
long maxExp=userInfoBean.getMaxLevelExp() - userInfoBean.getBattlePassExp(); long maxExp=userInfoBean.getMaxLevelExp() - userInfoBean.getBattlePassExp();
ToastUtil.show("max = "+maxExp+"|"+userInfoBean.getNextLevelExp()); ToastUtil.showDebug("max = "+maxExp+"|"+userInfoBean.getNextLevelExp());
new XPopup.Builder(getContext()) new XPopup.Builder(getContext())
.enableDrag(false) .enableDrag(false)