Commit f784fd90 authored by wanglei's avatar wanglei

...

parent b19262a2
......@@ -25,6 +25,7 @@ import com.base.appzxhy.business.ads.AdsMgr
import com.base.appzxhy.business.ads.AdsShowCallBack
import com.base.appzxhy.databinding.ActivityCleanResultBinding
import com.base.appzxhy.databinding.ItemCleanResultBinding
import com.base.appzxhy.ui.malware.MalwareDialog
import com.base.appzxhy.utils.MyAnimationUtils
import com.base.appzxhy.utils.Utils
......@@ -53,9 +54,17 @@ class CleanResultActivity : BaseActivity<ActivityCleanResultBinding>(ActivityCle
holder.binding.ivImage.setImageResource(item.icon)
holder.binding.tvName.text = getString(item.titleRes)
holder.binding.tvContent.setText(item.content)
holder.binding.tvCleanNow.setOnClickListener {
holder.binding.tvTry.setOnClickListener {
if (item.key == ANTIVIRUS) {
val dialog = MalwareDialog(this@CleanResultActivity)
dialog.action={
jumpAction(item.key)
}
dialog.showDialog()
} else {
jumpAction(item.key)
}
}
val translationX = resources.displayMetrics.widthPixels.toFloat()
holder.itemView.translationX = -translationX
......@@ -115,20 +124,34 @@ class CleanResultActivity : BaseActivity<ActivityCleanResultBinding>(ActivityCle
private fun getData(): MutableList<FeatureBean> {
val list = mutableListOf<FeatureBean>().apply {
add(FeatureBean(JUNK_CLEAN, R.string.junk_clean, R.drawable.h_junkclean, R.string.result_junk_clean))
add(FeatureBean(BATTERY_INFO, R.string.battery_info, R.drawable.h_battery, R.string.result_battery_info))
add(FeatureBean(LARGE_FILE_CLEAN, R.string.large_file_clean, R.drawable.h_lagre, R.string.result_large_file_clean))
add(FeatureBean(JUNK_CLEAN, R.string.junk_clean, R.drawable.icon_clean_r, R.string.result_junk_clean))
add(FeatureBean(ANTIVIRUS, R.string.antivirus, R.drawable.icon_antivirus_r, R.string.result_antivirus))
add(
FeatureBean(
SCREENSHOT_CLEAN,
R.string.screenshot_clean,
R.drawable.icon_screenshot_r,
R.string.result_screenshot_clean
)
)
add(
FeatureBean(
LARGE_FILE_CLEAN,
R.string.large_file_clean,
R.drawable.icon_large_file_clean_r,
R.string.result_large_file_clean
)
)
add(FeatureBean(SIMILAR_PHOTOS, R.string.similar_photos, R.drawable.icon_similar_photos_r, R.string.result_similar_photos))
add(
FeatureBean(
PHOTO_COMPRESSION,
R.string.photo_compression,
R.drawable.h_compression,
R.drawable.icon_image_compression_r,
R.string.result_photo_compression
)
)
add(FeatureBean(SCREENSHOT_CLEAN, R.string.screenshot_clean, R.drawable.h_screenshot, R.string.result_screenshot_clean))
add(FeatureBean(SIMILAR_PHOTOS, R.string.similar_photos, R.drawable.h_similar, R.string.result_similar_photos))
add(FeatureBean(BATTERY_INFO, R.string.battery_info, R.drawable.icon_battery_info_r, R.string.result_battery_info))
}
......
......@@ -91,7 +91,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
}
viewModel.onTick = { s, t, p ->
Log.e(TAG, "onTick $s $t")
binding.progressBar.progress = p.toInt()
binding.progressBar.setProgress(p.toInt(), true)
}
}
......@@ -181,13 +181,18 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
val acAction = {
initUMP {
LogEx.logDebug(TAG, "initUMP callback")
AdsMgr.showOpen(this, showCallBack = object : AdsShowCallBack() {
override fun show() {
viewModel.stopCountdown()
binding.progressBar.setProgress(100, true)
}
override fun next() {
binding.root.postDelayed({ jumpNext() }, 200)
LogEx.logDebug(TAG, "next")
viewModel.overCountDown()
binding.progressBar.setProgress(100, true)
binding.root.postDelayed({ jumpNext() }, 250)
}
})
......
......@@ -18,6 +18,7 @@ class SplashViewModel : ViewModel() {
private var startTime: Long = 0
val totalTimeMs = AdConfigBean.adsConfigBean.openAdLoading * 1000L // 倒计时总时长
private val checkIntervalMs = 100L // 检查间隔(100毫秒)
private var countdownOver: Boolean = false
var jumpNext: (() -> Unit)? = null
var onTick: ((sLong: Long, total: Long, percent: Float) -> Unit)? = null
......@@ -26,6 +27,8 @@ class SplashViewModel : ViewModel() {
if (!ifAgreePrivacy) return
if (countdownOver) return
countdownJob?.cancel()
startTime = System.currentTimeMillis()
countdownJob = viewModelScope.launch(Dispatchers.IO) {
......@@ -62,4 +65,12 @@ class SplashViewModel : ViewModel() {
countdownJob?.cancel()
countdownJob = null
}
/**
* 永久结束倒计时
*/
fun overCountDown() {
countdownOver = true
stopCountdown()
}
}
......@@ -4,16 +4,29 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="15dp"
android:background="@drawable/white_background"
android:padding="16dp">
android:layout_marginVertical="@dimen/dp_8">
<androidx.cardview.widget.CardView
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dp_15"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="@dimen/dp_12"
app:cardElevation="0dp"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_image"
android:layout_width="@dimen/dp_40"
android:layout_height="@dimen/dp_40"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"
android:layout_marginStart="@dimen/dp_14"
android:layout_marginTop="@dimen/dp_20"
android:src="@drawable/h_junkclean"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......@@ -24,9 +37,10 @@
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="@id/iv_image"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_image"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toTopOf="@id/iv_image">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_name"
......@@ -34,42 +48,50 @@
android:layout_height="wrap_content"
android:text="@string/junk_clean"
android:textColor="@color/color_181b1f"
android:textSize="16sp"
android:textSize="@dimen/sp_16"
android:textStyle="bold" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
android:text="@string/result_junk_clean"
android:textColor="@color/color_666666"
android:textSize="16sp" />
android:textColor="#999999"
android:textSize="@dimen/sp_14" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_clean_now"
android:layout_width="match_parent"
<TextView
android:id="@+id/tvTry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@drawable/bg_btn_50"
android:gravity="center"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="@string/clean_now"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@id/ll_content"
tools:layout_editor_absoluteX="16dp" />
android:layout_marginTop="@dimen/dp_8"
android:layout_marginEnd="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_20"
android:gravity="center_vertical"
android:text="@string/try_it_new"
android:textColor="#2DD29E"
app:drawableEndCompat="@drawable/jiangtou_3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/ll_content" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<com.base.appzxhy.business.ads.NativeParentView
android:id="@+id/flAd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dp_15"
android:layout_marginTop="4dp"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@id/tv_clean_now">
app:layout_constraintTop_toBottomOf="@id/card"
tools:visibility="visible">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
......
......@@ -65,6 +65,7 @@ Please rest assured that we will handle your information in strict accordance wi
<string name="cleaned_up">Cleaned Up</string>
<string name="cleaned_up_content">Cleaned up other data to free up more space</string>
<string name="result_junk_clean">Clean up unnecessary junk files!</string>
<string name="result_antivirus">Mobile antivirus protection</string>
<string name="clean_now">Clean Now</string>
<string name="result_battery_info">View battery usage and details</string>
<string name="result_large_file_clean">Clean large flies to free up storage space</string>
......@@ -203,6 +204,7 @@ Please rest assured that we will handle your information in strict accordance wi
<string name="one_tap_clean">One - Tap Clean</string>
<string name="get_started">Get Started</string>
<string name="loading">loading...</string>
<string name="try_it_new">Try it New</string>
</resources>
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