Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

Commit 700e797

Browse files
committed
增加利用fast.com进行网络测速
1 parent 8e9d719 commit 700e797

6 files changed

Lines changed: 51 additions & 18 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ android {
1818
minSdkVersion 26
1919
targetSdkVersion 30
2020
versionCode gitCommitCount.toInteger()
21-
versionName "3.2"
21+
versionName "3.3"
2222
versionNameSuffix = ".r${gitCommitCount}.${gitCommitHash}"
2323

2424
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

app/src/main/java/com/dashboard/kotlin/MainPage.kt

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.dashboard.kotlin
22

33
import android.content.Intent
4+
import android.content.res.Configuration
45
import android.os.Bundle
56
import android.util.Log
67
import android.view.LayoutInflater
@@ -139,8 +140,7 @@ class MainPage : Fragment() {
139140
context?.theme
140141
)
141142
)
142-
clash_status_text.text =
143-
getString(R.string.clash_charging)
143+
clash_status_text.text = getString(R.string.clash_charging)
144144
netspeed_status_text.visibility = View.GONE
145145

146146
GlobalScope.async {
@@ -168,24 +168,31 @@ class MainPage : Fragment() {
168168

169169

170170
menu_ip_check.setOnClickListener {
171-
172-
val navController = it.findNavController()
173-
navController.navigate(R.id.action_mainPage_to_ipCheckPage)
174-
171+
it.findNavController().navigate(R.id.action_mainPage_to_ipCheckPage)
175172
}
176173

177174

178175
menu_web_dashboard.setOnClickListener {
179-
val navController = it.findNavController()
180176
val bundle = Bundle()
181-
bundle.putString("URL", "http://127.0.0.1:9090/ui/")
182-
navController.navigate(R.id.action_mainPage_to_webViewPage, bundle)
177+
bundle.putString("URL", "http://127.0.0.1:9090/ui/"+
178+
if ((context?.resources?.configuration?.uiMode
179+
?.and(Configuration.UI_MODE_NIGHT_MASK)) == Configuration.UI_MODE_NIGHT_YES) {
180+
"?theme=dark"
181+
}else{
182+
"?theme=light"
183+
})
184+
it.findNavController().navigate(R.id.action_mainPage_to_webViewPage, bundle)
185+
}
186+
187+
menu_fast_test.setOnClickListener {
188+
val bundle = Bundle()
189+
bundle.putString("URL", "https://fast.com/zh/cn/")
190+
it.findNavController().navigate(R.id.action_mainPage_to_webViewPage, bundle)
183191
}
184192

185193
menu_setting.setOnClickListener {
186194
it.findNavController().navigate(R.id.action_manPage_to_settingPage)
187195
}
188-
1
189196
/*
190197
menu_web_dashboard_download.setOnClickListener {
191198

app/src/main/java/com/dashboard/kotlin/WebViewPage.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,7 @@ class WebViewPage : Fragment() {
4646
webView.settings.domStorageEnabled = true
4747
webView.settings.databaseEnabled = true
4848
webView.webViewClient = WebViewClient()
49-
webView.loadUrl(it + run {
50-
if ((context?.resources?.configuration?.uiMode?.and(Configuration.UI_MODE_NIGHT_MASK)) == Configuration.UI_MODE_NIGHT_YES) {
51-
"?theme=dark"
52-
}else{
53-
"?theme=light"
54-
}
55-
})
49+
webView.loadUrl(it)
5650
}
5751
}
5852

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<vector
2+
android:height="24dp"
3+
android:viewportHeight="1024"
4+
android:viewportWidth="1024"
5+
android:width="24dp"
6+
android:tint="?attr/colorControlNormal"
7+
xmlns:android="http://schemas.android.com/apk/res/android">
8+
<path android:fillColor="#FF000000" android:pathData="M828.48,854.72a32,32 0,1 1,-44.8 -45.44A378.24,378.24 0,0 0,896 540.48a384,384 0,0 0,-768 0,378.24 378.24,0 0,0 112.32,268.8 32,32 0,0 1,0 45.12,32 32,0 0,1 -45.44,0A443.84,443.84 0,0 1,512 96a448,448 0,0 1,448 444.48,441.6 441.6,0 0,1 -131.52,314.24z"/>
9+
<path android:fillColor="#FF000000" android:pathData="M96,608a32,32 0,0 1,0 -64h64a32,32 0,0 1,0 64zM864,608a32,32 0,0 1,0 -64h64a32,32 0,0 1,0 64zM201.28,278.72a32,32 0,1 1,45.44 -45.44l32,32a32,32 0,0 1,-45.44 45.44zM745.28,822.72a32,32 0,0 1,45.44 -45.44l32,32a32,32 0,0 1,-45.44 45.44zM777.28,233.28a32,32 0,1 1,45.44 45.44l-32,32a32,32 0,0 1,-45.44 -45.44zM233.28,777.28a32,32 0,0 1,45.44 45.44l-32,32a32,32 0,0 1,-45.44 -45.44zM480,160a32,32 0,0 1,64 0v64a32,32 0,0 1,-64 0zM597.76,505.92l-32,8.64a459.2,459.2 0,0 0,-68.8 22.08,41.92 41.92,0 0,0 -12.16,53.44 28.48,28.48 0,0 0,41.28 13.44,662.72 662.72,0 0,0 70.08,-75.2l7.68,-8.64 16,-19.2zM549.12,452.48l32,-8.64c25.28,-6.4 52.16,-12.8 79.04,-18.88l25.92,-6.08 10.24,-2.24a32,32 0,0 1,32 51.2c0,1.6 -3.2,4.48 -6.4,8l-16.96,21.12c-17.92,21.76 -35.84,43.52 -53.12,64l-7.68,8.96a542.08,542.08 0,0 1,-84.48 87.68,92.48 92.48,0 0,1 -132.16,-37.76 105.92,105.92 0,0 1,34.56 -137.28,387.84 387.84,0 0,1 87.04,-30.08z"/>
10+
</vector>

app/src/main/res/layout/fragment_main_page.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,27 @@
106106
android:textAppearance="?attr/textAppearanceHeadline6" />
107107
</LinearLayout>
108108
</com.google.android.material.card.MaterialCardView>
109+
<com.google.android.material.card.MaterialCardView
110+
android:id="@+id/menu_fast_test"
111+
style="@style/DefaultCard"
112+
app:cardElevation="0dp">
113+
114+
<LinearLayout
115+
style="@style/Default"
116+
android:layout_gravity="center"
117+
android:orientation="horizontal">
118+
119+
<ImageView
120+
style="@style/DefaultCardImage"
121+
android:layout_width="wrap_content"
122+
android:src="@drawable/ic_fast" />
123+
124+
<TextView
125+
style="@style/DefaultCardText"
126+
android:text="@string/title_fast_test"
127+
android:textAppearance="?attr/textAppearanceHeadline6" />
128+
</LinearLayout>
129+
</com.google.android.material.card.MaterialCardView>
109130
<com.google.android.material.card.MaterialCardView
110131
android:id="@+id/menu_setting"
111132
style="@style/DefaultCard"

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<string name="app_name">DashBoard</string>
33
<string name="title_setting">配置</string>
44
<string name="title_ip_check">IP 检查</string>
5+
<string name="title_fast_test">网络测速</string>
56
<string name="title_web_dashboard">网页面板</string>
67
<string name="title_web_dashboard_download">Clash 面板下载</string>
78
<string name="title_sub_download">订阅下载</string>

0 commit comments

Comments
 (0)