Commit 7763512a authored by wanglei's avatar wanglei

...

parent 44e8c9dc
......@@ -14,8 +14,8 @@ import android.util.Log
import android.widget.RemoteViews
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import com.swiftcleaner.chovey.BuildConfig
import com.swiftcleaner.chovey.R
import com.swiftcleaner.chovey.model.bean.Global
import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_APP_MANAGER
import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_APP_PROCESS
import com.swiftcleaner.chovey.model.bean.Global.FUNCTION_BATTERY
......@@ -132,7 +132,6 @@ object NotificationUtils {
val bigRemoteViews = RemoteViews(context.packageName, R.layout.notification_common)
val smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small)
var intentAction = ""
when (actionId) {
FUNCTION_CLEAN -> {
bigRemoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.h_cleanjunk)
......@@ -141,7 +140,6 @@ object NotificationUtils {
val desc = "Clean out junk files to free up space on your phone!"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
intentAction = Global.FUNCTION_CLEAN
}
......@@ -152,7 +150,6 @@ object NotificationUtils {
val desc = "Clean out junk files to free up space on your phone!"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
intentAction = Global.FUNCTION_CLEAN
}
FUNCTION_BATTERY -> {
......@@ -162,7 +159,6 @@ object NotificationUtils {
val desc = "Clean out junk files to free up space on your phone!"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
intentAction = Global.FUNCTION_CLEAN
}
FUNCTION_LARGE_FILE -> {
......@@ -172,7 +168,6 @@ object NotificationUtils {
val desc = "Clean out junk files to free up space on your phone!"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
intentAction = Global.FUNCTION_CLEAN
}
FUNCTION_WHATS_APP -> {
......@@ -182,7 +177,6 @@ object NotificationUtils {
val desc = "Clean out junk files to free up space on your phone!"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
intentAction = Global.FUNCTION_CLEAN
}
FUNCTION_APP_PROCESS -> {
......@@ -192,7 +186,6 @@ object NotificationUtils {
val desc = "Clean out junk files to free up space on your phone!"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
intentAction = Global.FUNCTION_CLEAN
}
FUNCTION_SIMILAR_PHOTOS -> {
......@@ -202,7 +195,6 @@ object NotificationUtils {
val desc = "Clean out junk files to free up space on your phone!"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
intentAction = Global.FUNCTION_CLEAN
}
FUNCTION_SCREENSHOT -> {
......@@ -212,7 +204,6 @@ object NotificationUtils {
val desc = "Clean out junk files to free up space on your phone!"
bigRemoteViews.setTextViewText(R.id.tv_desc, desc)
smallRemoteViews.setTextViewText(R.id.tv_desc, desc)
intentAction = Global.FUNCTION_CLEAN
}
else -> {
......@@ -222,7 +213,7 @@ object NotificationUtils {
val flag = PendingIntent.FLAG_IMMUTABLE
val btnRequestCode = Random().nextInt(1000)
val intent = Intent(context, StartActivity::class.java)
intent.putExtra("actionId", intentAction)
intent.putExtra("actionId", actionId)
val btnPendingIntent = PendingIntent.getActivity(context, btnRequestCode, intent, flag)
bigRemoteViews.setOnClickPendingIntent(R.id.fl_btn, btnPendingIntent)
smallRemoteViews.setOnClickPendingIntent(R.id.tv_btn, btnPendingIntent)
......@@ -274,6 +265,9 @@ object NotificationUtils {
if (currentNotificationIdIndex >= NOTIFICATION_IDS.size) {
currentNotificationIdIndex = 0
}
if (BuildConfig.DEBUG) {
return FUNCTION_BATTERY
}
// 返回下一个通知 ID
return NOTIFICATION_IDS[currentNotificationIdIndex]
}
......
......@@ -2,10 +2,8 @@ package com.zxdemo.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
class FcmReceiver : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
Log.d("TAG", "onReceive:$intent ")
}
}
\ 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