更新版本
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -29,6 +29,7 @@ import com.ck.ckcollar.app.utils.networkone.ICallback
|
||||
import com.ck.ckcollar.app.utils.networkone.TTHttpClient
|
||||
import com.ck.ckcollar.app.utils.networkone.model.TTRequestParam
|
||||
import com.google.gson.Gson
|
||||
import com.tt.kit.utils.TTUtils
|
||||
import java.io.File
|
||||
|
||||
|
||||
@@ -221,18 +222,26 @@ class MainActivity : CKLHBaseActivity(),View.OnClickListener {
|
||||
}
|
||||
|
||||
fun checkUpdate(){
|
||||
if (hasCheckedUpdate) return
|
||||
hasCheckedUpdate = true
|
||||
|
||||
TTHttpClient.get(this,"更新", TTRequestParam(),object : ICallback{
|
||||
override fun onSuccess(data: String) {
|
||||
|
||||
val model = Gson().fromJson<UpdateModel>(data, UpdateModel::class.java)
|
||||
|
||||
if (model.hasUpdate) {
|
||||
val currentVersionCode = TTUtils.getVersionCode(this@MainActivity)
|
||||
if (model.versionCode > currentVersionCode) {
|
||||
val updateContent = model.content.orEmpty().replace("\\n", "\n")
|
||||
updateDialog = CKUpdateAlertDialog(this@MainActivity, updateContent,
|
||||
model.isForce, object : CKUpdateAlertDialog.AlertClickListener{
|
||||
override fun onBack(isConfirm: Boolean) {
|
||||
if (isConfirm) requestUpdateDownload(model)
|
||||
if (isConfirm) {
|
||||
if (!model.isForce) {
|
||||
toast("更新下载进度可在任务栏中查看")
|
||||
}
|
||||
requestUpdateDownload(model)
|
||||
}
|
||||
}
|
||||
}).also { it.show() }
|
||||
}
|
||||
@@ -329,5 +338,6 @@ class MainActivity : CKLHBaseActivity(),View.OnClickListener {
|
||||
companion object {
|
||||
const val EXTRA_SHOW_HOME = "extra_show_home"
|
||||
private const val EXIT_INTERVAL_MS = 2_000L
|
||||
private var hasCheckedUpdate = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,10 @@ class PayOrderActivity : CKBaseActivity() {
|
||||
|
||||
binding.btnBalance.setOnClickListener {
|
||||
|
||||
if (clearBalanceIfPointsSufficient()) {
|
||||
toast("积分足够无需使用余额")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if ((memberModel?.balance ?: 0.0) <= 0.0){
|
||||
toast(getString(R.string.balance_over))
|
||||
return@setOnClickListener
|
||||
@@ -130,6 +134,7 @@ class PayOrderActivity : CKBaseActivity() {
|
||||
}else{
|
||||
binding.image4.setImageResource(R.mipmap.image_address_check_narmal)
|
||||
}
|
||||
clearBalanceIfPointsSufficient()
|
||||
clearExternalPaymentIfNotNeeded()
|
||||
}
|
||||
|
||||
@@ -429,6 +434,14 @@ class PayOrderActivity : CKBaseActivity() {
|
||||
return pointsDeduction >= payAmount
|
||||
}
|
||||
|
||||
private fun clearBalanceIfPointsSufficient(): Boolean {
|
||||
if (!canPointsCoverPayAmount()) return false
|
||||
|
||||
selectBalance = false
|
||||
binding.image3.setImageResource(R.mipmap.image_address_check_narmal)
|
||||
return true
|
||||
}
|
||||
|
||||
private fun calculatePointsDeduction(): BigDecimal? {
|
||||
val member = memberModel ?: return null
|
||||
val intoAmounts = member.intoAmounts?.toBigDecimalOrNull() ?: return null
|
||||
|
||||
@@ -121,6 +121,10 @@ class OrderActivity : CKBaseActivity() {
|
||||
binding.btnWX.setOnClickListener(payClick)
|
||||
binding.btnBalance.setOnClickListener {
|
||||
|
||||
if (clearBalanceIfPointsSufficient()) {
|
||||
toast("积分足够无需使用余额")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if ((memberModel?.balance ?: 0.0) <= 0.0){
|
||||
toast(getString(R.string.balance_over))
|
||||
return@setOnClickListener
|
||||
@@ -146,6 +150,7 @@ class OrderActivity : CKBaseActivity() {
|
||||
}else{
|
||||
binding.image4.setImageResource(R.mipmap.image_address_check_narmal)
|
||||
}
|
||||
clearBalanceIfPointsSufficient()
|
||||
clearExternalPaymentIfNotNeeded()
|
||||
}
|
||||
|
||||
@@ -566,6 +571,14 @@ class OrderActivity : CKBaseActivity() {
|
||||
return pointsDeduction >= payAmount
|
||||
}
|
||||
|
||||
private fun clearBalanceIfPointsSufficient(): Boolean {
|
||||
if (!canPointsCoverPayAmount()) return false
|
||||
|
||||
selectBalance = false
|
||||
binding.image3.setImageResource(R.mipmap.image_address_check_narmal)
|
||||
return true
|
||||
}
|
||||
|
||||
private fun calculatePointsDeduction(): BigDecimal? {
|
||||
val member = memberModel ?: return null
|
||||
val intoAmounts = member.intoAmounts?.toBigDecimalOrNull() ?: return null
|
||||
|
||||
@@ -46,9 +46,11 @@
|
||||
android:id="@+id/updateProgress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:max="100"
|
||||
android:progress="0" />
|
||||
android:progress="0"
|
||||
android:progressDrawable="@drawable/progress_update_rounded" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/progressText"
|
||||
@@ -58,7 +60,8 @@
|
||||
android:gravity="center"
|
||||
android:text="0%"
|
||||
android:textColor="@color/textSecondColor"
|
||||
android:textSize="13sp" />
|
||||
android:textSize="13sp"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user