Commit 39d17a28 authored by wanglei's avatar wanglei

======上报,通知逻辑修改======

parent b75d55e3
......@@ -5,7 +5,6 @@ import android.annotation.SuppressLint
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Color
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
......@@ -102,47 +101,34 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
FileHelps.getFileList({
}, {
// if (mData.isEmpty()) {
//
//
// }
FileHelps.fileList.toList().let { it ->
if (it.isNotEmpty()) {
// child3.clear()
// child4.clear()
// child5.clear()
// sizes[0] = 0
// sizes[1] = 0
// sizes[2] = 0
val a = it.filter { it.isApk() }
val halfSize = if (a.size % 2 == 1) a.size / 2 + 1 else a.size / 2
val firstHalf = a.subList(0, halfSize)
firstHalf.forEach { l ->
sizes[0] += l.size
// junkList.add(p0.path)
val bean = ChildBean(R.mipmap.hapk, l.name, l.path, l.size)
child3.add(bean)
}
ScanCount += 1
updateSize(doneIndex = 0)
// mData.addAll(it)
val b = it.filter { it.isJunk() }
val bhalfSize = if (b.size % 2 == 1) b.size / 2 + 1 else b.size / 2
val bfirstHalf = b.subList(0, bhalfSize)
bfirstHalf.forEach { l ->
val bHalfSize = if (b.size % 2 == 1) b.size / 2 + 1 else b.size / 2
val bFirstHalf = b.subList(0, bHalfSize)
bFirstHalf.forEach { l ->
sizes[1] += l.size
// junkList.add(p0.path)
val bean = ChildBean(null, l.name, l.path, l.size)
child4.add(bean)
}
ScanCount += 1
updateSize(doneIndex = 1)
val c = it.filter { it.isOtherTrash() }
val chalfSize = if (c.size % 2 == 1) c.size / 2 + 1 else c.size / 2
val cfirstHalf = c.subList(0, chalfSize)
cfirstHalf.forEach { l ->
val cHalfSize = if (c.size % 2 == 1) c.size / 2 + 1 else c.size / 2
val cFirstHalf = c.subList(0, cHalfSize)
cFirstHalf.forEach { l ->
sizes[2] += l.size
// junkList.add(p0.path)
val bean = ChildBean(null, l.name, l.path, l.size)
child5.add(bean)
}
......@@ -153,6 +139,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
})
}
@SuppressLint("SetTextI18n")
private fun updateSize(doneIndex: Int = -1) {
addData(index = doneIndex)
......@@ -164,7 +151,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
selectSize = 0L
for (i in parentList.indices) {
if (parentList[i].childItem.isNotEmpty()) {
val childsize = parentList[i].childItem.filter {
val childSize = parentList[i].childItem.filter {
it.isChildSelected
}.sumOf {
it.childSize
......@@ -178,7 +165,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
}
}
selectSize += childsize
selectSize += childSize
} else {
if (parentList[i].isParentSelected) {
selectSize += parentList[i].parentSize
......@@ -211,19 +198,19 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
@SuppressLint("NotifyDataSetChanged")
private fun addData(index: Int) {
if (parentList.isNotEmpty()) {
// Log.e("MXL", "addData: " + index)
parentList[index].isfinish = true
parentList[index].parentSize = sizes[index]
mAdapter.notifyDataSetChanged()
}
}
@SuppressLint("SetTextI18n")
private fun updateView() {
selectList.clear()
var allSize = 0L
for (i in parentList.indices) {
if (parentList[i].childItem.isNotEmpty()) {
val childsize = parentList[i].childItem.filter {
val childSize = parentList[i].childItem.filter {
it.isChildSelected
}.sumOf {
it.childSize
......@@ -237,7 +224,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
}
}
allSize += childsize
allSize += childSize
} else {
if (parentList[i].isParentSelected) {
allSize += parentList[i].parentSize
......@@ -253,12 +240,6 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
it.isChildSelected
}.map { it.chilepath })
}
// for (item in parentList) {
// if (item.isParentSelected) {
// Log.e("MXL", "updateView: " + item)
// }
// }
}
private val mAdapter by lazy {
......@@ -298,6 +279,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
@SuppressLint("NotifyDataSetChanged")
override fun onBindGroupViewHolder(
holder: ViewHolder,
groupPosition: Int,
......@@ -353,6 +335,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
}
@SuppressLint("NotifyDataSetChanged")
override fun onBindChildViewHolder(
holder: ViewHolder,
groupPosition: Int,
......@@ -363,10 +346,6 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
val childType = parentList[groupPosition].childItem[childPosition]
when (groupPosition) {
0 -> {
// val c = ConfigHelper.appList?.firstOrNull {
// it.name == childType.childname
// }
// viewHolder.binding.idImgIcon.setImageDrawable(c?.icon)
val packageManager: PackageManager = this@CleanJunkActivity.packageManager
val apkFilePath = childType.chilepath // 替换成您的APK文件路径
val packageInfo =
......@@ -400,7 +379,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
viewHolder.binding.idTvAppName.text = childType.childname
viewHolder.binding.idImgSelect.isSelected = childType.isChildSelected
viewHolder.binding.idTvSize.text = "${childType.childSize.toFormatSize()}"
viewHolder.binding.idTvSize.text = childType.childSize.toFormatSize()
viewHolder.itemView.setOnClickListener {
when (childPosition) {
childPosition -> {
......
......@@ -7,7 +7,6 @@ import android.content.IntentFilter
import android.os.Build
import android.util.Log
import com.blankj.utilcode.util.SPUtils
import com.test.basd.supercleanermax.bean.ConfigBean.Companion.ID_CHARGE
import com.test.basd.supercleanermax.bean.ConfigBean.Companion.ID_LOW_BATTERY_PUSH
import com.test.basd.supercleanermax.display.NotificationHelper.postActionNotification
import com.test.basd.supercleanermax.helps.BaseApplication
......@@ -56,12 +55,10 @@ class ActionBroadcast : BroadcastReceiver() {
Log.d("glc", "解锁")
if (mIsScreenOn && !isLock) {
// 展示主动推送
NotificationTimerTask(null).oneShotNotification()
}
}
Intent.ACTION_POWER_CONNECTED -> {
BaseApplication.context.postActionNotification(ID_CHARGE)
}
Intent.ACTION_POWER_DISCONNECTED -> {
......@@ -69,25 +66,12 @@ class ActionBroadcast : BroadcastReceiver() {
}
Intent.ACTION_BATTERY_CHANGED -> {//电量改变
lowBattery(intent)
}
}
}
private fun lowBattery(intent: Intent?) {
val level = intent?.getIntExtra("level", 0) ?: 0
if (level < 50) {
val lastPushTime = SPUtils.getInstance().getLong(ID_LOW_BATTERY_PUSH.toString(), 0)
val flag2 = (System.currentTimeMillis() - lastPushTime) > 20.minutes.toLong(DurationUnit.MILLISECONDS)
val isPushCfg = PushStrategy.isPush(ID_LOW_BATTERY_PUSH)
if (flag2 && isPushCfg) {
BaseApplication.context.postActionNotification(ID_LOW_BATTERY_PUSH, extra = level)
}
}
}
}
\ No newline at end of file
......@@ -171,30 +171,6 @@ object NotificationHelper {
//==================================下面是被动推送的情况===============================================
ID_INSTALL_PACKAGE_PUSH -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.install)
remoteViews.setTextViewText(R.id.tv_desc, "Installation successful. Delete useless APKs")
remoteViews.setTextViewText(R.id.tv_btn, "Scan")
}
ID_UNINSTALL_PACKAGE_PUSH -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.uninstall)
remoteViews.setTextViewText(R.id.tv_desc, "Uninstalled successfully, clean residual files from your device")
remoteViews.setTextViewText(R.id.tv_btn, "Clean up")
}
ID_CHARGE -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.start)
remoteViews.setTextViewText(R.id.tv_desc, "View phone battery consumption recently")
remoteViews.setTextViewText(R.id.tv_btn, "View")
}
ID_LOW_BATTERY_PUSH -> {
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.battery_lower)
remoteViews.setTextViewText(R.id.tv_desc, "The battery is $extra%, view the battery information")
remoteViews.setTextViewText(R.id.tv_btn, "View")
}
else -> {
return
}
......
package com.test.basd.supercleanermax.display
import android.util.Log
//import com.test.basd.cleanmaster.bean.ConfigBean.Companion.ID_PHONE_ACCELERATE
import com.test.basd.supercleanermax.display.NotificationHelper.postActionNotification
import com.test.basd.supercleanermax.helps.BaseApplication
import com.test.basd.supercleanermax.helps.EventHelper
......
......@@ -43,6 +43,10 @@ object EventHelper {
// Log.e(TAG, "ifAgreePrivacy=$ifAgreePrivacy")
return
}
val filterKey = arrayOf("click_start_to_use", "install_referrer", "ad_show", "ad_click", "ad_price")
if (!filterKey.contains(key)) {
return
}
if (isSingleEvent) {
val stringSet = SPUtils.getInstance().getStringSet("singleEvent")
......
......@@ -72,7 +72,8 @@
android:layout_marginBottom="43dp"
android:text="Cleanable"
android:textColor="#80FFFFFF"
android:textSize="14sp" />
android:textSize="14sp"
tools:ignore="HardcodedText" />
<FrameLayout
......@@ -101,17 +102,18 @@
android:layout_height="48dp"
android:layout_marginHorizontal="40dp"
android:layout_marginVertical="20dp"
android:visibility="gone"
android:gravity="center"
android:text="Clean"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="gone"
app:bl_corners_radius="10dp"
app:bl_enabled_solid_color="#5b4fff"
app:bl_enabled_textColor="@color/white"
app:bl_unEnabled_solid_color="#C0C6D4"
app:bl_unEnabled_textColor="@color/white" />
app:bl_unEnabled_textColor="@color/white"
tools:ignore="HardcodedText" />
</androidx.appcompat.widget.LinearLayoutCompat>
</FrameLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="wrap_content"
android:orientation="vertical">
......@@ -30,7 +31,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cache garbage"
android:textSize="14sp" />
android:textSize="14sp"
tools:ignore="HardcodedText" />
<View
android:layout_width="wrap_content"
......@@ -43,7 +45,8 @@
android:layout_height="wrap_content"
android:text="3.3MB"
android:textColor="#999999"
android:textSize="13sp" />
android:textSize="13sp"
tools:ignore="HardcodedText" />
<FrameLayout
android:layout_width="wrap_content"
......
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