修改礼包剩余百分比
This commit is contained in:
@ -14,7 +14,6 @@ import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.common.util.ImageUtils;
|
||||
import com.gh.common.util.LibaoUtils;
|
||||
import com.gh.common.util.PlatformUtils;
|
||||
import com.gh.common.util.RandomUtils;
|
||||
import com.gh.common.util.StringUtils;
|
||||
import com.gh.common.view.DownloadProgressBar;
|
||||
import com.gh.gamecenter.GameDetailActivity;
|
||||
@ -191,7 +190,15 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
linearLayoutManager.setStackFromEnd(true);
|
||||
holder.libaoCodeRv.setLayoutManager(linearLayoutManager);
|
||||
|
||||
int count = RandomUtils.getInt((double) ((float) mLibaoEntity.getAvailable() / (float) mLibaoEntity.getTotal()) * 100);
|
||||
float availablePercent = ((float) mLibaoEntity.getAvailable() / (float) mLibaoEntity.getTotal()) * 100;
|
||||
int count;
|
||||
if (availablePercent >= 1) {
|
||||
count = (int) availablePercent;
|
||||
} else if (availablePercent == 0) {
|
||||
count = 0;
|
||||
} else {
|
||||
count = 1;
|
||||
}
|
||||
Spanned content = null;
|
||||
String status = mLibaoEntity.getBeforeStatus();
|
||||
if ("coming".equals(status) || "finish".equals(status) || TextUtils.isEmpty(status)) {
|
||||
|
||||
@ -9,7 +9,6 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.base.OnListClickListener
|
||||
import com.gh.common.util.LibaoUtils
|
||||
import com.gh.common.util.MtaHelper
|
||||
import com.gh.common.util.RandomUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.databinding.ItemGameLibaoBinding
|
||||
import com.gh.gamecenter.entity.LibaoEntity
|
||||
@ -51,7 +50,19 @@ class GameLibaoAdapter(val context: Context, val libaos: ArrayList<LibaoEntity>,
|
||||
val available = libaoEntity.available
|
||||
if (total != 0) {
|
||||
holder.binding.libaoSchedulePb.progress = ((available / total.toFloat()) * 100).toInt()
|
||||
holder.binding.remainingTv.text = "剩余${RandomUtils.getInt((available) / total.toDouble() * 100)}%"
|
||||
val availablePercent = (available) / total.toFloat() * 100
|
||||
val count = when {
|
||||
availablePercent >= 1F -> {
|
||||
availablePercent.toInt()
|
||||
}
|
||||
availablePercent == 0F -> {
|
||||
0
|
||||
}
|
||||
else -> {
|
||||
1
|
||||
}
|
||||
}
|
||||
holder.binding.remainingTv.text = "剩余${count}%"
|
||||
}
|
||||
LibaoUtils.setLiBaoBtnStatusRound(holder.binding.receiveTv, libaoEntity.status, context)
|
||||
holder.itemView.setOnClickListener {
|
||||
|
||||
Reference in New Issue
Block a user