Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
swiftcleanerphonehelper
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
swiftcleanerphonehelper
Commits
ab3f6ff0
Commit
ab3f6ff0
authored
Dec 20, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
db732926
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
232 deletions
+31
-232
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+5
-0
MainActivity.kt
app/src/main/java/com/zxdemo/MainActivity.kt
+0
-151
ZxApplication.kt
app/src/main/java/com/zxdemo/ZxApplication.kt
+0
-3
UnlockReceiver.kt
app/src/main/java/com/zxdemo/receiver/UnlockReceiver.kt
+2
-6
notification_common.xml
app/src/main/res/layout/notification_common.xml
+23
-64
notification_common_small.xml
app/src/main/res/layout/notification_common_small.xml
+1
-8
No files found.
app/src/main/AndroidManifest.xml
View file @
ab3f6ff0
...
@@ -12,6 +12,11 @@
...
@@ -12,6 +12,11 @@
<uses-permission
android:name=
"android.permission.POST_NOTIFICATIONS"
/>
<uses-permission
android:name=
"android.permission.POST_NOTIFICATIONS"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE_DATA_SYNC"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE_DATA_SYNC"
/>
<!-- fcm 添加以下权限 -->
<uses-permission
android:name=
"android.permission.WAKE_LOCK"
/>
<uses-permission
android:name=
"com.google.android.c2dm.permission.RECEIVE"
/>
<uses-permission
android:name=
"android.permission.RECEIVE_BOOT_COMPLETED"
/>
<queries>
<queries>
<intent>
<intent>
<action
android:name=
"android.intent.action.MAIN"
/>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
app/src/main/java/com/zxdemo/MainActivity.kt
deleted
100644 → 0
View file @
db732926
//package com.tool.zxdemo
//
//import android.Manifest
//import android.content.Intent
//import android.os.Build
//import android.os.Bundle
//import android.widget.Toast
//import androidx.activity.result.contract.ActivityResultContracts
//import androidx.appcompat.app.AppCompatActivity
//import androidx.core.view.isVisible
//import com.applovin.sdk.AppLovinSdk
//import com.reyun.solar.engine.SolarEngineConfig
//import com.reyun.solar.engine.SolarEngineManager
//import com.tool.zxdemo.admob.com.zxdemo.admob.AdmobHelper
//import com.tool.zxdemo.databinding.ActivityMainBinding
//import com.tool.zxdemo.http.com.zxdemo.http.ZxHttp
//import com.tool.zxdemo.service.com.zxdemo.service.PermanentNotifyService
//import com.tool.zxdemo.service.com.zxdemo.service.PermanentNotifyService.Companion.startOmgNotification
//import com.tool.zxdemo.utils.com.zxdemo.utils.GlobalTimer
//import com.tool.zxdemo.utils.com.zxdemo.utils.SpUtils
//import java.util.Random
//
//class MainActivity : AppCompatActivity() {
//
// private val binding by lazy {
// ActivityMainBinding.inflate(layoutInflater)
// }
//
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// setContentView(binding.root)
// SolarEngineManager.getInstance().preInit(this, "f3ea1ff055365453")//(归因)同意隐私之前进行预加载
// var config = SolarEngineConfig.Builder().build()//同意之后再进行初始化
// SolarEngineManager.getInstance()
// .initialize(this, "APP_KEY", config)
// if (Build.VERSION.SDK_INT >= 33) {
// registerForActivityResult(ActivityResultContracts.RequestPermission()) {}.launch(
// Manifest.permission.POST_NOTIFICATIONS
// )
// }
// startOmgNotification()
//
// val random = Random()
// val randomNumber = random.nextInt(5)
// var sTimer = com.zxdemo.utils.SpUtils.getInstance().getBoolean("sTimer", false)
// binding.sTimer.isChecked = sTimer
//// if (sTimer) {
//// com.zxdemo.utils.GlobalTimer.getInstance()
//// .scheduleTask(3 * 1000L, 5 * 1000L)
//// }
//
// var sNotify = com.zxdemo.utils.SpUtils.getInstance().getBoolean("sNotify", false)
// binding.sNotify.isChecked = sNotify
// binding.sAd.isChecked = com.zxdemo.admob.AdmobHelper.useAdmob
// binding.sAd.setOnCheckedChangeListener { buttonView, isChecked ->
// com.zxdemo.admob.AdmobHelper.useAdmob = isChecked
// com.zxdemo.admob.AdmobHelper.init(this, {}, {})
// if (isChecked) {
// binding.buttonAppApplovin.isVisible = false
// } else {
// binding.buttonAppApplovin.apply {
// setOnClickListener {
// AppLovinSdk.getInstance(context).showMediationDebugger()
// }
// }.isVisible = true
// }
// }
// binding.sTimer.setOnCheckedChangeListener { buttonView, isChecked ->
// if (isChecked) {
// com.zxdemo.utils.GlobalTimer
// .scheduleTask(3 * 1000L, 20 * 1000L)
// } else {
// com.zxdemo.utils.GlobalTimer.stopTaskTimer()
// }
// com.zxdemo.utils.SpUtils.getInstance().putBoolean("sTimer", isChecked)
// }
// binding.sNotify.setOnCheckedChangeListener { buttonView, isChecked ->
// if (isChecked) {
// startOmgNotification()
// } else {
// val serviceIntent = Intent(this, com.zxdemo.service.PermanentNotifyService::class.java)
// stopService(serviceIntent)
// }
// com.zxdemo.utils.SpUtils.getInstance().putBoolean("sNotify", isChecked)
// }
//
// binding.buttonAppOpen.setOnClickListener {
// if (com.zxdemo.admob.AdmobHelper.isLoadingAppOpenAd) {
// Toast.makeText(this, "请求开屏广告中请稍后", Toast.LENGTH_SHORT).show()
// return@setOnClickListener
// }
// com.zxdemo.admob.AdmobHelper.showAppOpenAd(this, failed = {
// Toast.makeText(this, "显示开屏广告失败", Toast.LENGTH_SHORT).show()
// })
// }
// binding.buttonInterstitial.setOnClickListener {
// if (com.zxdemo.admob.AdmobHelper.isLoadingInterstitialAd) {
// Toast.makeText(this, "请求插屏广告中请稍后", Toast.LENGTH_SHORT).show()
// return@setOnClickListener
// }
// com.zxdemo.admob.AdmobHelper.showInterstitialAd(this, failed = {
// Toast.makeText(this, "显示插屏广告失败", Toast.LENGTH_SHORT).show()
// })
// }
// binding.buttonBanner.setOnClickListener {
// Toast.makeText(this, "请求Banner广告中请稍后...", Toast.LENGTH_SHORT).show()
// binding.buttonBanner.isClickable = false
// com.zxdemo.admob.AdmobHelper.showBannerAd(
// this,
// binding.frameBanner,
// completed = {
// binding.buttonBanner.isClickable = true
// println()
// },
// failed = {
// binding.buttonBanner.isClickable = true
// Toast.makeText(this, "显示Banner广告失败", Toast.LENGTH_SHORT).show()
// }
// )
// }
// binding.buttonNative.setOnClickListener {
// Toast.makeText(this, "请求原生广告中请稍后...", Toast.LENGTH_SHORT).show()
// binding.buttonNative.isClickable = false
// com.zxdemo.admob.AdmobHelper.showNativeAd(
// this,
// { nativeAd ->
// binding.buttonNative.isClickable = true
// binding.adNative.setNativeAd(nativeAd)
// },
// { nativeAdLoader, nativeMaxAd ->
// binding.buttonNative.isClickable = true
// binding.adNative.setNativeAd(nativeAdLoader, nativeMaxAd)
// },
// {
// binding.buttonNative.isClickable = true
// Toast.makeText(this, "显示原生广告失败", Toast.LENGTH_SHORT).show()
// }
// )
// }
// com.zxdemo.http.ZxHttp.getHttpConfig { }
// com.zxdemo.http.ZxHttp.getBlacklist { com.zxdemo.admob.AdmobHelper.blacklist = it }
// com.zxdemo.admob.AdmobHelper.init(this, {}, {})
// if (!com.zxdemo.admob.AdmobHelper.useAdmob) {
// binding.buttonAppApplovin.apply {
// setOnClickListener {
// AppLovinSdk.getInstance(context).showMediationDebugger()
// }
// }.isVisible = true
// }
// }
//}
\ No newline at end of file
app/src/main/java/com/zxdemo/ZxApplication.kt
View file @
ab3f6ff0
...
@@ -21,8 +21,6 @@ import com.zxdemo.utils.ActivityCollector
...
@@ -21,8 +21,6 @@ import com.zxdemo.utils.ActivityCollector
import
com.zxdemo.utils.DeviceUtils
import
com.zxdemo.utils.DeviceUtils
import
com.zxdemo.utils.FcmUtils
import
com.zxdemo.utils.FcmUtils
import
com.zxdemo.utils.InstallRefeerUtils
import
com.zxdemo.utils.InstallRefeerUtils
import
com.zxdemo.utils.SpUtils
import
java.time.LocalTime
class
ZxApplication
:
Application
()
{
class
ZxApplication
:
Application
()
{
...
@@ -43,7 +41,6 @@ class ZxApplication : Application() {
...
@@ -43,7 +41,6 @@ class ZxApplication : Application() {
)
)
}
}
@RequiresApi
(
Build
.
VERSION_CODES
.
O
)
override
fun
onCreate
()
{
override
fun
onCreate
()
{
super
.
onCreate
()
super
.
onCreate
()
DeviceUtils
.
getGoogleAdvertiserId
()
DeviceUtils
.
getGoogleAdvertiserId
()
...
...
app/src/main/java/com/zxdemo/receiver/UnlockReceiver.kt
View file @
ab3f6ff0
...
@@ -6,14 +6,10 @@ import android.content.Intent
...
@@ -6,14 +6,10 @@ import android.content.Intent
import
android.content.IntentFilter
import
android.content.IntentFilter
import
android.os.Build
import
android.os.Build
import
android.util.Log
import
android.util.Log
import
androidx.annotation.RequiresApi
import
com.swiftcleaner.chovey.model.bean.Global.lockNotificationStatus
import
com.swiftcleaner.chovey.model.bean.Global.lockNotificationStatus
import
com.zxdemo.ZxApplication
import
com.zxdemo.ZxApplication
import
com.zxdemo.notity.NotificationUtils
import
com.zxdemo.notity.NotificationUtils
import
com.zxdemo.utils.SpUtils
import
com.zxdemo.utils.SpUtils
import
java.time.LocalDateTime
import
java.time.format.DateTimeFormatter
import
java.time.temporal.ChronoUnit
class
UnlockReceiver
:
BroadcastReceiver
()
{
class
UnlockReceiver
:
BroadcastReceiver
()
{
...
@@ -36,9 +32,8 @@ class UnlockReceiver : BroadcastReceiver() {
...
@@ -36,9 +32,8 @@ class UnlockReceiver : BroadcastReceiver() {
}
}
@RequiresApi
(
Build
.
VERSION_CODES
.
O
)
override
fun
onReceive
(
context
:
Context
,
intent
:
Intent
)
{
override
fun
onReceive
(
context
:
Context
,
intent
:
Intent
)
{
Log
.
e
(
"UnlockReceiver"
,
"onReceive"
)
val
action
=
intent
.
action
val
action
=
intent
.
action
when
(
action
)
{
when
(
action
)
{
...
@@ -59,6 +54,7 @@ class UnlockReceiver : BroadcastReceiver() {
...
@@ -59,6 +54,7 @@ class UnlockReceiver : BroadcastReceiver() {
//获取当前时间和上一次推送的时间
//获取当前时间和上一次推送的时间
if
(
lockNotificationStatus
==
1
&&
mIsScreenOn
&&
!
isLock
)
{
if
(
lockNotificationStatus
==
1
&&
mIsScreenOn
&&
!
isLock
)
{
Log
.
e
(
"UnlockReceiver"
,
"unlock"
)
NotificationUtils
.
sendNotification
(
NotificationUtils
.
sendNotification
(
ZxApplication
.
context
,
"showNotification"
,
"receive_unlock"
ZxApplication
.
context
,
"showNotification"
,
"receive_unlock"
)
)
...
...
app/src/main/res/layout/notification_common.xml
View file @
ab3f6ff0
...
@@ -2,93 +2,52 @@
...
@@ -2,93 +2,52 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
195dp
"
android:layout_height=
"
wrap_content
"
android:layout_marginHorizontal=
"10dp"
android:layout_marginHorizontal=
"10dp"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:layout_marginEnd=
"11dp"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/iv_icon_small"
android:layout_width=
"28dp"
android:layout_height=
"28dp"
android:layout_gravity=
"center_vertical"
android:src=
"@mipmap/logo"
tools:ignore=
"ContentDescription"
/>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"5dp"
android:layout_weight=
"1"
android:text=
"@string/app_name"
android:textColor=
"#4F565E"
/>
<FrameLayout
android:id=
"@+id/fl_cancel"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:clickable=
"true"
android:focusable=
"true"
android:padding=
"5dp"
tools:ignore=
"TouchTargetSizeCheck"
>
<!-- 适应混淆规则这个xml中不引用@string-->
<ImageView
android:id=
"@+id/iv_return"
android:layout_width=
"18dp"
android:layout_height=
"18dp"
android:src=
"@mipmap/shouqi"
android:textColor=
"#999999"
android:textStyle=
"bold"
tools:ignore=
"HardcodedText"
/>
</FrameLayout>
</LinearLayout>
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"25dp"
>
android:layout_marginTop=
"25dp"
>
<ImageView
<ImageView
android:id=
"@+id/iv_icon"
android:layout_width=
"50dp"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:layout_height=
"50dp"
android:
src=
"@mipmap/h_cleanjunk
"
android:
layout_gravity=
"center_vertical|start
"
android:layout_marginStart=
"12dp"
android:layout_marginStart=
"12dp"
android:layout_gravity=
"center_vertical|start"
/>
android:src=
"@mipmap/h_cleanjunk"
/>
<TextView
<TextView
android:id=
"@+id/tv_desc"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Clean out junk files to free up space on your phone!"
android:maxLines=
"2"
android:ellipsize=
"end"
android:textColor=
"#000000"
android:textSize=
"16sp"
android:gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"13dp"
android:layout_marginStart=
"13dp"
android:layout_marginEnd=
"45dp"
/>
android:layout_marginEnd=
"45dp"
android:ellipsize=
"end"
android:gravity=
"center_vertical"
android:maxLines=
"2"
android:text=
"Clean out junk files to free up space on your phone!"
android:textColor=
"#000000"
android:textSize=
"16sp"
/>
</LinearLayout>
</LinearLayout>
<
androidx.appcompat.widget.AppCompatButton
<
TextView
android:id=
"@+id/
button_clea
n"
android:id=
"@+id/
fl_bt
n"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"44dp"
android:layout_height=
"44dp"
android:layout_marginHorizontal=
"16dp"
android:layout_marginTop=
"22dp"
android:layout_marginBottom=
"16dp"
android:background=
"@drawable/shape_clean_up"
android:gravity=
"center"
android:text=
"Clean"
android:text=
"Clean"
android:textAllCaps=
"false"
android:textAllCaps=
"false"
android:textSize=
"18sp"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:gravity=
"center"
android:textSize=
"18sp"
/>
android:layout_marginHorizontal=
"16dp"
android:background=
"@drawable/shape_clean_up"
android:layout_marginTop=
"22dp"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/notification_common_small.xml
View file @
ab3f6ff0
...
@@ -51,14 +51,7 @@
...
@@ -51,14 +51,7 @@
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"12sp"
android:textSize=
"12sp"
tools:ignore=
"HardcodedText"
/>
tools:ignore=
"HardcodedText"
/>
<ImageView
android:id=
"@+id/iv_return"
android:layout_width=
"18dp"
android:layout_height=
"18dp"
android:src=
"@mipmap/zhankai"
android:layout_marginEnd=
"11dp"
android:layout_marginTop=
"15sp"
tools:ignore=
"HardcodedText"
/>
</LinearLayout>
</LinearLayout>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment