Commit bed5384e authored by maxiaoliang's avatar maxiaoliang

1

parent 99c90c60
...@@ -21,6 +21,7 @@ import com.base.datarecovery.help.FileHelp ...@@ -21,6 +21,7 @@ import com.base.datarecovery.help.FileHelp
import com.base.datarecovery.help.KotlinExt.toFormatSize import com.base.datarecovery.help.KotlinExt.toFormatSize
import com.base.datarecovery.help.PermissionHelp.checkStorePermission import com.base.datarecovery.help.PermissionHelp.checkStorePermission
import com.base.datarecovery.help.PermissionHelp.requestStorePermission import com.base.datarecovery.help.PermissionHelp.requestStorePermission
import com.base.datarecovery.utils.AppPreferences
import com.base.datarecovery.utils.BarUtils import com.base.datarecovery.utils.BarUtils
import com.base.datarecovery.utils.MediaStoreUtils import com.base.datarecovery.utils.MediaStoreUtils
import com.base.datarecovery.view.DialogViews.showExitFunctionDialog import com.base.datarecovery.view.DialogViews.showExitFunctionDialog
...@@ -107,21 +108,44 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() { ...@@ -107,21 +108,44 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
when (binding.tvBtn.text) { when (binding.tvBtn.text) {
"Got it" -> { "Got it" -> {
startActivity(Intent(this@CleanJunkActivity, ResultActivity::class.java).apply { val showJunkBtnAd = AppPreferences.getInstance().getString("isGotItplayAd", "0").toInt()
putExtra("clean_size", JUNK_CLEANER) if (showJunkBtnAd == 1) {
putExtra("from", 0) AdmobMaxHelper.admobMaxShowInterstitialAd(this){
}) startActivity(Intent(this@CleanJunkActivity, ResultActivity::class.java).apply {
putExtra("clean_size", JUNK_CLEANER)
putExtra("from", 0)
})
}
}else{
startActivity(Intent(this@CleanJunkActivity, ResultActivity::class.java).apply {
putExtra("clean_size", JUNK_CLEANER)
putExtra("from", 0)
})
}
} }
else -> { else -> {
startActivity( val showJunkBtnAd = AppPreferences.getInstance().getString("isGotItplayAd", "0").toInt()
Intent(this, CleaningActivity::class.java).apply { if (showJunkBtnAd == 1) {
val list = junkExpandAdapter.getChoosePath() AdmobMaxHelper.admobMaxShowInterstitialAd(this){
putExtra("list", list.map { it.chilepath }.toTypedArray()) startActivity(
putExtra("size", list.sumOf { it.childSize }) Intent(this, CleaningActivity::class.java).apply {
val list = junkExpandAdapter.getChoosePath()
putExtra("list", list.map { it.chilepath }.toTypedArray())
putExtra("size", list.sumOf { it.childSize })
}
)
} }
) }else{
startActivity(
Intent(this, CleaningActivity::class.java).apply {
val list = junkExpandAdapter.getChoosePath()
putExtra("list", list.map { it.chilepath }.toTypedArray())
putExtra("size", list.sumOf { it.childSize })
}
)
}
} }
} }
finish() finish()
......
package com.base.datarecovery.activity.junkclean
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import android.view.View
import android.view.animation.LinearInterpolator
import android.widget.Toast
import androidx.activity.addCallback
import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
import com.base.datarecovery.ads.AdmobMaxHelper
import com.base.datarecovery.databinding.ActivityLayoutScanJunkBinding
import com.base.datarecovery.help.BaseActivity
import com.base.datarecovery.help.PermissionHelp.checkStorePermission
import com.base.datarecovery.help.PermissionHelp.requestStorePermission
import com.base.datarecovery.utils.BarUtils
import com.base.datarecovery.utils.LogEx
import com.base.datarecovery.view.DialogViews.showGerPermission
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
class ScanJunk2Activity : BaseActivity<ActivityLayoutScanJunkBinding>() {
private val TAG = "ScanJunkActivity"
override val binding: ActivityLayoutScanJunkBinding by lazy {
ActivityLayoutScanJunkBinding.inflate(layoutInflater)
}
private var job: Job? = null
override fun initView() {
LogEx.logDebug(TAG,"ScanJunkActivity initView")
BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
}
override fun initListener() {
onBackPressedDispatcher.addCallback {
Toast.makeText(this@ScanJunk2Activity, "wait a moment", Toast.LENGTH_SHORT).show()
}
}
override fun onResume() {
super.onResume()
resumeLottie()
job = waitJob()
}
override fun onDestroy() {
super.onDestroy()
animator1?.cancel()
animator2?.cancel()
animator3?.cancel()
binding.lottie.cancelAnimation()
}
override fun onPause() {
super.onPause()
animator1?.pause()
animator2?.pause()
animator3?.pause()
binding.lottie.pauseAnimation()
job?.cancel()
}
@SuppressLint("SetTextI18n")
private fun resumeLottie() {
if (animator1 == null) {
animator1 = ValueAnimator.ofFloat(0f, 360f)
animator1?.run {
duration = 1000
repeatMode = ValueAnimator.RESTART
repeatCount = ValueAnimator.INFINITE
interpolator = LinearInterpolator()
addUpdateListener {
binding.idView1.rotation = it.animatedValue as Float
}
}
}
animator1?.start()
if (animator2 == null) {
animator2 = ValueAnimator.ofFloat(0f, 360f)
animator2?.run {
duration = 1000
repeatMode = ValueAnimator.RESTART
repeatCount = ValueAnimator.INFINITE
interpolator = LinearInterpolator()
addUpdateListener {
binding.idView2.rotation = it.animatedValue as Float
}
}
}
animator2?.start()
if (animator3 == null) {
animator3 = ValueAnimator.ofFloat(0f, 360f)
animator3?.run {
duration = 1000
repeatMode = ValueAnimator.RESTART
repeatCount = ValueAnimator.INFINITE
interpolator = LinearInterpolator()
addUpdateListener {
binding.idView3.rotation = it.animatedValue as Float
}
}
}
animator3?.start()
binding.lottie.imageAssetsFolder = "junk_scan/images/"
binding.lottie.setAnimation("junk_scan/data.json")
binding.lottie.playAnimation()
}
private fun waitJob() = lifecycleScope.launch(Dispatchers.Main) {
delay(5000)
binding.lottie.visibility = View.GONE
binding.lottieCompleted.visibility = View.VISIBLE
binding.lottieCompleted.playAnimation()
binding.tv.text = "Completed!"
animator1?.cancel()
animator2?.cancel()
animator3?.cancel()
delay(1000)
AdmobMaxHelper.admobMaxShowInterstitialAd(this@ScanJunk2Activity) {
startActivity(Intent(this@ScanJunk2Activity, CleanJunkActivity::class.java))
finish()
}
}
private var animator1: ValueAnimator? = null
private var animator2: ValueAnimator? = null
private var animator3: ValueAnimator? = null
}
\ No newline at end of file
package com.base.datarecovery.utils package com.base.datarecovery.utils
import android.os.Build
import android.util.Log import android.util.Log
import androidx.annotation.RequiresApi
import com.base.datarecovery.BuildConfig import com.base.datarecovery.BuildConfig
import com.base.datarecovery.ads.AdDisplayUtils import com.base.datarecovery.ads.AdDisplayUtils
import com.base.datarecovery.bean.ConfigBean import com.base.datarecovery.bean.ConfigBean
...@@ -15,8 +17,10 @@ import java.io.BufferedReader ...@@ -15,8 +17,10 @@ import java.io.BufferedReader
import java.io.InputStreamReader import java.io.InputStreamReader
import java.net.HttpURLConnection import java.net.HttpURLConnection
import java.net.URL import java.net.URL
import java.util.Base64
import java.util.Locale import java.util.Locale
@RequiresApi(Build.VERSION_CODES.O)
object NewComUtils { object NewComUtils {
private val TAG = "NewComUtils" private val TAG = "NewComUtils"
private const val API_URL = ConfigHelper.apiUrl private const val API_URL = ConfigHelper.apiUrl
...@@ -28,9 +32,10 @@ object NewComUtils { ...@@ -28,9 +32,10 @@ object NewComUtils {
private val url: String by lazy { private val url: String by lazy {
val packageName = ConfigHelper.packageName val packageName = ConfigHelper.packageName
val appCode = packageName.substringAfter(PACKAGE_NAME_PREFIX).take(5).toLowerCase(Locale.getDefault()) val appCode = packageName.substringAfter(PACKAGE_NAME_PREFIX).take(5).toLowerCase(Locale.getDefault())
"$API_URL/${appCode}spk?pkg=$packageName" + "&referrer=" + val baseRefer=
AppPreferences.getInstance().getString("referrerUrl", "")+"&vn=${BuildConfig.VERSION_NAME}"+ Base64.getEncoder().encodeToString(AppPreferences.getInstance().getString("referrerUrl", "").toByteArray())
"&vc=${BuildConfig.VERSION_CODE}" "$API_URL/${appCode}spk?pkg=$packageName" + "&referrer=${baseRefer}" +"&vn=${BuildConfig.VERSION_NAME}"+
"&vc=${BuildConfig.VERSION_CODE}&device=${AppPreferences.getInstance().getString("gid", "")}&aid=${AppPreferences.getInstance().getString("uuid", "")}"
} }
fun requestCfg(callback: (ConfigBean?) -> Unit) { fun requestCfg(callback: (ConfigBean?) -> Unit) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment