Commit 7763512a authored by wanglei's avatar wanglei

...

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