Commit 5ee4cfc5 authored by wanglei's avatar wanglei

...

parent ff4b1cd6
......@@ -46,6 +46,7 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlin.random.Random
import kotlin.random.nextLong
@SuppressLint("CustomSplashScreen")
class SplashActivity : BaseActivity<ActivitySplashBinding>() {
......@@ -205,18 +206,22 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
val delayTime = Random.nextLong(300, 550)
delay(delayTime)
processTime += delayTime
if (processTime >= 15000) {
if (processTime >= Random.nextLong(4000, 6000)) {
job?.cancel()
AdmobOpenUtils.showAppOpenAd(this@SplashActivity) {
LogEx.logDebug(TAG, "where $it")
binding.pb.progress = 100
startActivity(Intent(this@SplashActivity, MainActivity::class.java))
finish()
}
outTimeAd()
}
}
}
private fun outTimeAd() {
AdmobOpenUtils.showAppOpenAd(this@SplashActivity) {
LogEx.logDebug(TAG, "where $it")
binding.pb.progress = 100
startActivity(Intent(this@SplashActivity, MainActivity::class.java))
finish()
}
}
override fun onResume() {
super.onResume()
if (ifAgreePrivacy && job?.isActive == false) {
......
......@@ -121,7 +121,7 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() {
val mPathFlow = MutableSharedFlow<String>(
replay = 5,//当新的订阅者Collect时,发送几个已经发送过的数据给它
extraBufferCapacity = 5,//减去replay,MutableSharedFlow还缓存多少数据,缓冲池容量 = replay + extraBufferCapacity
onBufferOverflow = BufferOverflow.SUSPEND//缓存策略,三种 丢掉最新值、丢掉最旧值和挂起
onBufferOverflow = BufferOverflow.DROP_OLDEST//缓存策略,三种 丢掉最新值、丢掉最旧值和挂起
)
val pathFlow: SharedFlow<String> = mPathFlow
......@@ -133,14 +133,11 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() {
)
val foundFlow: SharedFlow<Pair<Int, String>> = mFoundFlow
var pathShowed = false
val dialogClass = FileScanDialog(this)
val scanDialog = dialogClass.showFileScanDialog(pathFlow, foundFlow) {
if (!pathShowed) {
pathShowed = true
dialogClass.scanShowUI()
}
pathList.add(it)
binding.tvFileNumber.text = pathList.size.toString()
setAdapterData(it)
......@@ -165,7 +162,7 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() {
binding.ivWancheng.visibility = View.VISIBLE
binding.tvScanning.text = "Completed"
AdmobInterstitialUtils.showInterstitialAd(this@FileScanResultActivity, isShowDialog = false) {}
binding.ivEmpty.isVisible = pathList.isEmpty()
binding.flEmpty.isVisible = pathList.isEmpty()
setAdapterData(null)
dialogClass.finishScan {
scanDialog.dismiss()
......
......@@ -37,8 +37,8 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
override fun setListener() {
binding.flScan.setOnClickListener {
// startActivity(Intent(requireContext(), ScanJunkActivity::class.java))
sendNotification(requireContext(), ConstObject.ID_SCREENSHOT_CLEAN)
startActivity(Intent(requireContext(), ScanJunkActivity::class.java))
// sendNotification(requireContext(), ConstObject.ID_SCREENSHOT_CLEAN)
}
binding.flRyPhoto.setOnClickListener {
startActivity(Intent(requireContext(), FileScanResultActivity::class.java).apply {
......
......@@ -13,6 +13,7 @@ import com.base.datarecovery.R
import com.base.datarecovery.activity.recovery.FileScanResultActivity
import com.base.datarecovery.ads.AdmobNativeUtils
import com.base.datarecovery.databinding.DialogFileScanBinding
import com.base.datarecovery.utils.LogEx
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.collectLatest
......@@ -59,8 +60,13 @@ class FileScanDialog(
AdmobNativeUtils.showNativeAd(activity, binding.flAd, R.layout.layout_native_custom_big)
var pathShowed = false
activity.lifecycleScope.launch(Dispatchers.Main) {
pathFlow.collectLatest { path ->
if (!pathShowed) {
pathShowed = true
binding.tvPath.visibility = View.VISIBLE
}
binding.tvPath.text = path
}
}
......@@ -85,8 +91,4 @@ class FileScanDialog(
clickAction.invoke()
}
}
fun scanShowUI() {
binding.tvPath.visibility = View.VISIBLE
}
}
\ No newline at end of file
......@@ -185,14 +185,34 @@
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_folder_recovery" />
<ImageView
android:id="@+id/iv_empty"
<LinearLayout
android:id="@+id/fl_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@mipmap/queshengye"
android:orientation="vertical"
android:visibility="gone"
tools:ignore="ContentDescription" />
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@mipmap/queshengye"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:text="File no found"
android:textColor="@color/black"
android:textSize="16sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
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