Commit c2ee5c97 authored by wanglei's avatar wanglei

...

parent 16ed26eb
...@@ -34,9 +34,7 @@ ...@@ -34,9 +34,7 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.DataRecovery" android:theme="@style/Theme.DataRecovery"
tools:targetApi="34"> tools:targetApi="34">
<activity
android:name=".activity.battery.BatteryActivity"
android:exported="false" />
<activity <activity
android:name=".activity.SplashActivity" android:name=".activity.SplashActivity"
android:exported="true" android:exported="true"
...@@ -48,6 +46,18 @@ ...@@ -48,6 +46,18 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".activity.battery.BatteryInfoAnimationActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".activity.battery.BatteryActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity <activity
android:name=".activity.largefile.LargeFileAnimationActivity" android:name=".activity.largefile.LargeFileAnimationActivity"
android:exported="false" android:exported="false"
......
{"v":"5.8.1","fr":60,"ip":0,"op":240,"w":720,"h":1280,"nm":"4a","ddd":0,"assets":[{"id":"image_0","w":498,"h":497,"u":"images/","p":"img_0.png","e":0},{"id":"image_1","w":498,"h":251,"u":"images/","p":"img_1.png","e":0},{"id":"image_2","w":419,"h":513,"u":"images/","p":"img_2.png","e":0},{"id":"comp_0","nm":"scan","fr":60,"layers":[{"ddd":0,"ind":1,"ty":2,"nm":"scan.png","cl":"png","refId":"image_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":0,"s":[30]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":15,"s":[100]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"t":222,"s":[100]},{"t":239,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[360,552,0],"ix":2,"l":2},"a":{"a":0,"k":[249,248.5,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.667,0.667,0.667],"y":[0.731,0.731,-28.047]},"o":{"x":[0.333,0.333,0.333],"y":[0,0,0]},"t":0,"s":[0,0,100]},{"i":{"x":[0.667,0.667,0.667],"y":[0.52,0.52,3.935]},"o":{"x":[0.333,0.333,0.333],"y":[-0.88,-0.88,10.562]},"t":11,"s":[108,108,100]},{"i":{"x":[0.667,0.667,0.667],"y":[1,1,1]},"o":{"x":[0.333,0.333,0.333],"y":[-1.081,-1.081,-2.202]},"t":15,"s":[96,96,100]},{"t":18,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"ip":0,"op":720,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":2,"nm":"sm.png","cl":"png","refId":"image_1","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":17,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":32,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":47,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":64,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":81,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":96,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":111,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":126,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":143,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":160,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":175,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":190,"s":[100]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":205,"s":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":222,"s":[100]},{"t":239,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":17,"s":[360,432,0],"to":[0,80,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":47,"s":[360,912,0],"to":[0,0,0],"ti":[0,80,0]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":81,"s":[360,432,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":96,"s":[360,432,0],"to":[0,80,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":126,"s":[360,912,0],"to":[0,0,0],"ti":[0,80,0]},{"i":{"x":0.667,"y":0.667},"o":{"x":0.333,"y":0.333},"t":160,"s":[360,432,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":175,"s":[360,432,0],"to":[0,80,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":205,"s":[360,912,0],"to":[0,0,0],"ti":[0,80,0]},{"t":239,"s":[360,432,0]}],"ix":2,"l":2},"a":{"a":0,"k":[249,125.5,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":720,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"scan","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[360,640,0],"ix":2,"l":2},"a":{"a":0,"k":[360,640,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"w":720,"h":1280,"ip":0,"op":720,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":2,"nm":"4-battery.png","cl":"png","refId":"image_2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[360,584,0],"ix":2,"l":2},"a":{"a":0,"k":[209.5,256.5,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":720,"st":0,"bm":0}],"markers":[]}
\ No newline at end of file
...@@ -6,7 +6,9 @@ import android.graphics.Color ...@@ -6,7 +6,9 @@ import android.graphics.Color
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import com.base.filerecoveryrecyclebin.activity.appprocess.AppProcessAnimationActivity import com.base.filerecoveryrecyclebin.activity.appprocess.AppProcessAnimationActivity
import com.base.filerecoveryrecyclebin.activity.battery.BatteryInfoAnimationActivity
import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity
import com.base.filerecoveryrecyclebin.activity.largefile.LargeFileAnimationActivity
import com.base.filerecoveryrecyclebin.activity.recovery.FileScanResultActivity import com.base.filerecoveryrecyclebin.activity.recovery.FileScanResultActivity
import com.base.filerecoveryrecyclebin.activity.repeat.RepeatAnimationActivity import com.base.filerecoveryrecyclebin.activity.repeat.RepeatAnimationActivity
import com.base.filerecoveryrecyclebin.activity.screenshot.ScreenShotAnimationActivity import com.base.filerecoveryrecyclebin.activity.screenshot.ScreenShotAnimationActivity
...@@ -14,7 +16,9 @@ import com.base.filerecoveryrecyclebin.activity.whatsapp.WhatsAppCleanerAnimatio ...@@ -14,7 +16,9 @@ import com.base.filerecoveryrecyclebin.activity.whatsapp.WhatsAppCleanerAnimatio
import com.base.filerecoveryrecyclebin.adapter.AppFunctionAdapter import com.base.filerecoveryrecyclebin.adapter.AppFunctionAdapter
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.bean.ConstObject.APP_PROCESS import com.base.filerecoveryrecyclebin.bean.ConstObject.APP_PROCESS
import com.base.filerecoveryrecyclebin.bean.ConstObject.BATTERY_INFO
import com.base.filerecoveryrecyclebin.bean.ConstObject.JUNK_CLEANER import com.base.filerecoveryrecyclebin.bean.ConstObject.JUNK_CLEANER
import com.base.filerecoveryrecyclebin.bean.ConstObject.LARGE_FILE
import com.base.filerecoveryrecyclebin.bean.ConstObject.PRIVACY_SPACE import com.base.filerecoveryrecyclebin.bean.ConstObject.PRIVACY_SPACE
import com.base.filerecoveryrecyclebin.bean.ConstObject.RECOVERY_DOCUMENTS import com.base.filerecoveryrecyclebin.bean.ConstObject.RECOVERY_DOCUMENTS
import com.base.filerecoveryrecyclebin.bean.ConstObject.RECOVERY_PHOTOS import com.base.filerecoveryrecyclebin.bean.ConstObject.RECOVERY_PHOTOS
...@@ -84,6 +88,14 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() { ...@@ -84,6 +88,14 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
APP_PROCESS -> { APP_PROCESS -> {
startActivity(Intent(this, AppProcessAnimationActivity::class.java)) startActivity(Intent(this, AppProcessAnimationActivity::class.java))
} }
LARGE_FILE -> {
startActivity(Intent(this, LargeFileAnimationActivity::class.java))
}
BATTERY_INFO -> {
startActivity(Intent(this, BatteryInfoAnimationActivity::class.java))
}
} }
finish() finish()
} }
......
...@@ -11,6 +11,7 @@ import android.view.View ...@@ -11,6 +11,7 @@ import android.view.View
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.MyApplication import com.base.filerecoveryrecyclebin.MyApplication
import com.base.filerecoveryrecyclebin.activity.appprocess.AppProcessAnimationActivity import com.base.filerecoveryrecyclebin.activity.appprocess.AppProcessAnimationActivity
import com.base.filerecoveryrecyclebin.activity.battery.BatteryInfoAnimationActivity
import com.base.filerecoveryrecyclebin.activity.guide.GuideActivity import com.base.filerecoveryrecyclebin.activity.guide.GuideActivity
import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity
import com.base.filerecoveryrecyclebin.activity.photomanager.PhotoManagerAnimationActivity import com.base.filerecoveryrecyclebin.activity.photomanager.PhotoManagerAnimationActivity
...@@ -20,6 +21,7 @@ import com.base.filerecoveryrecyclebin.activity.whatsapp.WhatsAppCleanerAnimatio ...@@ -20,6 +21,7 @@ import com.base.filerecoveryrecyclebin.activity.whatsapp.WhatsAppCleanerAnimatio
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.bean.ConstObject import com.base.filerecoveryrecyclebin.bean.ConstObject
import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_APP_PROCESS import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_APP_PROCESS
import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_BATTERY_INFO
import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_JUNK_CLEAN_PUSH import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_JUNK_CLEAN_PUSH
import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_RECOVERY_DOCUMENTS import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_RECOVERY_DOCUMENTS
import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_RECOVERY_PHOTOS import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_RECOVERY_PHOTOS
...@@ -169,6 +171,10 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() { ...@@ -169,6 +171,10 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
startActivity(Intent(this, AppProcessAnimationActivity::class.java)) startActivity(Intent(this, AppProcessAnimationActivity::class.java))
} }
ID_BATTERY_INFO -> {
startActivity(Intent(this, BatteryInfoAnimationActivity::class.java))
}
else -> { else -> {
val isHotLaunch = intent?.extras?.getBoolean("isHotLaunch", false) ?: false val isHotLaunch = intent?.extras?.getBoolean("isHotLaunch", false) ?: false
......
package com.base.filerecoveryrecyclebin.activity.battery package com.base.filerecoveryrecyclebin.activity.battery
import android.annotation.SuppressLint
import android.content.IntentFilter
import android.graphics.Color import android.graphics.Color
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.databinding.ActivityBatteryBinding import com.base.filerecoveryrecyclebin.databinding.ActivityBatteryBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity import com.base.filerecoveryrecyclebin.help.BaseActivity
import com.base.filerecoveryrecyclebin.receiver.BatteryReceiver
import com.base.filerecoveryrecyclebin.utils.BarUtils import com.base.filerecoveryrecyclebin.utils.BarUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import java.io.BufferedReader
import java.io.FileReader
import java.io.IOException
class BatteryActivity : BaseActivity<ActivityBatteryBinding>() { class BatteryActivity : BaseActivity<ActivityBatteryBinding>() {
override val binding: ActivityBatteryBinding by lazy { override val binding: ActivityBatteryBinding by lazy {
ActivityBatteryBinding.inflate(layoutInflater) ActivityBatteryBinding.inflate(layoutInflater)
} }
private lateinit var batteryReceiver: BatteryReceiver
@SuppressLint("SetTextI18n")
override fun initView() { override fun initView() {
BarUtils.setStatusBarLightMode(this, true) BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.parseColor("#FAFAFA")) BarUtils.setStatusBarColor(this, Color.parseColor("#FAFAFA"))
binding.root.updatePadding(top = BarUtils.getStatusBarHeight()) binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
batteryReceiver = BatteryReceiver {
updateUi()
}
registerReceiver(batteryReceiver, IntentFilter().apply {
addAction("android.intent.action.BATTERY_CHANGED")
})
getAverageCurrent()
lifecycleScope.launch(Dispatchers.Main) {
currentFlow.collectLatest {
binding.tvElectric.text = "${currentFlow}mA"
}
}
lifecycleScope.launch(Dispatchers.Main) {
averageFlow.collectLatest {
binding.tvCurrentAverage.text = "${averageFlow}mA"
}
}
AdmobMaxHelper.admobMaxShowNativeAd(this, binding.flAd, 2)
}
@SuppressLint("SetTextI18n")
private fun updateUi() {
val temperature = BatteryReceiver.temperature / 10f
binding.tvTemperature.text = "%.1f °C".format(temperature)
binding.tvVoltage.text = "${BatteryReceiver.voltage}mV"
binding.tvTechnology.text = BatteryReceiver.technology
binding.tvCapacity.text = "${BatteryReceiver.mAh.toInt()}mAh"
}
override fun onDestroy() {
super.onDestroy()
unregisterReceiver(batteryReceiver)
}
@SuppressLint("PrivateApi")
fun getBatteryFilePath(): String {
val systemProperties = Class.forName("android.os.SystemProperties")
val getMethod = systemProperties.getDeclaredMethod("get", String::class.java)
val platName = getMethod.invoke(null, "ro.hardware") as String
val filePath: String = if (platName.startsWith("mt") || platName.startsWith("MT")) {
"/sys/class/power_supply/battery/device/FG_Battery_CurrentConsumption"
// MTK平台该值不区分充放电,都为负数
} else if (platName.startsWith("qcom")) {
"/sys/class/power_supply/battery/current_now"
} else {
""
}
return filePath
}
var mAverageFlow = MutableSharedFlow<Float>()
val averageFlow: SharedFlow<Float> = mAverageFlow
var mCurrentFlow = MutableSharedFlow<Int>()
var currentFlow: SharedFlow<Int> = mCurrentFlow
private fun getAverageCurrent(filePath: String = getBatteryFilePath()) {
var sum = 0
var loopCount = 0
lifecycleScope.launch(Dispatchers.IO) {
while (isActive) {
delay(1500)
val currentValue = readFileValue(filePath)
mCurrentFlow.emit(currentValue)
sum += currentValue
loopCount++
val average = sum / loopCount.toFloat()
mAverageFlow.emit(average)
}
}
}
private fun readFileValue(filePath: String): Int {
var value = 0
runCatching {
val br = BufferedReader(FileReader(filePath))
val line = br.readLine()
br.close()
value = line?.toInt() ?: 0
}
return value
} }
} }
\ No newline at end of file
package com.base.filerecoveryrecyclebin.activity.battery
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.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.databinding.ActivityBatteryInfoAnimationBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlin.random.Random
class BatteryInfoAnimationActivity : BaseActivity<ActivityBatteryInfoAnimationBinding>() {
override val binding: ActivityBatteryInfoAnimationBinding by lazy {
ActivityBatteryInfoAnimationBinding.inflate(layoutInflater)
}
private var job: Job? = null
override fun initView() {
resumeLottie()
}
override fun initListener() {
onBackPressedDispatcher.addCallback {
Toast.makeText(this@BatteryInfoAnimationActivity, "wait a moment", Toast.LENGTH_SHORT).show()
}
}
override fun onPause() {
super.onPause()
binding.lottie.pauseAnimation()
job?.cancel()
job = null
}
override fun onResume() {
super.onResume()
resumeLottie()
if (job?.isActive == false || job == null) {
job = waitJob()
}
}
private fun resumeLottie() {
binding.lottie.imageAssetsFolder = "battery_scan/images/"
binding.lottie.setAnimation("battery_scan/data.json")
binding.lottie.playAnimation()
}
@SuppressLint("SetTextI18n")
private fun waitJob() = lifecycleScope.launch(Dispatchers.Main) {
delay(Random.nextLong(3000, 4500))
binding.lottie.visibility = View.GONE
binding.lottieCompleted.visibility = View.VISIBLE
binding.lottieCompleted.playAnimation()
binding.tv.text = "Completed!"
delay(1000)
AdmobMaxHelper.admobMaxShowOpenAd(this@BatteryInfoAnimationActivity, showBeforeAction = {}) {
binding.lottie.clearAnimation()
startActivity(Intent(this@BatteryInfoAnimationActivity, BatteryActivity::class.java))
finish()
}
}
}
\ No newline at end of file
...@@ -8,7 +8,9 @@ import androidx.recyclerview.widget.RecyclerView ...@@ -8,7 +8,9 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.base.filerecoveryrecyclebin.R import com.base.filerecoveryrecyclebin.R
import com.base.filerecoveryrecyclebin.bean.ConstObject.APP_PROCESS import com.base.filerecoveryrecyclebin.bean.ConstObject.APP_PROCESS
import com.base.filerecoveryrecyclebin.bean.ConstObject.BATTERY_INFO
import com.base.filerecoveryrecyclebin.bean.ConstObject.JUNK_CLEANER import com.base.filerecoveryrecyclebin.bean.ConstObject.JUNK_CLEANER
import com.base.filerecoveryrecyclebin.bean.ConstObject.LARGE_FILE
import com.base.filerecoveryrecyclebin.bean.ConstObject.PRIVACY_SPACE import com.base.filerecoveryrecyclebin.bean.ConstObject.PRIVACY_SPACE
import com.base.filerecoveryrecyclebin.bean.ConstObject.RECOVERY_DOCUMENTS import com.base.filerecoveryrecyclebin.bean.ConstObject.RECOVERY_DOCUMENTS
import com.base.filerecoveryrecyclebin.bean.ConstObject.RECOVERY_PHOTOS import com.base.filerecoveryrecyclebin.bean.ConstObject.RECOVERY_PHOTOS
...@@ -34,6 +36,8 @@ class AppFunctionAdapter(val click: (name: String) -> Unit) : ...@@ -34,6 +36,8 @@ class AppFunctionAdapter(val click: (name: String) -> Unit) :
Fun(SCREENSHOT_CLEANER, R.mipmap.screenshots), Fun(SCREENSHOT_CLEANER, R.mipmap.screenshots),
Fun(WHATSAPP_CLEANER, R.mipmap.h_whatsapp), Fun(WHATSAPP_CLEANER, R.mipmap.h_whatsapp),
Fun(APP_PROCESS, R.mipmap.h_process), Fun(APP_PROCESS, R.mipmap.h_process),
Fun(LARGE_FILE, R.mipmap.c_large),
Fun(BATTERY_INFO, R.mipmap.c_battery),
) )
class JJJ(view: View) : ViewHolder(view) class JJJ(view: View) : ViewHolder(view)
......
...@@ -10,8 +10,9 @@ object ConstObject { ...@@ -10,8 +10,9 @@ object ConstObject {
const val ID_RECOVERY_PHOTOS = 13000 const val ID_RECOVERY_PHOTOS = 13000
const val ID_RECOVERY_VIDEOS = 13001 const val ID_RECOVERY_VIDEOS = 13001
const val ID_RECOVERY_DOCUMENTS = 13002 const val ID_RECOVERY_DOCUMENTS = 13002
const val ID_WHATSAPP = 12001//截图清理 const val ID_WHATSAPP = 12001
const val ID_APP_PROCESS = 12056//截图清理 const val ID_APP_PROCESS = 12056
const val ID_BATTERY_INFO = 12086
const val RECOVERY_PHOTOS = "Recovery Photos" const val RECOVERY_PHOTOS = "Recovery Photos"
const val RECOVERY_VIDEOS = "Recovery Videos" const val RECOVERY_VIDEOS = "Recovery Videos"
...@@ -24,6 +25,7 @@ object ConstObject { ...@@ -24,6 +25,7 @@ object ConstObject {
const val WHATSAPP_CLEANER = "WhatsApp Cleaner" const val WHATSAPP_CLEANER = "WhatsApp Cleaner"
const val APP_PROCESS = "App Process" const val APP_PROCESS = "App Process"
const val LARGE_FILE = "Large File" const val LARGE_FILE = "Large File"
const val BATTERY_INFO = "Battery Info"
const val SCAN_PHOTOS = 1 const val SCAN_PHOTOS = 1
const val SCAN_DOCUMENTS = 2 const val SCAN_DOCUMENTS = 2
......
...@@ -18,6 +18,7 @@ import com.base.filerecoveryrecyclebin.MyApplication ...@@ -18,6 +18,7 @@ import com.base.filerecoveryrecyclebin.MyApplication
import com.base.filerecoveryrecyclebin.R import com.base.filerecoveryrecyclebin.R
import com.base.filerecoveryrecyclebin.activity.SplashActivity import com.base.filerecoveryrecyclebin.activity.SplashActivity
import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_APP_PROCESS import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_APP_PROCESS
import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_BATTERY_INFO
import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_JUNK_CLEAN_PUSH import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_JUNK_CLEAN_PUSH
import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_RECOVERY_DOCUMENTS import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_RECOVERY_DOCUMENTS
import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_RECOVERY_PHOTOS import com.base.filerecoveryrecyclebin.bean.ConstObject.ID_RECOVERY_PHOTOS
...@@ -283,5 +284,6 @@ object NotificationUtil { ...@@ -283,5 +284,6 @@ object NotificationUtil {
ID_RECOVERY_DOCUMENTS, ID_RECOVERY_DOCUMENTS,
ID_WHATSAPP, ID_WHATSAPP,
ID_APP_PROCESS, ID_APP_PROCESS,
ID_BATTERY_INFO,
) )
} }
\ No newline at end of file
...@@ -14,6 +14,8 @@ import androidx.lifecycle.lifecycleScope ...@@ -14,6 +14,8 @@ import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.activity.MainActivity import com.base.filerecoveryrecyclebin.activity.MainActivity
import com.base.filerecoveryrecyclebin.activity.SettingActivity import com.base.filerecoveryrecyclebin.activity.SettingActivity
import com.base.filerecoveryrecyclebin.activity.appprocess.AppProcessAnimationActivity import com.base.filerecoveryrecyclebin.activity.appprocess.AppProcessAnimationActivity
import com.base.filerecoveryrecyclebin.activity.battery.BatteryActivity
import com.base.filerecoveryrecyclebin.activity.battery.BatteryInfoAnimationActivity
import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity
import com.base.filerecoveryrecyclebin.activity.largefile.LargeFileAnimationActivity import com.base.filerecoveryrecyclebin.activity.largefile.LargeFileAnimationActivity
import com.base.filerecoveryrecyclebin.activity.repeat.RepeatAnimationActivity import com.base.filerecoveryrecyclebin.activity.repeat.RepeatAnimationActivity
...@@ -43,15 +45,15 @@ class HomeFragment : BaseFragment<FragmentHome3Binding>() { ...@@ -43,15 +45,15 @@ class HomeFragment : BaseFragment<FragmentHome3Binding>() {
(requireActivity() as MainActivity).photoSizeFlow.collectLatest { pair -> (requireActivity() as MainActivity).photoSizeFlow.collectLatest { pair ->
if (pair.first != 0L) { if (pair.first != 0L) {
binding.tvScreenshotSize.visibility = View.VISIBLE binding.tvScreenshotSize.visibility = View.VISIBLE
binding.tvScreenshotSize.text=pair.first.toFormatSize() binding.tvScreenshotSize.text = pair.first.toFormatSize()
} else { } else {
binding.tvScreenshotSize.visibility = View.GONE binding.tvScreenshotSize.visibility = View.GONE
} }
if (pair.second!=0L){ if (pair.second != 0L) {
binding.tvDuplicateSize.visibility = View.VISIBLE binding.tvDuplicateSize.visibility = View.VISIBLE
binding.tvDuplicateSize.text=pair.second.toFormatSize() binding.tvDuplicateSize.text = pair.second.toFormatSize()
}else{ } else {
binding.tvDuplicateSize.visibility = View.VISIBLE binding.tvDuplicateSize.visibility = View.VISIBLE
} }
} }
...@@ -82,6 +84,9 @@ class HomeFragment : BaseFragment<FragmentHome3Binding>() { ...@@ -82,6 +84,9 @@ class HomeFragment : BaseFragment<FragmentHome3Binding>() {
binding.cardDuplicate.setOnClickListener { binding.cardDuplicate.setOnClickListener {
startActivity(Intent(requireContext(), RepeatAnimationActivity::class.java)) startActivity(Intent(requireContext(), RepeatAnimationActivity::class.java))
} }
binding.cardBattery.setOnClickListener {
startActivity(Intent(requireContext(), BatteryInfoAnimationActivity::class.java))
}
binding.flSetting.setOnClickListener { binding.flSetting.setOnClickListener {
startActivity(Intent(requireContext(), SettingActivity::class.java)) startActivity(Intent(requireContext(), SettingActivity::class.java))
......
package com.base.filerecoveryrecyclebin.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.BatteryManager
class BatteryReceiver(private val change: () -> Unit) : BroadcastReceiver() {
companion object {
var level = 0
var scale = 0
var voltage = 0
var temperature = 0
var mAh = 0f
var health = 0
var status = 0
var technology = "" //获取电池技术支持
}
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == Intent.ACTION_BATTERY_CHANGED) {
level = intent.getIntExtra("level", 0)
scale = intent.getIntExtra("scale", 0)
voltage = intent.getIntExtra("voltage", 0)
temperature = intent.getIntExtra("temperature", 0)
technology = intent.getStringExtra("technology").toString()
status = intent.getIntExtra("status", BatteryManager.BATTERY_STATUS_UNKNOWN)
health = intent.getIntExtra("health", BatteryManager.BATTERY_HEALTH_UNKNOWN)
val batteryManager = context.getSystemService(Context.BATTERY_SERVICE) as? BatteryManager ?: return
val chargeCounter = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER)
val propertyCapacity = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY)
if (chargeCounter != Int.MIN_VALUE && propertyCapacity != Int.MIN_VALUE) {
mAh = (chargeCounter / (propertyCapacity.toFloat() / 100f)) / 1000f
}
change.invoke()
}
}
}
\ No newline at end of file
<?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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0ec897">
<com.base.filerecoveryrecyclebin.view.XmlLottieAnimationView
android:id="@+id/lottie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:lottie_autoPlay="true"
app:lottie_loop="true" />
<com.base.filerecoveryrecyclebin.view.XmlLottieAnimationView
android:id="@+id/lottie_completed"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/tv"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:lottie_autoPlay="false"
app:lottie_rawRes="@raw/loading_completed_w" />
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="250dp"
android:text="Wait a moment..."
android:textColor="@color/white"
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
...@@ -491,6 +491,63 @@ ...@@ -491,6 +491,63 @@
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/card_battery"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="5dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="10dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:src="@mipmap/c_battery"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:orientation="horizontal"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Battery Info"
android:textColor="@color/black"
android:textSize="15sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="15dp"
android:src="@mipmap/jianotu_h"
tools:ignore="ContentDescription" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
......
{"nm":"Success Animation","ddd":0,"h":400,"w":400,"meta":{"g":"@lottiefiles/toolkit-js 0.33.2"},"layers":[{"ty":4,"nm":"Success_Tick","sr":1,"st":4.00000016292334,"op":154.000006272549,"ip":4.00000016292334,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[29,-36,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":0,"k":[205.75,194.75,0],"ix":2},"r":{"a":0,"k":0,"ix":10},"sa":{"a":0,"k":0},"o":{"a":0,"k":100,"ix":11}},"ef":[],"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Shape 1","ix":1,"cix":2,"np":3,"it":[{"ty":"sh","bm":0,"hd":false,"mn":"ADBE Vector Shape - Group","nm":"Path 1","ix":1,"d":1,"ks":{"a":0,"k":{"c":false,"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[-48,-34],[2,16],[94.5,-77.5]]},"ix":2}},{"ty":"st","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Stroke","nm":"Stroke 1","lc":2,"lj":2,"ml":1,"o":{"a":0,"k":100,"ix":4},"w":{"a":1,"k":[{"o":{"x":0.333,"y":0},"i":{"x":0.146,"y":1},"s":[15],"t":4},{"s":[30],"t":25.0000010182709}],"ix":5},"c":{"a":0,"k":[1,1,1],"ix":3}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[0,0],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]},{"ty":"tm","bm":0,"hd":false,"mn":"ADBE Vector Filter - Trim","nm":"Trim Paths 1","ix":2,"e":{"a":1,"k":[{"o":{"x":0.333,"y":0},"i":{"x":0.113,"y":1},"s":[0],"t":4},{"s":[100],"t":25.0000010182709}],"ix":2},"o":{"a":0,"k":0,"ix":3},"s":{"a":0,"k":0,"ix":1},"m":1}],"ind":1},{"ty":4,"nm":"Circle","sr":1,"st":0,"op":150.000006109625,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[30.765,23.931,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6},"sk":{"a":0,"k":0},"p":{"a":0,"k":[200,200,0],"ix":2},"r":{"a":0,"k":0,"ix":10},"sa":{"a":0,"k":0},"o":{"a":0,"k":100,"ix":11}},"ef":[{"ty":22,"mn":"ADBE Stroke","nm":"Stroke","ix":1,"en":1,"ef":[{"ty":10,"mn":"ADBE Stroke-0001","nm":"Path","ix":1,"v":{"a":0,"k":0,"ix":1}},{"ty":7,"mn":"ADBE Stroke-0010","nm":"All Masks","ix":2,"v":{"a":0,"k":0,"ix":2}},{"ty":7,"mn":"ADBE Stroke-0011","nm":"Stroke Sequentially","ix":3,"v":{"a":0,"k":1,"ix":3}},{"ty":2,"mn":"ADBE Stroke-0002","nm":"Color","ix":4,"v":{"a":0,"k":[1,1,1],"ix":4}},{"ty":0,"mn":"ADBE Stroke-0003","nm":"Brush Size","ix":5,"v":{"a":0,"k":2,"ix":5}},{"ty":0,"mn":"ADBE Stroke-0004","nm":"Brush Hardness","ix":6,"v":{"a":0,"k":0.75,"ix":6}},{"ty":0,"mn":"ADBE Stroke-0005","nm":"Opacity","ix":7,"v":{"a":0,"k":1,"ix":7}},{"ty":0,"mn":"ADBE Stroke-0008","nm":"Start","ix":8,"v":{"a":0,"k":0,"ix":8}},{"ty":0,"mn":"ADBE Stroke-0009","nm":"End","ix":9,"v":{"a":0,"k":100,"ix":9}},{"ty":7,"mn":"ADBE Stroke-0006","nm":"Spacing","ix":10,"v":{"a":0,"k":15,"ix":10}},{"ty":7,"mn":"ADBE Stroke-0007","nm":"Paint Style","ix":11,"v":{"a":0,"k":1,"ix":11}}]}],"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Ellipse 1","ix":1,"cix":2,"np":3,"it":[{"ty":"el","bm":0,"hd":false,"mn":"ADBE Vector Shape - Ellipse","nm":"Ellipse Path 1","d":1,"p":{"a":0,"k":[0,0],"ix":3},"s":{"a":0,"k":[318.933,318.933],"ix":2}},{"ty":"st","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Stroke","nm":"Stroke 1","lc":2,"lj":1,"ml":4,"o":{"a":0,"k":100,"ix":4},"w":{"a":1,"k":[{"o":{"x":0.333,"y":0},"i":{"x":0.188,"y":1},"s":[50],"t":0},{"s":[20],"t":20.0000008146167}],"ix":5},"c":{"a":0,"k":[1,1,1],"ix":3}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[30.765,23.931],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]},{"ty":"tm","bm":0,"hd":false,"mn":"ADBE Vector Filter - Trim","nm":"Trim Paths 1","ix":2,"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":3},"s":{"a":1,"k":[{"o":{"x":0.333,"y":0},"i":{"x":0.096,"y":1},"s":[100],"t":0},{"s":[0],"t":20.0000008146167}],"ix":1},"m":1}],"ind":2}],"v":"5.7.4","fr":29.9700012207031,"op":30.0000012219251,"ip":0,"assets":[]}
\ 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