- 在 `lib`、`pin` 及 `okhttpMock` 模块中新增 `mode` 变体维度,并配置 `pin`(默认)与 `normal` 两个 flavor。 - 配置 `lib` 模块的 `sourceSets`,将不同 flavor 指向对应的源码目录(`src/pin/java` 与 `src/normal/java`)。 - 迁移 `pin` 和 `app` 模块的 `kotlinOptions` 至 `compilerOptions`,并将 `jvmTarget` 统一设置为 `JVM_1_8`。 - 调整 `pin` 和 `okhttpMock` 模块对 `:lib` 的依赖方式,改为按 flavor 依赖(`pinImplementation` 与 `normalImplementation`)。 - 移动 `NotificationManager.kt` 至 `lib` 模块的 `pin` 源码目录,并在 `normal` 源码目录下新增其空实现。main
parent
8d03c25264
commit
4554092779
@ -0,0 +1,36 @@
|
|||||||
|
package com.example.pin
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.provider.Settings
|
||||||
|
import android.provider.Telephony
|
||||||
|
import android.service.notification.NotificationListenerService
|
||||||
|
import android.service.notification.StatusBarNotification
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.util.Log
|
||||||
|
import com.example.logger.LogUtils
|
||||||
|
import java.lang.reflect.Method
|
||||||
|
import java.lang.reflect.Modifier
|
||||||
|
|
||||||
|
object NotificationManger {
|
||||||
|
private val TAG = NotificationManger::class.java.simpleName
|
||||||
|
private const val DEFAULT_POLL_INTERVAL = 1000L // 默认轮询间隔 1 秒
|
||||||
|
var listener:((NotificationMessage)->Unit)? = null
|
||||||
|
private lateinit var applicationContext: Context
|
||||||
|
|
||||||
|
fun initialized(context: Context) {
|
||||||
|
applicationContext = context.applicationContext
|
||||||
|
}
|
||||||
|
|
||||||
|
fun startPolling(intervalMs: Long = DEFAULT_POLL_INTERVAL, duration: Long, l:(NotificationMessage)-> Unit) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun stopPolling() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue