mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 11:42:22 +08:00
fix: 移除按键快照 (#26)
This commit is contained in:
parent
44b1135a5f
commit
592415edff
|
@ -5,7 +5,6 @@ import android.content.pm.PackageManager
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.view.Display
|
import android.view.Display
|
||||||
import android.view.KeyEvent
|
|
||||||
import android.view.accessibility.AccessibilityEvent
|
import android.view.accessibility.AccessibilityEvent
|
||||||
import android.view.accessibility.AccessibilityNodeInfo
|
import android.view.accessibility.AccessibilityNodeInfo
|
||||||
import com.blankj.utilcode.util.LogUtils
|
import com.blankj.utilcode.util.LogUtils
|
||||||
|
@ -34,7 +33,6 @@ import li.songe.gkd.data.NodeInfo
|
||||||
import li.songe.gkd.data.RpcError
|
import li.songe.gkd.data.RpcError
|
||||||
import li.songe.gkd.data.SubscriptionRaw
|
import li.songe.gkd.data.SubscriptionRaw
|
||||||
import li.songe.gkd.db.DbSet
|
import li.songe.gkd.db.DbSet
|
||||||
import li.songe.gkd.debug.SnapshotExt
|
|
||||||
import li.songe.gkd.shizuku.newActivityTaskManager
|
import li.songe.gkd.shizuku.newActivityTaskManager
|
||||||
import li.songe.gkd.shizuku.shizukuIsSafeOK
|
import li.songe.gkd.shizuku.shizukuIsSafeOK
|
||||||
import li.songe.gkd.shizuku.useShizukuAliveState
|
import li.songe.gkd.shizuku.useShizukuAliveState
|
||||||
|
@ -96,23 +94,6 @@ class GkdAbService : CompositionAbService({
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastKeyEventTime = -1L
|
|
||||||
onKeyEvent { event -> // 当按下音量键时捕获快照
|
|
||||||
val keyCode = event?.keyCode ?: return@onKeyEvent
|
|
||||||
if (storeFlow.value.captureVolumeKey && (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP)) {
|
|
||||||
val et = System.currentTimeMillis()
|
|
||||||
if (et - lastKeyEventTime > 3000) {
|
|
||||||
lastKeyEventTime = et
|
|
||||||
scope.launchTry(IO) {
|
|
||||||
val snapshot = SnapshotExt.captureSnapshot()
|
|
||||||
ToastUtils.showShort("保存快照成功")
|
|
||||||
LogUtils.d("截屏:保存快照", snapshot.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var serviceConnected = false
|
var serviceConnected = false
|
||||||
onServiceConnected { serviceConnected = true }
|
onServiceConnected { serviceConnected = true }
|
||||||
onInterrupt { serviceConnected = false }
|
onInterrupt { serviceConnected = false }
|
||||||
|
|
|
@ -192,19 +192,6 @@ fun DebugPage() {
|
||||||
}
|
}
|
||||||
Divider()
|
Divider()
|
||||||
|
|
||||||
TextSwitch(
|
|
||||||
name = "按键快照",
|
|
||||||
desc = "当用户按下音量键时,自动保存当前界面的快照",
|
|
||||||
checked = store.captureVolumeKey
|
|
||||||
) {
|
|
||||||
updateStorage(
|
|
||||||
storeFlow, store.copy(
|
|
||||||
captureVolumeKey = it
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Divider()
|
|
||||||
|
|
||||||
SettingItem(title = "快照记录", onClick = {
|
SettingItem(title = "快照记录", onClick = {
|
||||||
navController.navigate(SnapshotPageDestination)
|
navController.navigate(SnapshotPageDestination)
|
||||||
})
|
})
|
||||||
|
|
|
@ -78,7 +78,7 @@ data class Store(
|
||||||
val captureScreenshot: Boolean = false,
|
val captureScreenshot: Boolean = false,
|
||||||
val httpServerPort: Int = 8888,
|
val httpServerPort: Int = 8888,
|
||||||
val updateSubsInterval: Long = 60 * 60_000,
|
val updateSubsInterval: Long = 60 * 60_000,
|
||||||
val captureVolumeKey: Boolean = false,
|
@Deprecated("https://github.com/gkd-kit/gkd/issues/26") val captureVolumeKey: Boolean = false,
|
||||||
val autoCheckAppUpdate: Boolean = true,
|
val autoCheckAppUpdate: Boolean = true,
|
||||||
val toastWhenClick: Boolean = true,
|
val toastWhenClick: Boolean = true,
|
||||||
val clickToast: String = "跳过",
|
val clickToast: String = "跳过",
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
|
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:accessibilityEventTypes="typeAllMask"
|
android:accessibilityEventTypes="typeAllMask"
|
||||||
android:accessibilityFeedbackType="feedbackAllMask"
|
android:accessibilityFeedbackType="feedbackAllMask"
|
||||||
android:accessibilityFlags="flagReportViewIds|flagIncludeNotImportantViews|flagDefault|flagRetrieveInteractiveWindows|flagRequestFilterKeyEvents"
|
android:accessibilityFlags="flagReportViewIds|flagIncludeNotImportantViews|flagDefault|flagRetrieveInteractiveWindows"
|
||||||
android:canPerformGestures="true"
|
android:canPerformGestures="true"
|
||||||
android:canRequestFilterKeyEvents="true"
|
|
||||||
android:canRetrieveWindowContent="true"
|
android:canRetrieveWindowContent="true"
|
||||||
android:canTakeScreenshot="true"
|
android:canTakeScreenshot="true"
|
||||||
android:description="@string/ab_desc"
|
android:description="@string/ab_desc"
|
||||||
android:notificationTimeout="100"
|
android:notificationTimeout="100"
|
||||||
android:settingsActivity="li.songe.gkd.MainActivity" />
|
android:settingsActivity="li.songe.gkd.MainActivity"
|
||||||
|
tools:ignore="UnusedAttribute" />
|
Loading…
Reference in New Issue
Block a user