Commit 43f8a66d authored by leichao.gao's avatar leichao.gao

Merge remote-tracking branch 'origin/master'

parents b775c859 1c224f88
......@@ -34,7 +34,8 @@
<activity
android:name=".activity.SplashActivity"
android:exported="true"
android:launchMode="singleTask">
android:launchMode="singleTask"
android:theme="@style/splash.theme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -87,6 +87,7 @@ class ScreenShotActivity : BaseActivity<ActivityScreenShotBinding>() {
}
}
@SuppressLint("SetTextI18n")
override fun initListener() {
binding.flBack.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
......@@ -120,7 +121,11 @@ class ScreenShotActivity : BaseActivity<ActivityScreenShotBinding>() {
}
}.await()
launch(Dispatchers.Main) {
binding.tvClean.text = "CLEAN"
screenShotAdapter.removeData(files)
val split = screenShotAdapter.getAllData().sumOf { it.file.length() }.toFormatSize().split(" ")
binding.tvSize.text = split[0]
binding.tvUnit.text = split[1]
}
}
}
......
......@@ -25,6 +25,7 @@ import com.base.datarecovery.view.DialogViews.showGerPermission
import com.base.datarecovery.view.FileScanDialog
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.launch
......
......@@ -8,8 +8,13 @@ import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.base.datarecovery.R
import com.base.datarecovery.bean.ConstObject.JUNK_CLEANER
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.databinding.ItemResultFun2Binding
import com.base.datarecovery.databinding.ItemResultFunBinding
import com.base.datarecovery.utils.AppPreferences
import com.base.datarecovery.view.XmlEx.inflate
......@@ -19,16 +24,20 @@ class AppFunctionAdapter(val click: (name: String) -> Unit) :
RecyclerView.Adapter<AppFunctionAdapter.JJJ>() {
val list = arrayListOf(
Fun(JUNK_CLEANER, R.mipmap.clean, "Clean junk regularly to free up space", "Clean Up"),
Fun(REPEAT_PHOTOS, R.mipmap.repeatedphotos, "Check similar photos to release more space", "Clean Up"),
Fun(SCREENSHOT_CLEANER, R.mipmap.screenshots, "Too many screenshots? Free up your phone storage!", "Clean Up"),
Fun(JUNK_CLEANER, R.mipmap.clean),
Fun(RECOVERY_PHOTOS, R.mipmap.photos_ss),
Fun(RECOVERY_VIDEOS, R.mipmap.videos_ss),
Fun(RECOVERY_DOCUMENTS, R.mipmap.documents_ss),
Fun(PRIVACY_SPACE, R.mipmap.space),
Fun(REPEAT_PHOTOS, R.mipmap.repeatedphotos),
Fun(SCREENSHOT_CLEANER, R.mipmap.screenshots),
)
class JJJ(view: View) : ViewHolder(view)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): JJJ {
return JJJ(R.layout.item_result_fun.inflate(parent))
return JJJ(R.layout.item_result_fun_2.inflate(parent))
}
override fun getItemCount(): Int {
......@@ -38,12 +47,12 @@ class AppFunctionAdapter(val click: (name: String) -> Unit) :
override fun onBindViewHolder(holder: JJJ, position: Int) {
val data = list[position]
val context = holder.itemView.context
val binding = ItemResultFunBinding.bind(holder.itemView)
val binding = ItemResultFun2Binding.bind(holder.itemView)
binding.ivIcon.setImageDrawable(ContextCompat.getDrawable(context, data.icon))
binding.tvTittle.text = data.name
binding.tvDes.text = data.des
binding.tvButton.text = data.button
binding.tvButton.setOnClickListener {
// binding.tvDes.text = data.des
// binding.tvButton.text = data.button
binding.root.setOnClickListener {
click.invoke(data.name)
}
}
......
......@@ -18,7 +18,7 @@ class ScreenShotAdapter(
val select: (size: Int) -> Unit
) : RecyclerView.Adapter<ScreenShotAdapter.SSS>() {
private var beans = arrayListOf<ScreenshotBean>()
var beans = arrayListOf<ScreenshotBean>()
inner class SSS(view: View) : ViewHolder(view)
......@@ -106,6 +106,11 @@ class ScreenShotAdapter(
bean.screenPhotoBean.filter { it.isSelect }
}
}
fun getAllData(): List<ScreenPhotoBean> {
return beans.flatMap { bean ->
bean.screenPhotoBean
}
}
@SuppressLint("NotifyDataSetChanged")
fun removeData(files: List<ScreenPhotoBean>) {
......
......@@ -12,10 +12,14 @@ object ConstObject {
const val ID_RECOVERY_DOCUMENTS = 0
const val ID_PRIVACY_SPACE = 0
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 SCAN_PHOTOS = 1
const val SCAN_DOCUMENTS = 2
......
......@@ -5,6 +5,7 @@ import android.util.Log
import com.base.datarecovery.utils.LogEx
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.launch
import java.io.File
......@@ -25,7 +26,7 @@ object FileHelp {
onDo: ((file: File) -> Unit)? = null,
onFinish: (() -> Unit)? = null
) = launch(Dispatchers.IO) {
delay(1000)
var size = 0
//添加第一层文件到链表
......
......@@ -3,13 +3,14 @@
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:layout_height="match_parent"
android:background="#EFEFEF">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_top"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#0164C8"
android:background="@mipmap/bg_result"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
......@@ -67,25 +68,26 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@id/rv_fun"
app:layout_constraintTop_toBottomOf="@id/cl_top" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_fun"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:paddingTop="20dp"
android:paddingBottom="15dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toTopOf="@id/fl_ad"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cl_top"
app:layout_constraintVertical_bias="0.0" />
app:spanCount="2"
tools:listitem="@layout/item_result_fun_2" />
<FrameLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView 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="166dp"
android:layout_height="100dp"
android:layout_margin="10dp">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_icon"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_gravity="center_horizontal"
android:layout_marginStart="12dp"
android:layout_marginEnd="9dp"
android:src="@mipmap/h_cleanjunk" />
<TextView
android:id="@+id/tv_tittle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="13dp"
android:includeFontPadding="false"
android:text="Battery information"
android:textColor="#ff000000"
android:textSize="15sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.cardview.widget.CardView>
\ No newline at end of file
......@@ -21,4 +21,9 @@
<item name="android:backgroundDimEnabled">false</item>
</style>
<style name="splash.theme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowBackground">@drawable/splash_bp</item>
<item name="android:windowFullscreen">false</item>
</style>
</resources>
\ 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