Compare commits
No commits in common. "0eecc8ce90b81c0ecb13ad2ceefe216e87744333" and "2adcdaf91ff5ab642aff1caff7edc31296968f91" have entirely different histories.
0eecc8ce90
...
2adcdaf91f
|
|
@ -16,4 +16,3 @@ local.properties
|
|||
/StandAPP/.idea
|
||||
/StandAPP/app/release
|
||||
/.idea/
|
||||
".idea/"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AndroidProjectSystem">
|
||||
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetSelector">
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="StandAPP.app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DeviceTable">
|
||||
<option name="columnSorters">
|
||||
<list>
|
||||
<ColumnSorterState>
|
||||
<option name="column" value="Name" />
|
||||
<option name="order" value="ASCENDING" />
|
||||
</ColumnSorterState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/StandAPP" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/StandAPP" />
|
||||
<option value="$PROJECT_DIR$/StandAPP/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/StandAPP-Project.iml" filepath="$PROJECT_DIR$/.idea/StandAPP-Project.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -11,8 +11,8 @@ android {
|
|||
applicationId = "com.stand.standapp"
|
||||
minSdk = 24
|
||||
targetSdk = 34
|
||||
versionCode = 2
|
||||
versionName = "1.0.1"
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,19 +43,6 @@
|
|||
.log-item { margin-bottom: 4px; border-bottom: 1px solid #334155; padding-bottom: 2px; }
|
||||
.log-time { color: #94a3b8; margin-right: 5px; }
|
||||
.log-msg { word-break: break-all; }
|
||||
|
||||
/* Custom Modal Styles */
|
||||
.modal-overlay {
|
||||
display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
||||
background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center;
|
||||
}
|
||||
.modal-content {
|
||||
background: white; padding: 20px; border-radius: 12px; width: 85%; max-width: 400px;
|
||||
box-shadow: 0 10px 25px rgba(0,0,0,0.2);
|
||||
}
|
||||
.modal-header { font-weight: bold; font-size: 18px; margin-bottom: 15px; color: #004A8F; border-bottom: 1px solid #eee; padding-bottom: 10px; }
|
||||
.modal-body { font-size: 14px; line-height: 1.8; color: #444; word-break: break-all; }
|
||||
.modal-footer { margin-top: 20px; text-align: right; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -79,8 +66,7 @@
|
|||
<p style="font-size: 12px; color: #666;">(适用于蓝牙/USB 小票机,传输原始 JSON)</p>
|
||||
|
||||
<button class="btn btn-orange" onclick="callUpdate()">3. 检查系统更新</button>
|
||||
<button class="btn" style="background: #64748b;" onclick="callAbout()">4. 关于应用</button>
|
||||
<button class="btn btn-red" onclick="callExit()">5. 退出应用</button>
|
||||
<button class="btn btn-red" onclick="callExit()">4. 退出应用</button>
|
||||
|
||||
<!-- WebSocket 控制区 -->
|
||||
<div class="ws-card">
|
||||
|
|
@ -191,19 +177,6 @@
|
|||
Telewave SDK Connectivity v1.0
|
||||
</div>
|
||||
|
||||
<!-- 自定义“关于”弹窗 -->
|
||||
<div id="aboutModal" class="modal-overlay" onclick="closeAbout()">
|
||||
<div class="modal-content" onclick="event.stopPropagation()">
|
||||
<div class="modal-header">关于应用信息</div>
|
||||
<div id="aboutBody" class="modal-body">
|
||||
正在获取信息...
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" style="padding: 10px 20px; background: #64748b; margin: 0;" onclick="closeAbout()">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 初始化界面
|
||||
document.getElementById('current-time').innerText = new Date().toLocaleString();
|
||||
|
|
@ -266,32 +239,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
function callAbout() {
|
||||
if (window.android && window.android.getAboutInfo) {
|
||||
const infoStr = window.android.getAboutInfo();
|
||||
try {
|
||||
const info = JSON.parse(infoStr);
|
||||
const html = `
|
||||
<strong>应用名称:</strong> ${info.appName}<br>
|
||||
<strong>版本号:</strong> <span style="color: #3b82f6;">${info.versionName}</span><br>
|
||||
<strong>设备型号:</strong> ${info.model}<br>
|
||||
<strong>系统版本:</strong> Android ${info.osVersion}
|
||||
`;
|
||||
document.getElementById('aboutBody').innerHTML = html;
|
||||
document.getElementById('aboutModal').style.display = 'flex';
|
||||
} catch (e) {
|
||||
document.getElementById('aboutBody').innerText = "获取信息解析失败: " + infoStr;
|
||||
document.getElementById('aboutModal').style.display = 'flex';
|
||||
}
|
||||
} else {
|
||||
alert("关于接口未就绪");
|
||||
}
|
||||
}
|
||||
|
||||
function closeAbout() {
|
||||
document.getElementById('aboutModal').style.display = 'none';
|
||||
}
|
||||
|
||||
// 安卓回调函数:退出确认时执行
|
||||
function addExitText() {
|
||||
const tag = document.getElementById('inject-status');
|
||||
|
|
@ -311,7 +258,6 @@
|
|||
let clientId = "WEB_" + Math.random().toString(36).substr(2, 9);
|
||||
let heartbeatTimer = null;
|
||||
let reconnectTimer = null;
|
||||
let isManualClose = false; // 新增:手动断开标记
|
||||
const logList = document.getElementById('log-list');
|
||||
|
||||
document.getElementById('ws-client-id').innerText = clientId;
|
||||
|
|
@ -355,7 +301,6 @@
|
|||
const finalUrl = rawUrl.replace("{clientId}", clientId);
|
||||
|
||||
addLog("正在尝试连接: " + finalUrl, false);
|
||||
isManualClose = false; // 启动连接时重置标记
|
||||
|
||||
try {
|
||||
ws = new WebSocket(finalUrl);
|
||||
|
|
@ -379,12 +324,8 @@
|
|||
updateWSStatus(false);
|
||||
addLog("连接关闭", false);
|
||||
stopHeartbeat();
|
||||
|
||||
// 只有非手动断开(如网络异常)时才自动重连
|
||||
if (!isManualClose) {
|
||||
addLog("异常断开,5秒后自动重连...", false);
|
||||
reconnectTimer = setTimeout(connectWS, 5000);
|
||||
}
|
||||
// 5秒后自动重连
|
||||
reconnectTimer = setTimeout(connectWS, 5000);
|
||||
};
|
||||
|
||||
ws.onerror = (err) => {
|
||||
|
|
@ -398,7 +339,6 @@
|
|||
|
||||
function toggleWS() {
|
||||
if (ws && ws.readyState === WebSocket.OPEN) {
|
||||
isManualClose = true; // 标记为手动断开
|
||||
clearTimeout(reconnectTimer);
|
||||
reconnectTimer = null;
|
||||
ws.close();
|
||||
|
|
|
|||
|
|
@ -103,24 +103,6 @@ class AndroidInterface(private val activity: MainActivity) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JS 调用:获取“关于”信息
|
||||
*/
|
||||
@JavascriptInterface
|
||||
fun getAboutInfo(): String {
|
||||
return try {
|
||||
val packageInfo = activity.packageManager.getPackageInfo(activity.packageName, 0)
|
||||
val json = org.json.JSONObject()
|
||||
json.put("appName", activity.getString(R.string.app_name))
|
||||
json.put("versionName", packageInfo.versionName)
|
||||
json.put("model", android.os.Build.MODEL)
|
||||
json.put("osVersion", android.os.Build.VERSION.RELEASE)
|
||||
json.toString()
|
||||
} catch (e: Exception) {
|
||||
"{ \"appName\": \"StandApp\", \"versionName\": \"1.0.0\" }"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* JS 调用:保存消息记录
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue