Commit 9dfff531 authored by wanglei's avatar wanglei

...

parent 400f50c1
......@@ -125,18 +125,24 @@
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<!-- <activity -->
<!-- android:name=".activity.whatsapp.WhatsAppCleanerActivity" -->
<!-- android:exported="false" -->
<!-- android:launchMode="singleTop" -->
<!-- android:screenOrientation="portrait" -->
<!-- tools:ignore="DiscouragedApi,LockedOrientationActivity" /> -->
<!-- <activity -->
<!-- android:name=".activity.whatsapp.WhatsAppMessageCleanActivity" -->
<!-- android:exported="false" -->
<!-- android:launchMode="singleTop" -->
<!-- android:screenOrientation="portrait" -->
<!-- tools:ignore="DiscouragedApi,LockedOrientationActivity" /> -->
<activity
android:name=".activity.whatsapp.WhatsAppCleanerAnimationActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".activity.whatsapp.WhatsAppCleanerActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".activity.whatsapp.WhatsAppMessageCleanActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".activity.privacyspace.PrivacyPinTwoActivity"
android:exported="false"
......
......@@ -12,11 +12,14 @@ import com.base.datarecovery.activity.privacyspace.PrivacySpaceActivity
import com.base.datarecovery.activity.recovery.FileScanResultActivity
import com.base.datarecovery.activity.repeat.RepeatAnimationActivity
import com.base.datarecovery.activity.screenshot.ScreenShotAnimationActivity
import com.base.datarecovery.activity.whatsapp.WhatsAppCleanerActivity
import com.base.datarecovery.activity.whatsapp.WhatsAppCleanerAnimationActivity
import com.base.datarecovery.adapter.AppFunctionAdapter
import com.base.datarecovery.ads.AdmobMaxHelper
import com.base.datarecovery.ads.admob.AdmobInterstitialUtils
import com.base.datarecovery.ads.admob.AdmobNativeUtils
import com.base.datarecovery.bean.ConstObject.JUNK_CLEANER
import com.base.datarecovery.bean.ConstObject.LARGE_FILE
import com.base.datarecovery.bean.ConstObject.PRIVACY_SPACE
import com.base.datarecovery.bean.ConstObject.RECOVERY_DOCUMENTS
import com.base.datarecovery.bean.ConstObject.RECOVERY_PHOTOS
......@@ -26,6 +29,7 @@ import com.base.datarecovery.bean.ConstObject.SCAN_DOCUMENTS
import com.base.datarecovery.bean.ConstObject.SCAN_PHOTOS
import com.base.datarecovery.bean.ConstObject.SCAN_VIDEOS
import com.base.datarecovery.bean.ConstObject.SCREENSHOT_CLEANER
import com.base.datarecovery.bean.ConstObject.WHATSAPP_CLEANER
import com.base.datarecovery.bean.ConstObject.privacyPinPassword
import com.base.datarecovery.databinding.ActivityLayoutResultBinding
import com.base.datarecovery.help.BaseActivity
......@@ -88,6 +92,13 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
})
}
}
WHATSAPP_CLEANER -> {
startActivity(Intent(this, WhatsAppCleanerAnimationActivity::class.java))
}
LARGE_FILE->{
}
}
finish()
}
......@@ -109,7 +120,9 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
.put("last_use_junk_cleaner", System.currentTimeMillis())
}
else -> {}
else -> {
binding.tvInfo.text = "Completed!"
}
}
from?.let {
binding.tvTitle.text = it
......
......@@ -13,6 +13,7 @@ import androidx.lifecycle.lifecycleScope
import com.base.datarecovery.MyApplication
import com.base.datarecovery.activity.guide.GuideActivity
import com.base.datarecovery.activity.junkclean.ScanJunkActivity
import com.base.datarecovery.activity.photomanager.PhotoManagerAnimationActivity
import com.base.datarecovery.activity.privacyspace.PrivacyPinOneActivity
import com.base.datarecovery.activity.privacyspace.PrivacySpaceActivity
import com.base.datarecovery.activity.recovery.FileScanResultActivity
......@@ -20,6 +21,7 @@ import com.base.datarecovery.activity.repeat.RepeatActivity
import com.base.datarecovery.activity.repeat.RepeatAnimationActivity
import com.base.datarecovery.activity.screenshot.ScreenShotActivity
import com.base.datarecovery.activity.screenshot.ScreenShotAnimationActivity
import com.base.datarecovery.activity.whatsapp.WhatsAppCleanerAnimationActivity
import com.base.datarecovery.ads.AdmobMaxHelper
import com.base.datarecovery.ads.admob.AdmobInterstitialUtils
import com.base.datarecovery.ads.admob.AdmobNativeUtils
......@@ -28,13 +30,16 @@ import com.base.datarecovery.ads.max.AdMaxInit.maxInitAction
import com.base.datarecovery.ads.max.AdMaxInterstitialUtils
import com.base.datarecovery.ads.max.AdMaxOpenUtils
import com.base.datarecovery.bean.ConstObject
import com.base.datarecovery.bean.ConstObject.ID_APP_MANAGER
import com.base.datarecovery.bean.ConstObject.ID_JUNK_CLEAN_PUSH
import com.base.datarecovery.bean.ConstObject.ID_LARGE_FILE
import com.base.datarecovery.bean.ConstObject.ID_PRIVACY_SPACE
import com.base.datarecovery.bean.ConstObject.ID_RECOVERY_DOCUMENTS
import com.base.datarecovery.bean.ConstObject.ID_RECOVERY_PHOTOS
import com.base.datarecovery.bean.ConstObject.ID_RECOVERY_VIDEOS
import com.base.datarecovery.bean.ConstObject.ID_SCREENSHOT_CLEAN
import com.base.datarecovery.bean.ConstObject.ID_SIMILAR_IMAGE
import com.base.datarecovery.bean.ConstObject.ID_WHATSAPP_CLEANER
import com.base.datarecovery.bean.ConstObject.ifAgreePrivacy
import com.base.datarecovery.bean.ConstObject.isGuide
import com.base.datarecovery.bean.ConstObject.privacyPinPassword
......@@ -144,11 +149,11 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
}
ID_SIMILAR_IMAGE -> {
startActivity(Intent(this, RepeatAnimationActivity::class.java))
startActivity(Intent(this, PhotoManagerAnimationActivity::class.java))
}
ID_SCREENSHOT_CLEAN -> {
startActivity(Intent(this, ScreenShotAnimationActivity::class.java))
startActivity(Intent(this, PhotoManagerAnimationActivity::class.java))
}
ID_RECOVERY_PHOTOS -> {
......@@ -179,6 +184,18 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
}
}
ID_WHATSAPP_CLEANER -> {
startActivity(Intent(this, WhatsAppCleanerAnimationActivity::class.java))
}
ID_LARGE_FILE -> {
}
ID_APP_MANAGER -> {
}
else -> {
val isHotLaunch = intent?.extras?.getBoolean("isHotLaunch", false) ?: false
if (!isHotLaunch) {
......
package com.base.datarecovery.activity.whatsapp
import android.annotation.SuppressLint
import android.content.Intent
import android.view.View
import android.widget.Toast
import androidx.activity.addCallback
import androidx.lifecycle.lifecycleScope
import com.base.datarecovery.ads.AdmobMaxHelper
import com.base.datarecovery.databinding.ActivityWhatsAppCleanerAnimationBinding
import com.base.datarecovery.help.BaseActivity
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlin.random.Random
class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAnimationBinding>() {
override val binding: ActivityWhatsAppCleanerAnimationBinding by lazy {
ActivityWhatsAppCleanerAnimationBinding.inflate(layoutInflater)
}
override fun initView() {
playLottie()
}
override fun initListener() {
onBackPressedDispatcher.addCallback {
Toast.makeText(this@WhatsAppCleanerAnimationActivity, "wait a moment", Toast.LENGTH_SHORT).show()
}
}
@SuppressLint("SetTextI18n")
private fun playLottie() {
binding.lottie.imageAssetsFolder = "junk_scan/images/"
binding.lottie.setAnimation("junk_scan/data.json")
binding.lottie.playAnimation()
lifecycleScope.launch {
delay(Random.nextLong(3500, 4500))
binding.lottie.cancelAnimation()
binding.lottie.visibility = View.GONE
binding.lottieCompleted.visibility = View.VISIBLE
binding.lottieCompleted.playAnimation()
binding.tv.text="Completed!"
delay(1000)
AdmobMaxHelper.admobMaxShowInterstitialAd(this@WhatsAppCleanerAnimationActivity){
startActivity(Intent(this@WhatsAppCleanerAnimationActivity, WhatsAppCleanerActivity::class.java))
finish()
}
}
}
}
\ No newline at end of file
//package com.base.datarecovery.activity.whatsapp
//
//import android.content.Intent
//import android.graphics.Color
//import androidx.activity.addCallback
//import androidx.recyclerview.widget.GridLayoutManager
//import androidx.recyclerview.widget.LinearLayoutManager
//import com.base.datarecovery.adapter.WhatsAppMediaAdapter
//import com.base.datarecovery.ads.admob.AdmobInterstitialUtils
//import com.base.datarecovery.ads.admob.AdmobNativeUtils
//import com.base.datarecovery.bean.MediaBean
//import com.base.datarecovery.databinding.ActivityWhatsAppMessageCleanBinding
//import com.base.datarecovery.help.BaseActivity
//import com.base.datarecovery.help.KotlinExt.toFormatSize
//import com.base.datarecovery.utils.BarUtils
//import com.google.gson.Gson
//import java.io.File
//
//class WhatsAppMessageCleanActivity : BaseActivity<ActivityWhatsAppMessageCleanBinding>() {
//
// private val pathList by lazy {
// val json = intent.extras?.getString("PathList")
// val list = Gson().fromJson(json, Array<String>::class.java)
// list.map { MediaBean(it) }
// }
// private lateinit var adapter: WhatsAppMediaAdapter
//
// override val binding: ActivityWhatsAppMessageCleanBinding by lazy {
// ActivityWhatsAppMessageCleanBinding.inflate(layoutInflater)
// }
//
//
// override fun initView() {
// BarUtils.setStatusBarLightMode(this, true)
// BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
//
// val tittle = intent.extras?.getString("Tittle") ?: ""
// binding.tvTitle.text = tittle
//
// var isList = false
// when (tittle) {
// "Audio Messages" -> {
// binding.rv.layoutManager = LinearLayoutManager(this)
// isList = true
// }
//
// else -> {
// binding.rv.layoutManager = GridLayoutManager(this, 3)
// }
// }
//
// adapter = WhatsAppMediaAdapter(isList) {
// binding.llSelectAll.isSelected = it
// binding.tvClean.isEnabled = adapter.getSelectData().isNotEmpty()
// val split = adapter.getSelectDataSize().toFormatSize().split(" ")
// binding.tvSize.text = split[0]
// binding.tvUnit.text = split[1]
// }
// binding.rv.adapter = adapter
// adapter.setData(pathList)
//
// AdmobNativeUtils.showNativeAd(this, binding.flAd)
// }
//
// override fun initListener() {
// binding.flBack.setOnClickListener {
// onBackPressedDispatcher.onBackPressed()
// }
// onBackPressedDispatcher.addCallback {
// AdmobInterstitialUtils.showInterstitialAd(this@WhatsAppMessageCleanActivity, isShowInterVal = false) {
// finishToMain()
// }
// }
// binding.llSelectAll.setOnClickListener {
// it.isSelected = !it.isSelected
// adapter.toggleSelect(it.isSelected)
// binding.tvClean.isEnabled = it.isSelected
// val split = adapter.getSelectDataSize().toFormatSize().split(" ")
// binding.tvSize.text = split[0]
// binding.tvUnit.text = split[1]
// }
//
// binding.tvClean.setOnClickListener {
//
// AdmobInterstitialUtils.showInterstitialAd(this) {
// val list = adapter.getSelectData()
// runCatching {
// list.forEach { File(it).delete() }
// }
// finish()
// }
// }
// }
//
//
//}
\ No newline at end of file
package com.base.datarecovery.activity.whatsapp
import android.content.Intent
import android.graphics.Color
import androidx.activity.addCallback
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.base.datarecovery.adapter.WhatsAppMediaAdapter
import com.base.datarecovery.ads.admob.AdmobInterstitialUtils
import com.base.datarecovery.ads.admob.AdmobNativeUtils
import com.base.datarecovery.bean.MediaBean
import com.base.datarecovery.databinding.ActivityWhatsAppMessageCleanBinding
import com.base.datarecovery.help.BaseActivity
import com.base.datarecovery.help.KotlinExt.toFormatSize
import com.base.datarecovery.utils.BarUtils
import com.google.gson.Gson
import java.io.File
class WhatsAppMessageCleanActivity : BaseActivity<ActivityWhatsAppMessageCleanBinding>() {
private val pathList by lazy {
val json = intent.extras?.getString("PathList")
val list = Gson().fromJson(json, Array<String>::class.java)
list.map { MediaBean(it) }
}
private lateinit var adapter: WhatsAppMediaAdapter
override val binding: ActivityWhatsAppMessageCleanBinding by lazy {
ActivityWhatsAppMessageCleanBinding.inflate(layoutInflater)
}
override fun initView() {
BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
val tittle = intent.extras?.getString("Tittle") ?: ""
binding.tvTitle.text = tittle
var isList = false
when (tittle) {
"Audio Messages" -> {
binding.rv.layoutManager = LinearLayoutManager(this)
isList = true
}
else -> {
binding.rv.layoutManager = GridLayoutManager(this, 3)
}
}
adapter = WhatsAppMediaAdapter(isList) {
binding.llSelectAll.isSelected = it
binding.tvClean.isEnabled = adapter.getSelectData().isNotEmpty()
val split = adapter.getSelectDataSize().toFormatSize().split(" ")
binding.tvSize.text = split[0]
binding.tvUnit.text = split[1]
}
binding.rv.adapter = adapter
adapter.setData(pathList)
AdmobNativeUtils.showNativeAd(this, binding.flAd)
}
override fun initListener() {
binding.flBack.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
onBackPressedDispatcher.addCallback {
AdmobInterstitialUtils.showInterstitialAd(this@WhatsAppMessageCleanActivity) {
finishToMain()
}
}
binding.llSelectAll.setOnClickListener {
it.isSelected = !it.isSelected
adapter.toggleSelect(it.isSelected)
binding.tvClean.isEnabled = it.isSelected
val split = adapter.getSelectDataSize().toFormatSize().split(" ")
binding.tvSize.text = split[0]
binding.tvUnit.text = split[1]
}
binding.tvClean.setOnClickListener {
AdmobInterstitialUtils.showInterstitialAd(this) {
val list = adapter.getSelectData()
runCatching {
list.forEach { File(it).delete() }
}
finish()
}
}
}
}
\ No newline at end of file
......@@ -7,13 +7,16 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.base.datarecovery.R
import com.base.datarecovery.bean.ConstObject.APP_MANAGER
import com.base.datarecovery.bean.ConstObject.JUNK_CLEANER
import com.base.datarecovery.bean.ConstObject.LARGE_FILE
import com.base.datarecovery.bean.ConstObject.PRIVACY_SPACE
import com.base.datarecovery.bean.ConstObject.RECOVERY_DOCUMENTS
import com.base.datarecovery.bean.ConstObject.RECOVERY_PHOTOS
import com.base.datarecovery.bean.ConstObject.RECOVERY_VIDEOS
import com.base.datarecovery.bean.ConstObject.REPEAT_PHOTOS
import com.base.datarecovery.bean.ConstObject.SCREENSHOT_CLEANER
import com.base.datarecovery.bean.ConstObject.WHATSAPP_CLEANER
import com.base.datarecovery.databinding.ItemResultFun2Binding
import com.base.datarecovery.databinding.ItemResultFunBinding
import com.base.datarecovery.utils.AppPreferences
......@@ -31,6 +34,9 @@ class AppFunctionAdapter(val click: (name: String) -> Unit) :
Fun(PRIVACY_SPACE, R.mipmap.space),
Fun(REPEAT_PHOTOS, R.mipmap.repeatedphotos),
Fun(SCREENSHOT_CLEANER, R.mipmap.screenshots),
Fun(WHATSAPP_CLEANER, R.mipmap.whatsapp),
Fun(LARGE_FILE, R.mipmap.large),
Fun(APP_MANAGER, R.mipmap.app),
)
class JJJ(view: View) : ViewHolder(view)
......
//package com.base.datarecovery.adapter
//
//import android.annotation.SuppressLint
//import android.graphics.Color
//import android.view.View
//import android.view.ViewGroup
//import androidx.core.content.ContextCompat
//import androidx.recyclerview.widget.RecyclerView
//import androidx.recyclerview.widget.RecyclerView.ViewHolder
//import com.base.datarecovery.R
//import com.base.datarecovery.bean.WhatsAppCleanerBean
//import com.base.datarecovery.databinding.ItemWhatsappBinding
//import com.base.datarecovery.help.KotlinExt.toFormatSize
//import com.base.datarecovery.utils.ScreenUtil.dpToPx
//import com.base.datarecovery.view.XmlEx.inflate
//import com.bumptech.glide.Glide
//import com.bumptech.glide.load.resource.bitmap.CenterCrop
//import com.bumptech.glide.load.resource.bitmap.RoundedCorners
//import com.bumptech.glide.request.RequestOptions
//
//class WhatsAppCleanerAdapter(val click: (bean: WhatsAppCleanerBean) -> Unit) : RecyclerView.Adapter<WhatsAppCleanerAdapter.Whats>() {
//
// private val beanList = arrayListOf<WhatsAppCleanerBean>()
//
// class Whats(view: View) : ViewHolder(view) {
//
// }
//
// override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Whats {
// return Whats(R.layout.item_whatsapp.inflate(parent))
// }
//
// override fun getItemCount(): Int {
// return beanList.size
// }
//
// override fun onBindViewHolder(holder: Whats, position: Int) {
// val binding = ItemWhatsappBinding.bind(holder.itemView)
// val context = holder.itemView.context
// val bean = beanList[position]
// binding.iv.setImageDrawable(ContextCompat.getDrawable(context, bean.icon))
// binding.tvTitle.text = bean.tittle
// if (bean.subFile.isEmpty()) {
// binding.llIv.visibility = View.GONE
// binding.tvSize.setTextColor(Color.parseColor("#999999"))
// binding.ivArrow.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.jianotu_whatsapp))
// binding.tvNoMessage.visibility = View.VISIBLE
// } else {
// binding.llIv.visibility = View.VISIBLE
// runCatching {
// val options = RequestOptions().transform(CenterCrop(), RoundedCorners(context.dpToPx(10)))
// val image1 = bean.subFile[0]
// Glide.with(context).load(image1).apply(options).into(binding.iv1)
//
// val image2 = bean.subFile[1]
// Glide.with(context).load(image2).apply(options).into(binding.iv2)
//
// val image3 = bean.subFile[2]
// Glide.with(context).load(image3).apply(options).into(binding.iv3)
// }
// binding.tvSize.setTextColor(Color.parseColor("#355BEA"))
// binding.tvSize.text = bean.size.toFormatSize()
// binding.ivArrow.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.jianotul_whatsapp))
// binding.tvNoMessage.visibility = View.GONE
// }
// binding.root.setOnClickListener {
// if (bean.subFile.isEmpty()) {
// return@setOnClickListener
// }
// click.invoke(bean)
// }
// }
//
// @SuppressLint("NotifyDataSetChanged")
// fun setData(list: List<WhatsAppCleanerBean>) {
// beanList.clear()
// beanList.addAll(list)
// notifyDataSetChanged()
// }
//
//
//}
\ No newline at end of file
package com.base.datarecovery.adapter
import android.annotation.SuppressLint
import android.graphics.Color
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.base.datarecovery.R
import com.base.datarecovery.bean.WhatsAppCleanerBean
import com.base.datarecovery.databinding.ItemWhatsappBinding
import com.base.datarecovery.help.KotlinExt.toFormatSize
import com.base.datarecovery.utils.ScreenUtil.dpToPx
import com.base.datarecovery.view.XmlEx.inflate
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestOptions
class WhatsAppCleanerAdapter(val click: (bean: WhatsAppCleanerBean) -> Unit) : RecyclerView.Adapter<WhatsAppCleanerAdapter.Whats>() {
private val beanList = arrayListOf<WhatsAppCleanerBean>()
class Whats(view: View) : ViewHolder(view) {
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Whats {
return Whats(R.layout.item_whatsapp.inflate(parent))
}
override fun getItemCount(): Int {
return beanList.size
}
override fun onBindViewHolder(holder: Whats, position: Int) {
val binding = ItemWhatsappBinding.bind(holder.itemView)
val context = holder.itemView.context
val bean = beanList[position]
binding.iv.setImageDrawable(ContextCompat.getDrawable(context, bean.icon))
binding.tvTitle.text = bean.tittle
if (bean.subFile.isEmpty()) {
binding.llIv.visibility = View.GONE
binding.tvSize.setTextColor(Color.parseColor("#999999"))
binding.ivArrow.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.jianotu_whatsapp))
binding.tvNoMessage.visibility = View.VISIBLE
} else {
binding.llIv.visibility = View.VISIBLE
runCatching {
val options = RequestOptions().transform(CenterCrop(), RoundedCorners(context.dpToPx(10)))
val image1 = bean.subFile[0]
Glide.with(context).load(image1).apply(options).into(binding.iv1)
val image2 = bean.subFile[1]
Glide.with(context).load(image2).apply(options).into(binding.iv2)
val image3 = bean.subFile[2]
Glide.with(context).load(image3).apply(options).into(binding.iv3)
}
binding.tvSize.setTextColor(Color.parseColor("#355BEA"))
binding.tvSize.text = bean.size.toFormatSize()
binding.ivArrow.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.jianotul_whatsapp))
binding.tvNoMessage.visibility = View.GONE
}
binding.root.setOnClickListener {
if (bean.subFile.isEmpty()) {
return@setOnClickListener
}
click.invoke(bean)
}
}
@SuppressLint("NotifyDataSetChanged")
fun setData(list: List<WhatsAppCleanerBean>) {
beanList.clear()
beanList.addAll(list)
notifyDataSetChanged()
}
}
\ No newline at end of file
//package com.base.datarecovery.adapter
//
//import android.annotation.SuppressLint
//import android.view.View
//import android.view.ViewGroup
//import androidx.core.content.ContextCompat
//import androidx.recyclerview.widget.RecyclerView
//import com.base.datarecovery.R
//import com.base.datarecovery.bean.MediaBean
//import com.base.datarecovery.databinding.ItemMediaFileBinding
//import com.base.datarecovery.databinding.ItemMediaSelectBinding
//import com.base.datarecovery.help.KotlinExt.toFormatSize
//import com.base.datarecovery.view.XmlEx.inflate
//import com.bumptech.glide.Glide
//import java.io.File
//
//class WhatsAppMediaAdapter(
// private val isList: Boolean = false,
// private val click: (allSelect: Boolean) -> Unit
//) : RecyclerView.Adapter<WhatsAppMediaAdapter.WhatMedia>() {
//
// private val beanList = arrayListOf<MediaBean>()
//
// class WhatMedia(view: View) : RecyclerView.ViewHolder(view)
//
//
// override fun getItemViewType(position: Int): Int {
// return if (isList) 0 else 1
// }
//
// override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WhatMedia {
// val layout = if (viewType == 0) R.layout.item_media_file else R.layout.item_media_select
// return WhatMedia(layout.inflate(parent))
// }
//
// override fun getItemCount(): Int {
// return beanList.size
// }
//
// override fun onBindViewHolder(holder: WhatMedia, position: Int) {
//
// }
//
// override fun onBindViewHolder(holder: WhatMedia, position: Int, payloads: MutableList<Any>) {
//
//
// val context = holder.itemView.context
// val bean = beanList[position]
//
// if (isList) {
// val binding = ItemMediaFileBinding.bind(holder.itemView)
//
// if (payloads.isEmpty()) {
// binding.iv.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.audiomessages))
// val file = File(bean.path)
// binding.tvName.text = file.name
// binding.tvSize.text = file.length().toFormatSize()
// binding.ivSelector.isSelected = bean.isSelect
// binding.root.setOnClickListener {
// binding.ivSelector.isSelected = !binding.ivSelector.isSelected
// bean.isSelect = binding.ivSelector.isSelected
// notifyItemChanged(position, "sdd")
// click.invoke(beanList.all { it.isSelect })
// }
// } else {
// binding.ivSelector.isSelected = bean.isSelect
// super.onBindViewHolder(holder, position, payloads)
// }
// } else {
// val binding = ItemMediaSelectBinding.bind(holder.itemView)
// if (payloads.isEmpty()) {
// Glide.with(context).load(bean.path).centerCrop().into(binding.iv)
// binding.ivSelector.isSelected = bean.isSelect
// binding.root.setOnClickListener {
// binding.ivSelector.isSelected = !binding.ivSelector.isSelected
// bean.isSelect = binding.ivSelector.isSelected
// notifyItemChanged(position, "sdd")
// click.invoke(beanList.all { it.isSelect })
// }
// } else {
// binding.ivSelector.isSelected = bean.isSelect
// super.onBindViewHolder(holder, position, payloads)
// }
//
// }
// }
//
// @SuppressLint("NotifyDataSetChanged")
// fun setData(pathList: List<MediaBean>) {
// beanList.clear()
// beanList.addAll(pathList)
// notifyDataSetChanged()
// }
//
// @SuppressLint("NotifyDataSetChanged")
// fun toggleSelect(select: Boolean) {
// beanList.forEach { it.isSelect = select }
// notifyDataSetChanged()
// }
//
// fun getSelectData(): List<String> {
// return beanList.filter { it.isSelect }.map { it.path }
// }
//
// fun getSelectDataSize(): Long {
// return getSelectData().map { File(it) }.sumOf { it.length() }
// }
//}
\ No newline at end of file
package com.base.datarecovery.adapter
import android.annotation.SuppressLint
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.base.datarecovery.R
import com.base.datarecovery.bean.MediaBean
import com.base.datarecovery.databinding.ItemMediaFileBinding
import com.base.datarecovery.databinding.ItemMediaSelectBinding
import com.base.datarecovery.help.KotlinExt.toFormatSize
import com.base.datarecovery.view.XmlEx.inflate
import com.bumptech.glide.Glide
import java.io.File
class WhatsAppMediaAdapter(
private val isList: Boolean = false,
private val click: (allSelect: Boolean) -> Unit
) : RecyclerView.Adapter<WhatsAppMediaAdapter.WhatMedia>() {
private val beanList = arrayListOf<MediaBean>()
class WhatMedia(view: View) : RecyclerView.ViewHolder(view)
override fun getItemViewType(position: Int): Int {
return if (isList) 0 else 1
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): WhatMedia {
val layout = if (viewType == 0) R.layout.item_media_file else R.layout.item_media_select
return WhatMedia(layout.inflate(parent))
}
override fun getItemCount(): Int {
return beanList.size
}
override fun onBindViewHolder(holder: WhatMedia, position: Int) {
}
override fun onBindViewHolder(holder: WhatMedia, position: Int, payloads: MutableList<Any>) {
val context = holder.itemView.context
val bean = beanList[position]
if (isList) {
val binding = ItemMediaFileBinding.bind(holder.itemView)
if (payloads.isEmpty()) {
binding.iv.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.audiomessages))
val file = File(bean.path)
binding.tvName.text = file.name
binding.tvSize.text = file.length().toFormatSize()
binding.ivSelector.isSelected = bean.isSelect
binding.root.setOnClickListener {
binding.ivSelector.isSelected = !binding.ivSelector.isSelected
bean.isSelect = binding.ivSelector.isSelected
notifyItemChanged(position, "sdd")
click.invoke(beanList.all { it.isSelect })
}
} else {
binding.ivSelector.isSelected = bean.isSelect
super.onBindViewHolder(holder, position, payloads)
}
} else {
val binding = ItemMediaSelectBinding.bind(holder.itemView)
if (payloads.isEmpty()) {
Glide.with(context).load(bean.path).centerCrop().into(binding.iv)
binding.ivSelector.isSelected = bean.isSelect
binding.root.setOnClickListener {
binding.ivSelector.isSelected = !binding.ivSelector.isSelected
bean.isSelect = binding.ivSelector.isSelected
notifyItemChanged(position, "sdd")
click.invoke(beanList.all { it.isSelect })
}
} else {
binding.ivSelector.isSelected = bean.isSelect
super.onBindViewHolder(holder, position, payloads)
}
}
}
@SuppressLint("NotifyDataSetChanged")
fun setData(pathList: List<MediaBean>) {
beanList.clear()
beanList.addAll(pathList)
notifyDataSetChanged()
}
@SuppressLint("NotifyDataSetChanged")
fun toggleSelect(select: Boolean) {
beanList.forEach { it.isSelect = select }
notifyDataSetChanged()
}
fun getSelectData(): List<String> {
return beanList.filter { it.isSelect }.map { it.path }
}
fun getSelectDataSize(): Long {
return getSelectData().map { File(it) }.sumOf { it.length() }
}
}
\ No newline at end of file
......@@ -11,15 +11,20 @@ object ConstObject {
const val ID_RECOVERY_VIDEOS = 13001
const val ID_RECOVERY_DOCUMENTS = 13002
const val ID_PRIVACY_SPACE = 13003
const val ID_WHATSAPP_CLEANER = 13006
const val ID_LARGE_FILE = 13009
const val ID_APP_MANAGER = 13009
const val RECOVERY_PHOTOS = "Recovery Photos"
const val RECOVERY_VIDEOS = "Recovery Videos"
const val RECOVERY_DOCUMENTS = "Recovery Documents"
const val JUNK_CLEANER = "Junk Cleaner"
const val REPEAT_PHOTOS = "Repeat Photos"
const val PHOTO_COMPRESS = "Photo Compress"
const val SCREENSHOT_CLEANER = "Screenshot Cleaner"
const val PRIVACY_SPACE = "Privacy Space"
const val WHATSAPP_CLEANER = "Whatsapp Cleaner"
const val LARGE_FILE = "Large File"
const val APP_MANAGER = "App Manager"
const val SCAN_PHOTOS = 1
const val SCAN_DOCUMENTS = 2
......
......@@ -15,6 +15,7 @@ import com.base.datarecovery.activity.privacyspace.PrivacySpaceActivity
import com.base.datarecovery.activity.recovery.FileScanResultActivity
import com.base.datarecovery.activity.repeat.RepeatAnimationActivity
import com.base.datarecovery.activity.screenshot.ScreenShotAnimationActivity
import com.base.datarecovery.activity.whatsapp.WhatsAppCleanerAnimationActivity
import com.base.datarecovery.bean.ConstObject.SCAN_DOCUMENTS
import com.base.datarecovery.bean.ConstObject.SCAN_PHOTOS
import com.base.datarecovery.bean.ConstObject.SCAN_VIDEOS
......@@ -67,6 +68,9 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>() {
binding.cardPhotosManager.setOnClickListener {
startActivity(Intent(requireContext(), PhotoManagerAnimationActivity::class.java))
}
binding.cardWhatsApp.setOnClickListener {
startActivity(Intent(requireContext(), WhatsAppCleanerAnimationActivity::class.java))
}
binding.flSetting.setOnClickListener {
startActivity(Intent(requireContext(), SettingActivity::class.java))
......
......@@ -115,13 +115,6 @@
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_whatsapp" />
<FrameLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top" />
<TextView
android:id="@+id/tv_tv_got_it"
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<FrameLayout
android:id="@+id/id_top_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/id_tv_title_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="WhatsApp Cleaner"
android:textColor="#333333"
android:textSize="18sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</FrameLayout>
<FrameLayout
android:layout_width="300dp"
android:layout_height="300dp"
app:layout_constraintBottom_toTopOf="@id/tv"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.65">
<com.base.datarecovery.view.XmlLottieAnimationView
android:id="@+id/lottie"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
app:lottie_autoPlay="true"
app:lottie_loop="true" />
<com.base.datarecovery.view.XmlLottieAnimationView
android:id="@+id/lottie_completed"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
android:visibility="gone"
app:lottie_autoPlay="false"
app:lottie_rawRes="@raw/loading_completed"
tools:ignore="MissingClass" />
</FrameLayout>
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="275dp"
android:text="Wait a moment..."
android:textColor="#333333"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="HardcodedText" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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