【提现】目前提现公式中单个广告价值没有*5 导致看一个广告进度不会增加,麻烦确定下设定
This commit is contained in:
parent
439d04706b
commit
a2a458e6d9
|
|
@ -94,7 +94,7 @@ object VidiConst {
|
|||
|
||||
const val DIAMOND_NUM_FOR_ONE_AD = 1
|
||||
const val WITHDRAW_SMALL_NUM = 0.1F
|
||||
const val WITHDRAW_REWARD_AD_REVENUE_PERCENT = 0.3
|
||||
const val WITHDRAW_REWARD_AD_REVENUE_PERCENT = 1.0
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ class WithDrawSubActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
|||
val subBean = mCurItem.subItemList[mSelectingIndex]
|
||||
val curProgress = subBean.currentAdProgress
|
||||
progressBar.setProgress(curProgress)
|
||||
tvProgress.text = "$curProgress%"
|
||||
tvProgress.text = "${"%.2f".format(curProgress) }%"
|
||||
|
||||
ivAction.isVisible = curProgress < 100
|
||||
if (curProgress < 100) {
|
||||
|
|
|
|||
|
|
@ -131,14 +131,14 @@ class WithdrawManager private constructor() {
|
|||
|
||||
for (i in 0..subItemCount-1) {
|
||||
val initProgress = AndroidUtil.randomInt(50, 70)
|
||||
subItemList.add(WithdrawSubItem(i, EACH_SUB_ITEM_CASH_NUM, initProgress, initProgress, 0.0))
|
||||
subItemList.add(WithdrawSubItem(i, EACH_SUB_ITEM_CASH_NUM, initProgress, initProgress.toFloat(), 0.0))
|
||||
}
|
||||
return subItemList
|
||||
}
|
||||
|
||||
private fun generateSmallItemList(): List<WithdrawSubItem> {
|
||||
val subItemList = mutableListOf<WithdrawSubItem>()
|
||||
subItemList.add(WithdrawSubItem(0, 0.1, 100, 100, 0.1))
|
||||
subItemList.add(WithdrawSubItem(0, 0.1, 100, 100F, 0.1))
|
||||
return subItemList
|
||||
}
|
||||
|
||||
|
|
@ -194,14 +194,14 @@ class WithdrawManager private constructor() {
|
|||
private fun calculateSubBeanProgress(subBean: WithdrawSubItem) {
|
||||
val needEarnProgress = 100 - subBean.startAdProgress
|
||||
if (subBean.hasEarnMoneyByAd >= subBean.cashTotal) {
|
||||
subBean.currentAdProgress = 100
|
||||
subBean.currentAdProgress = 100F
|
||||
// update state
|
||||
if (subBean.withdrawState == STATE_NEED_WATCH_AD) {
|
||||
subBean.withdrawState = STATE_COULD_WITHDRAW
|
||||
}
|
||||
} else {
|
||||
val newProgress = subBean.startAdProgress + (needEarnProgress * (subBean.hasEarnMoneyByAd / subBean.cashTotal)).toInt()
|
||||
subBean.currentAdProgress = if (newProgress >= 100) 100 else newProgress
|
||||
val newProgress = subBean.startAdProgress + (needEarnProgress * (subBean.hasEarnMoneyByAd / subBean.cashTotal)).toFloat()
|
||||
subBean.currentAdProgress = if (newProgress >= 100F) 100F else newProgress
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ class WithdrawManager private constructor() {
|
|||
|
||||
subItemList.forEach { subItem ->
|
||||
subItem.apply {
|
||||
currentAdProgress = startAdProgress
|
||||
currentAdProgress = startAdProgress.toFloat()
|
||||
hasEarnMoneyByAd = 0.0
|
||||
withdrawState = STATE_NEED_WATCH_AD
|
||||
}
|
||||
|
|
@ -739,7 +739,7 @@ data class WithdrawSubItem(
|
|||
val dayIndex: Int,
|
||||
val cashTotal: Double,
|
||||
val startAdProgress: Int = 0,
|
||||
var currentAdProgress: Int = 0,
|
||||
var currentAdProgress: Float = 0F,
|
||||
var hasEarnMoneyByAd: Double = 0.0,
|
||||
var withdrawState: Int = STATE_NEED_WATCH_AD,
|
||||
)
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
android:layout_height="13dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="10dp">
|
||||
<com.ama.core.architecture.widget.CustomProgressBar
|
||||
<com.ama.core.architecture.widget.CustomProgressBarFloat
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,122 @@
|
|||
package com.ama.core.architecture.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import androidx.core.graphics.withSave
|
||||
import com.ama.core.architecture.R
|
||||
import com.ama.core.architecture.util.ResUtil
|
||||
|
||||
class CustomProgressBarFloat(context: Context, attrs: AttributeSet) : View(context, attrs) {
|
||||
|
||||
private var progress = 0F
|
||||
private var max = 100F
|
||||
|
||||
private var mBgColor = ResUtil.getColor(R.color.gray_d3)
|
||||
private var mForColor = ResUtil.getColor(R.color.green_09)
|
||||
private var mEnableTouch: Boolean = false
|
||||
|
||||
|
||||
|
||||
private val paint = Paint().apply {
|
||||
isAntiAlias = true
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
val width = measuredWidth.toFloat()
|
||||
val height = measuredHeight.toFloat()
|
||||
|
||||
|
||||
|
||||
canvas.withSave {
|
||||
paint.color = mBgColor
|
||||
canvas.drawRoundRect(0f, 0f, width, height, height/2, height/2, paint)
|
||||
val completeProgressWidth = (width) * progress / max
|
||||
if (completeProgressWidth > 0) {
|
||||
paint.color = mForColor
|
||||
canvas.drawRoundRect(0f, 0f, completeProgressWidth, height, height/2, height/2, paint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun setProgress(progress: Float) {
|
||||
this.progress = if (progress > 100F) 100F else progress
|
||||
invalidate()
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun enableTouch(enableTouch: Boolean) {
|
||||
mEnableTouch = enableTouch
|
||||
}
|
||||
|
||||
fun setBarColor(bgColor: Int=R.color.gray_d3, forColor: Int=R.color.green_09) {
|
||||
mBgColor = ResUtil.getColor(bgColor)
|
||||
mForColor = ResUtil.getColor(forColor)
|
||||
invalidate()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------- New added ----------------------------
|
||||
private var onProgressChangeListener: OnProgressChangeListener? = null
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
if (mEnableTouch) {
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
parent.requestDisallowInterceptTouchEvent(true)
|
||||
updateProgressFromTouch(event.x)
|
||||
return true
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
updateProgressFromTouch(event.x)
|
||||
return true
|
||||
}
|
||||
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
|
||||
parent.requestDisallowInterceptTouchEvent(false)
|
||||
updateProgressFromTouch(event.x, true)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.onTouchEvent(event)
|
||||
}
|
||||
|
||||
private fun updateProgressFromTouch(touchX: Float, notifyNewProgress: Boolean = false) {
|
||||
val width = width.toFloat()
|
||||
if (width > 0) {
|
||||
var newProgress = (touchX / width * max)
|
||||
newProgress = if (newProgress > 100F) 100F else progress
|
||||
|
||||
if (Math.abs(newProgress - progress) > 0.0001F) {
|
||||
setProgress(newProgress)
|
||||
|
||||
if (notifyNewProgress) {
|
||||
onProgressChangeListener?.onProgressChanged(newProgress)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setOnProgressChangeListener(listener: OnProgressChangeListener) {
|
||||
this.onProgressChangeListener = listener
|
||||
}
|
||||
|
||||
interface OnProgressChangeListener {
|
||||
fun onProgressChanged(progress: Float)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue