Skip to content

Commit 34dbe0f

Browse files
committed
新增:投屏时关闭屏幕
1 parent 75cf44d commit 34dbe0f

File tree

7 files changed

+22
-33
lines changed

7 files changed

+22
-33
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## v0.4.0
22

3+
- 新增:投屏时关闭屏幕
34
- 新增:工单反馈功能,便于解决问题
45
- 新增:应用 loading 窗口
56
- 新增:添加文件夹下载功能 [#pr-43](https://github.com/modstart-lib/linkandroid/pull/43)
@@ -8,6 +9,7 @@
89
- 优化:工单提交日志收集完善更多信息,方便排查问题
910
- 优化:将已连接的设备排在最前面,剩下的按照id排序 [#pr-42](https://github.com/modstart-lib/linkandroid/pull/42/files)
1011
- 优化:toast 和 loading 显示位置优化
12+
- 优化:修复文件管理页面的输入窗口焦点问题 [#pr-44](https://github.com/modstart-lib/linkandroid/pull/44)
1113
- 修复:windows下路径编码问题
1214
- 修复:版本号对比检测异常问题修复
1315

src/components/Device/DeviceDefaultSettingDialog.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ defineExpose({
5454
<div class="font-bold text-xl mb-3">
5555
{{ $t('投屏') }}
5656
</div>
57-
<!-- <div class="flex mb-3">-->
58-
<!-- <div class="flex-grow">{{ $t('投屏时调暗屏幕') }}</div>-->
59-
<!-- <div class="">-->
60-
<!-- <SettingItemYesNo v-model="formData.dimWhenMirror"/>-->
61-
<!-- </div>-->
62-
<!-- </div>-->
57+
<div class="flex mb-3">
58+
<div class="flex-grow">{{ $t('投屏时关闭屏幕') }}</div>
59+
<div class="">
60+
<SettingItemYesNo v-model="formData.dimWhenMirror"/>
61+
</div>
62+
</div>
6363
<div class="flex mb-3">
6464
<div class="flex-grow">{{ $t('投屏总在最上层') }}</div>
6565
<div class="">

src/components/Device/DeviceSettingDialog.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ defineExpose({
8080
<div class="font-bold text-xl mb-3">
8181
{{ $t('投屏') }}
8282
</div>
83-
<!-- <div class="flex mb-3">-->
84-
<!-- <div class="flex-grow">{{ $t('投屏时调暗屏幕') }}</div>-->
85-
<!-- <div class="">-->
86-
<!-- <SettingItemYesNoDefault v-model="formData.dimWhenMirror"/>-->
87-
<!-- </div>-->
88-
<!-- </div>-->
83+
<div class="flex mb-3">
84+
<div class="flex-grow">{{ $t('投屏时关闭屏幕') }}</div>
85+
<div class="">
86+
<SettingItemYesNoDefault v-model="formData.dimWhenMirror"/>
87+
</div>
88+
</div>
8989
<div class="flex mb-3">
9090
<div class="flex-grow">{{ $t('投屏总在最上层') }}</div>
9191
<div class="">
@@ -107,7 +107,8 @@ defineExpose({
107107
<div class="flex mb-3">
108108
<div class="flex-grow">{{ $t('视频比特率') }}</div>
109109
<div class="">
110-
<a-input v-model="formData.videoBitRate" size="small" :placeholder="$t('留空使用默认配置')"/>
110+
<a-input v-model="formData.videoBitRate" size="small"
111+
:placeholder="$t('留空使用默认配置')"/>
111112
</div>
112113
</div>
113114
<div class="flex mb-3">

src/lang/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
"4a52703c": "Default Setting",
151151
"4b9352c5": "Recorded %s",
152152
"4c2d6613": "Add as network device",
153-
"4f59d0b6": "Dim screen",
153+
"4f59d0b6": "Close screen when mirror",
154154
"4f997a55": "Delete",
155155
"508513f9": "Are you sure you want to delete the selected files?",
156156
"59950117": "Leave blank to use default",

src/lang/source.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"投屏到电脑": "6793a9ee",
9999
"投屏总在最上层": "196deb0f",
100100
"投屏成功": "2e36d069",
101-
"投屏时调暗屏幕": "4f59d0b6",
101+
"投屏时关闭屏幕": "4f59d0b6",
102102
"投屏时转发声音": "0ec1e5c8",
103103
"按修改时间排序": "0cfe724f",
104104
"按文件名排序": "44fde40e",

src/lang/zh-CN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
"4b9352c5": "已录制 %s",
180180
"4c2d6613": "添加为网络设备",
181181
"4e980c75": "正在连接设备",
182-
"4f59d0b6": "投屏时调暗屏幕",
182+
"4f59d0b6": "投屏时关闭屏幕",
183183
"4f997a55": "delete",
184184
"508513f9": "确定删除选中的文件吗?",
185185
"53f5fcc1": "支持的命令:",

src/store/modules/device.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -278,27 +278,13 @@ export const deviceStore = defineStore("device", {
278278
if (setting.maxFps) {
279279
args.push(`--max-fps="${setting.maxFps}"`)
280280
}
281+
if (setting.dimWhenMirror === 'yes') {
282+
args.push('--turn-screen-off')
283+
}
281284

282285
const mirrorStart = async () => {
283-
if ('yes' === setting.dimWhenMirror) {
284-
try {
285-
const result = await window.$mapi.adb.adbShell('shell settings get system screen_brightness', device.id)
286-
// @ts-ignore
287-
device.runtime.screenBrightness = parseInt(result?.stdout)
288-
console.log('screenBrightness.backup', device.runtime.screenBrightness)
289-
await window.$mapi.adb.adbShell('shell settings put system screen_brightness 1', device.id)
290-
} catch (e) {
291-
console.error('dimWhenMirror.error', e)
292-
}
293-
}
294286
}
295287
const mirrorEnd = async () => {
296-
if ('yes' === setting.dimWhenMirror) {
297-
// console.log('screenBrightness.restore', device.runtime.screenBrightness)
298-
if (device.runtime.screenBrightness) {
299-
await window.$mapi.adb.adbShell(`shell settings put system screen_brightness ${device.runtime.screenBrightness}`, device.id)
300-
}
301-
}
302288
}
303289
try {
304290
runtime.value.mirrorController = await window.$mapi.scrcpy.mirror(device.id, {

0 commit comments

Comments
 (0)