当选择自动跳转时,直接访问 URL 前缀,这样网址自由设置
This commit is contained in:
@@ -9,6 +9,15 @@ author:
|
||||
2. $ {VERSION_CODE} (去掉空格),会自动替换实际修订号,比如 1.1.4.$ {VERSION_CODE}
|
||||
-->
|
||||
|
||||
### [1.0.3.${VERSION_CODE}] - 2025.11.1
|
||||
|
||||
#### 文件下载
|
||||
|
||||
* [dashboardclient_1.0.3.apk](dashboardclient_1.0.3.apk)
|
||||
|
||||
#### 更新记录
|
||||
* 当选择自动跳转时,直接访问 URL 前缀,这样网址自由设置
|
||||
|
||||
### [1.0.2.19] - 2025.10.11
|
||||
|
||||
#### 文件下载
|
||||
|
||||
@@ -96,21 +96,19 @@ public class BuildingDashboardActivity extends FullscreenActivity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
// 当用户选择了自动跳转时,直接访问 urlPrefix,这样 url 可以自由设置
|
||||
SharedPreferences pre = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String url = pre.getString("k_url", "http://172.18.22.211:8002/Dashboard");
|
||||
String type = pre.getString("k_dashboard_type", "0");
|
||||
configUrl = url + "/data/config.json";
|
||||
|
||||
if(!type.equals("0"))
|
||||
mainUrl = url + "/dashboards/" + type + "/index.html";
|
||||
else
|
||||
mainUrl = url + "/index.html";
|
||||
String urlPrefix = pre.getString("k_url_prefix", "http://172.18.22.211:8002/Dashboard");
|
||||
String urlEndPoint = pre.getString("k_url_end_point", "/").replaceFirst("^/", "");
|
||||
configUrl = urlPrefix + "/data/config.json";
|
||||
mainUrl = urlEndPoint.isEmpty() ? urlPrefix : urlPrefix + "/" + urlEndPoint;
|
||||
|
||||
configLoadHandler.post(configLoadRunnable);
|
||||
loadUrlWithRetry();
|
||||
}
|
||||
|
||||
private void loadUrlWithRetry() {
|
||||
Log.i("WebView", "Loading " + mainUrl);
|
||||
binding.webview.loadUrl(mainUrl);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<resources>
|
||||
<string-array name="dashboard_type_entries">
|
||||
<item>0 (根据服务器配置跳转)</item>
|
||||
<item>1 (按楼层)</item>
|
||||
<item>2 (网格+统计)</item>
|
||||
<string-array name="url_end_point_entries">
|
||||
<item>自动跳转</item>
|
||||
<item>按楼层</item>
|
||||
<item>网格+统计</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -10,15 +10,15 @@
|
||||
<item>reply_all</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="dashboard_type_entries">
|
||||
<item>0 (Auto Redirect)</item>
|
||||
<item>1 (Floor)</item>
|
||||
<item>2 (Grid+Statics)</item>
|
||||
<string-array name="url_end_point_entries">
|
||||
<item>Auto Redirect</item>
|
||||
<item>Floor</item>
|
||||
<item>Grid+Statics</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="dashboard_type_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<string-array name="url_end_point_values">
|
||||
<item>/</item>
|
||||
<item>/dashboards/1</item>
|
||||
<item>/dashboards/2</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -2,5 +2,5 @@
|
||||
<string name="app_name">Dashboard</string>
|
||||
<string name="title_activity_building_dashboard">Building Dashboard</string>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
<string name="dashboard_type_default_value" translatable="false">0</string>
|
||||
<string name="url_end_point_default_value" translatable="false">/</string>
|
||||
</resources>
|
||||
@@ -1,16 +1,16 @@
|
||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory app:title="网页地址">
|
||||
<EditTextPreference
|
||||
app:key="k_url"
|
||||
app:key="k_url_prefix"
|
||||
app:title="URL 前缀"
|
||||
app:defaultValue="http://172.18.22.211:8002/Dashboard"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<ListPreference
|
||||
app:title="仪表盘类型"
|
||||
app:key="k_dashboard_type"
|
||||
app:title="仪表盘风格"
|
||||
app:key="k_url_end_point"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
app:entries="@array/dashboard_type_entries"
|
||||
app:entryValues="@array/dashboard_type_values"
|
||||
app:defaultValue="@string/dashboard_type_default_value" />
|
||||
app:entries="@array/url_end_point_entries"
|
||||
app:entryValues="@array/url_end_point_values"
|
||||
app:defaultValue="@string/url_end_point_default_value" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
Reference in New Issue
Block a user