Commit 330ee714 authored by wanglei's avatar wanglei

同步代码

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