Commit 39d17a28 authored by wanglei's avatar wanglei

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

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