mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 16:00:43 +00:00
琚帶绔?- 淇 MTU 闂锛氬す MSS + 璺緞 MTU 鎺㈡祴锛堝叕缃戝彲鐢ㄧ巼 48% -> 100%锛?- 澶嶇敤 HTTP 杩炴帴锛堝厤鎺夋瘡娆℃柊寤?TLS 鐨?30% 鎻℃墜澶辫触锛?- 姣忓垎閽熷洖澶存壘灞€鍩熺綉锛岃嚜鍔ㄥ垏鍥炲揩 400 鍊嶇殑璺緞 - 鐢婚潰蹇冭烦甯э細闈欐鏃剁渷娴侀噺锛屽鎴风浠嶇煡閬撴祦鏄椿鐨?- 閿佸睆鏃剁粰鍑哄彲鎿嶄綔鐨勬彁绀? 鎵嬭〃绔?- 鍐呯疆 GTS Root R4 / GlobalSign Root CA锛屼慨 SSLHandshakeException - 杩炴帴閿欒缈昏瘧鎴愪汉璇濓紙璇佷功/鏃堕棿/瑙f瀽/瓒呮椂鍒嗗埆鎻愮ず锛?- 缁忎腑杞繛涓婂悗鐢ㄦ湇鍔″櫒鎶ョ殑鍦板潃鍒锋柊宸查厤瀵硅褰?- 鏂板灞€鍩熺綉杩炴帴椤甸潰銆佹湇鍔″櫒寤惰繜妫€娴? 鏈嶅姟鍣ㄧ - 鏀寔 chunked 璇锋眰浣擄紙淇瘡 16 绉掍竴娆$殑杩炴帴閿欎贡涓庡ぇ闈㈢Н 502锛?- 缃戠粶璋冧紭鑴氭湰 net-tune.sh锛堝紑鏈鸿嚜鍔ㄥ簲鐢級 - 绠$悊椤碉細鎵归噺鍒犻櫎銆佺綉缁滀綋妫€銆佷笅杞藉尯 - 闅ч亾鏀?HTTP/2 + 鍙岃繛鎺? 鏂囨。 - 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
155 lines
5.8 KiB
Python
155 lines
5.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""「功能」分页改成动态:分组由电脑端声明,手表端拉取后渲染。
|
|
|
|
原来写死了 6 个分组按钮,现在电脑端有 10 组、80 个功能,
|
|
写死就不合适了 —— 以后电脑端加一组,手表端自动就有。
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
MAIN = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\android\src"
|
|
r"\com\lanremote\watch\MainActivity.java")
|
|
|
|
# 1. 「功能」分页只留一个占位按钮(真正的按钮动态生成)
|
|
TAB_OLD = ''' new TabDef("功能", new Act[]{
|
|
act("显示", new Runnable() {
|
|
public void run() { pickFeatureGroup("显示"); }
|
|
}),
|
|
act("音量", new Runnable() {
|
|
public void run() { pickFeatureGroup("音量"); }
|
|
}),
|
|
act("系统", new Runnable() {
|
|
public void run() { pickFeatureGroup("系统"); }
|
|
}),
|
|
act("查看", new Runnable() {
|
|
public void run() { pickFeatureGroup("查看"); }
|
|
}),
|
|
act("效率", new Runnable() {
|
|
public void run() { pickFeatureGroup("效率"); }
|
|
}),
|
|
act("文件", new Runnable() {
|
|
public void run() { pickFeatureGroup("文件"); }
|
|
}),
|
|
}),'''
|
|
|
|
TAB_NEW = ''' // 「功能」页的按钮是动态生成的,这里留空
|
|
new TabDef("功能", new Act[]{}),'''
|
|
|
|
# 2. selectTab:功能页走动态构建
|
|
SELECT_OLD = ''' tabContent.removeAllViews();
|
|
cellQueue.clear();
|
|
for (Act item : tabDefs[index].acts) {
|
|
addRow(tabContent, action(item.label, item.task), null);
|
|
}
|
|
flushGrid(tabContent);
|
|
}'''
|
|
|
|
SELECT_NEW = ''' if ("功能".equals(tabDefs[index].name)) {
|
|
buildFeatureTab();
|
|
return;
|
|
}
|
|
tabContent.removeAllViews();
|
|
cellQueue.clear();
|
|
for (Act item : tabDefs[index].acts) {
|
|
addRow(tabContent, action(item.label, item.task), null);
|
|
}
|
|
flushGrid(tabContent);
|
|
}
|
|
|
|
/** 「功能」页:分组由电脑端声明,这里拉取后动态生成按钮。 */
|
|
private void buildFeatureTab() {
|
|
tabContent.removeAllViews();
|
|
cellQueue.clear();
|
|
|
|
if (featureGroups == null) {
|
|
TextView hint = new TextView(this);
|
|
hint.setText("正在获取电脑端功能列表…");
|
|
hint.setTextColor(C_DIM);
|
|
hint.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
|
|
hint.setPadding(dp(4), dp(8), dp(4), dp(8));
|
|
tabContent.addView(hint);
|
|
|
|
io.execute(new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
try {
|
|
Map<String, Object> reply =
|
|
client.call(Json.obj("cmd", "feature_list"), 20000);
|
|
final List<Map<String, Object>> items = mapList(reply, "features");
|
|
final List<String> groups = new ArrayList<String>();
|
|
for (Map<String, Object> item : items) {
|
|
String group = Json.str(item, "group", "其他");
|
|
if (!groups.contains(group)) {
|
|
groups.add(group);
|
|
}
|
|
}
|
|
featureCache = items;
|
|
ui.post(new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
featureGroups = groups;
|
|
selectTab(currentTab);
|
|
}
|
|
});
|
|
} catch (final IOException e) {
|
|
ui.post(new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
appendLog("获取功能列表失败:" + e.getMessage());
|
|
toast("没能连上电脑");
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (featureGroups.isEmpty()) {
|
|
TextView hint = new TextView(this);
|
|
hint.setText("电脑端没有声明任何功能");
|
|
hint.setTextColor(C_DIM);
|
|
hint.setPadding(dp(4), dp(8), dp(4), dp(8));
|
|
tabContent.addView(hint);
|
|
return;
|
|
}
|
|
|
|
for (final String group : featureGroups) {
|
|
addRow(tabContent, action(group, new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
pickFeatureGroup(group);
|
|
}
|
|
}), null);
|
|
}
|
|
flushGrid(tabContent);
|
|
}'''
|
|
|
|
# 3. 字段
|
|
FIELD_OLD = " private List<Map<String, Object>> featureCache = null;"
|
|
FIELD_NEW = (" private List<Map<String, Object>> featureCache = null;\n"
|
|
" private List<String> featureGroups = null;")
|
|
|
|
|
|
def main() -> int:
|
|
text = MAIN.read_text(encoding="utf-8")
|
|
ok = True
|
|
for old, new, tag in ((FIELD_OLD, FIELD_NEW, "字段"),
|
|
(TAB_OLD, TAB_NEW, "功能分页"),
|
|
(SELECT_OLD, SELECT_NEW, "动态构建")):
|
|
if old not in text:
|
|
print(f" [失败] {tag} 锚点未匹配")
|
|
ok = False
|
|
else:
|
|
text = text.replace(old, new, 1)
|
|
print(f" {tag}: OK")
|
|
if ok:
|
|
MAIN.write_text(text, encoding="utf-8")
|
|
return 0 if ok else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|