Commit 330ee714 authored by wanglei's avatar wanglei

同步代码

parent 1ad5381d
......@@ -9,6 +9,7 @@ import android.content.Intent
import android.content.pm.ApplicationInfo
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.util.Log
......@@ -33,9 +34,11 @@ import com.test.easy.easycleanerjunk.fragment.AppListFragment.Companion.APP_LIST
import com.test.easy.easycleanerjunk.helps.AppSizeUtils
import com.test.easy.easycleanerjunk.helps.BaseActivity
import com.test.easy.easycleanerjunk.helps.LogEx
import com.test.easy.easycleanerjunk.helps.PermissionHelp.checkUsageAccessSettings
import com.test.easy.easycleanerjunk.helps.TimeUtils.THIRTY_DAYS_QUERY
import com.test.easy.easycleanerjunk.helps.TimeUtils.timePair
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.utils.BarUtils
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
......@@ -70,30 +73,24 @@ class AppManagerActivity : BaseActivity<ActivityAppManagerBinding>() {
}
override fun initView() {
BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
context = this
setContentView(binding.root)
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
insets
}
initViewPager()
playLottie()
CoroutineScope(Dispatchers.Main).launch {
initViewPager()
lifecycleScope.launch((Dispatchers.IO)) {
initAppData()
if (checkUsageAccessSettings()) {
async(Dispatchers.IO) {
setAppBeanSize()
setAppLastUseTime()
}.await()
}
launch(Dispatchers.Main) {
pages.forEachIndexed { index, fragment ->
val appListFragment = (fragment as AppListFragment)
appListFragment.refreshFragmentData(dataList, index == currentPosition)
}
}
}
binding.llName.setOnClickListener {
if (currentPosition == 0) {
......@@ -436,28 +433,7 @@ class AppManagerActivity : BaseActivity<ActivityAppManagerBinding>() {
override fun createFragment(position: Int): Fragment = pages[position]
}
@Suppress("DEPRECATION")
fun checkUsageAccessSettings(): Boolean {
val appOpsManager = getSystemService(Context.APP_OPS_SERVICE) as AppOpsManager
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
appOpsManager.unsafeCheckOpNoThrow(
AppOpsManager.OPSTR_GET_USAGE_STATS,
android.os.Process.myUid(),
this.packageName
) == AppOpsManager.MODE_ALLOWED
} else {
appOpsManager.checkOpNoThrow(
AppOpsManager.OPSTR_GET_USAGE_STATS,
android.os.Process.myUid(),
this.packageName
) == AppOpsManager.MODE_ALLOWED
}
}
fun isLaunchApp(context: Context, app: PackageInfo, filterSystem: Boolean = true): Boolean {
private fun isLaunchApp(context: Context, app: PackageInfo, filterSystem: Boolean = true): Boolean {
val flagSystem = (app.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM) == 0
val flagSelf = app.applicationInfo.packageName != context.packageName
return if (filterSystem) flagSystem && flagSelf else flagSelf
......
......@@ -47,8 +47,13 @@ class PrivacyAgreementManager {
context.startActivity(intent)
}
var clicked = false
binding.idTvStart.setOnClickListener {
// binding.idTvStart.isVisible = false
if (clicked) {
return@setOnClickListener
}
clicked = true
// binding.idTvStart.isVisible = false
// binding.idLlJindu.isVisible = true
// binding.idLlYinsi.isVisible = false
ConfigHelper.ifAgreePrivacy = true
......
......@@ -6,11 +6,17 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/v_top"
android:layout_width="match_parent"
android:layout_height="40dp"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:id="@+id/fl_top"
android:layout_width="match_parent"
android:layout_height="50dp"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintTop_toBottomOf="@id/v_top">
<FrameLayout
android:id="@+id/fl_back"
......@@ -310,13 +316,14 @@
android:layout_marginBottom="190dp"
android:gravity="center"
android:lineHeight="20dp"
android:text="Scan app\n..."
android:text="please wait a moment.."
android:textColor="@color/black"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
tools:ignore="HardcodedText,UnusedAttribute" />
</androidx.constraintlayout.widget.ConstraintLayout>
......
......@@ -30,7 +30,6 @@
<string name="installed_by_">"Installed by: "</string>
<string name="detail_info">Detail Information</string>
<string name="share">Share</string>
<string name="Scan_for_viruses">Scan for Viruses</string>
<string name="permission_check">Check Permission</string>
<string name="uninstall">Uninstall</string>
......
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