Skip to content

Commit bb87981

Browse files
committed
refactor: 移除多语言支持和启动屏
移除了应用内的语言切换功能和相关的 `LocaleHelper`,并删除了启动页 `SplashScreen` 及其相关逻辑。这些更改简化了代码库,并使应用直接启动到主界面。
1 parent 0663d73 commit bb87981

File tree

16 files changed

+53
-327
lines changed

16 files changed

+53
-327
lines changed

app/build.gradle.kts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
import java.util.concurrent.TimeUnit
2-
31
plugins {
42
id("com.android.application")
53
id("org.jetbrains.kotlin.android")
6-
}
7-
8-
fun String.runCommand(workingDir: File = file("./")): String {
9-
val parts = this.split("\\s".toRegex())
10-
val proc = ProcessBuilder(*parts.toTypedArray())
11-
.directory(workingDir)
12-
.redirectOutput(ProcessBuilder.Redirect.PIPE)
13-
.redirectError(ProcessBuilder.Redirect.PIPE)
14-
.start()
15-
16-
proc.waitFor(1, TimeUnit.MINUTES)
17-
return proc.inputStream.bufferedReader().readText().trim()
4+
alias(libs.plugins.kotlin.compose)
185
}
196

207
val packageName = "io.github.vvb2060.ims"
21-
val gitVersionCode: Int = "git rev-list HEAD --count".runCommand().toInt()
22-
val gitVersionName = "git rev-parse --short=8 HEAD".runCommand()
23-
val appVersionName = libs.versions.app.version.get()
8+
val gitVersionCode: Int = providers.exec {
9+
commandLine(
10+
"git",
11+
"rev-list",
12+
"HEAD",
13+
"--count"
14+
)
15+
}.standardOutput.asText.get().trim().toInt()
16+
val gitVersionName: String =
17+
providers.exec {
18+
commandLine(
19+
"git",
20+
"rev-parse",
21+
"--short=8",
22+
"HEAD"
23+
)
24+
}.standardOutput.asText.get().trim()
25+
val appVersionName: String = libs.versions.app.version.get()
2426

2527
android {
2628
namespace = packageName

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43

54
<application
65
android:label="Turbo IMS"
76
android:icon="@mipmap/ic_launcher"
87
android:theme="@android:style/Theme.DeviceDefault.DayNight">
98

109
<activity
11-
android:name=".SplashActivity"
10+
android:name=".MainActivity"
1211
android:exported="true"
13-
android:theme="@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen">
12+
android:label="Turbo IMS" >
1413
<intent-filter>
1514
<action android:name="android.intent.action.MAIN" />
1615
<category android:name="android.intent.category.LAUNCHER" />
1716
</intent-filter>
1817
</activity>
1918

20-
<activity
21-
android:name=".MainActivity"
22-
android:exported="false"
23-
android:label="Turbo IMS" />
24-
2519
<provider
2620
android:name=".ShizukuProvider"
2721
android:authorities="${applicationId}.shizuku"

app/src/main/java/io/github/vvb2060/ims/ImsConfigHelper.kt

Lines changed: 0 additions & 151 deletions
This file was deleted.

app/src/main/java/io/github/vvb2060/ims/LocaleHelper.kt

Lines changed: 0 additions & 48 deletions
This file was deleted.

app/src/main/java/io/github/vvb2060/ims/MainActivity.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.github.vvb2060.ims
22

3-
import android.content.Context
43
import android.os.Bundle
54
import androidx.activity.ComponentActivity
65
import androidx.activity.compose.setContent
@@ -21,7 +20,6 @@ class MainActivity : ComponentActivity() {
2120
onFeatureSwitchChange = viewModel::onFeatureSwitchChange,
2221
onApplyConfiguration = { viewModel.onApplyConfiguration(this) },
2322
onSelectSim = viewModel::onSelectSim,
24-
onToggleLanguage = { viewModel.toggleLanguage(this) },
2523
openSimSelectionDialog = viewModel::openSimSelectionDialog,
2624
dismissSimSelectionDialog = viewModel::dismissSimSelectionDialog,
2725
dismissConfigAppliedDialog = viewModel::dismissConfigAppliedDialog,
@@ -35,10 +33,4 @@ class MainActivity : ComponentActivity() {
3533
super.onResume()
3634
viewModel.updateShizukuStatus()
3735
}
38-
39-
override fun attachBaseContext(newBase: Context) {
40-
val language = LocaleHelper.getLanguage(newBase)
41-
LocaleHelper.updateResources(newBase, language)
42-
super.attachBaseContext(newBase)
43-
}
4436
}

app/src/main/java/io/github/vvb2060/ims/MainScreen.kt

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import androidx.compose.material3.ButtonDefaults
1919
import androidx.compose.material3.Card
2020
import androidx.compose.material3.CardDefaults
2121
import androidx.compose.material3.Divider
22+
import androidx.compose.material3.HorizontalDivider
2223
import androidx.compose.material3.MaterialTheme
2324
import androidx.compose.material3.RadioButton
2425
import androidx.compose.material3.Switch
@@ -41,7 +42,6 @@ fun MainScreen(
4142
onFeatureSwitchChange: (Feature, Boolean) -> Unit,
4243
onApplyConfiguration: () -> Unit,
4344
onSelectSim: (SimSelection) -> Unit,
44-
onToggleLanguage: () -> Unit,
4545
openSimSelectionDialog: () -> Unit,
4646
dismissSimSelectionDialog: () -> Unit,
4747
dismissConfigAppliedDialog: () -> Unit,
@@ -54,7 +54,7 @@ fun MainScreen(
5454
.background(Color(0xFFF5F5F5))
5555
.verticalScroll(rememberScrollState())
5656
) {
57-
Header(onToggleLanguage)
57+
Header()
5858
SystemInfoCard(uiState, onRequestShizukuPermission)
5959
SimCardSelectionCard(uiState, openSimSelectionDialog)
6060
FeaturesCard(uiState, onFeatureSwitchChange)
@@ -76,14 +76,14 @@ fun MainScreen(
7676
}
7777

7878
@Composable
79-
fun Header(onToggleLanguage: () -> Unit) {
79+
fun Header() {
8080
Row(
8181
modifier = Modifier
8282
.fillMaxWidth()
8383
.background(Color(0xFF1A73E8))
8484
.padding(24.dp),
8585
verticalAlignment = Alignment.CenterVertically,
86-
horizontalArrangement = Arrangement.Space-Between
86+
horizontalArrangement = Arrangement.SpaceBetween
8787
) {
8888
Column(horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.weight(1f)) {
8989
Text("⚡ Turbo IMS", fontSize = 28.sp, fontWeight = FontWeight.Bold, color = Color.White)
@@ -94,9 +94,6 @@ fun Header(onToggleLanguage: () -> Unit) {
9494
fontFamily = FontFamily.Monospace
9595
)
9696
}
97-
TextButton(onClick = onToggleLanguage) {
98-
Text(stringResource(id = R.string.switch_language), color = Color.White, fontSize = 12.sp)
99-
}
10097
}
10198
}
10299

@@ -198,7 +195,6 @@ fun SimCardSelectionCard(uiState: MainUiState, openSimSelectionDialog: () -> Uni
198195

199196
@Composable
200197
fun FeaturesCard(uiState: MainUiState, onFeatureSwitchChange: (Feature, Boolean) -> Unit) {
201-
val context = LocalContext.current
202198
Card(
203199
modifier = Modifier.padding(16.dp),
204200
colors = CardDefaults.cardColors(containerColor = Color.White),
@@ -213,7 +209,7 @@ fun FeaturesCard(uiState: MainUiState, onFeatureSwitchChange: (Feature, Boolean)
213209
)
214210
Spacer(modifier = Modifier.height(16.dp))
215211

216-
Feature.values().forEachIndexed { index, feature ->
212+
Feature.entries.forEachIndexed { index, feature ->
217213
val featureName = when(feature) {
218214
Feature.VOLTE -> R.string.volte
219215
Feature.VOWIFI -> R.string.vowifi
@@ -238,8 +234,8 @@ fun FeaturesCard(uiState: MainUiState, onFeatureSwitchChange: (Feature, Boolean)
238234
checked = uiState.featureSwitches[feature] ?: true,
239235
onCheckedChange = { onFeatureSwitchChange(feature, it) }
240236
)
241-
if (index < Feature.values().size - 1) {
242-
Divider(color = Color.LightGray, thickness = 0.5.dp)
237+
if (index < Feature.entries.size - 1) {
238+
HorizontalDivider(thickness = 0.5.dp, color = Color.LightGray)
243239
}
244240
}
245241
}

0 commit comments

Comments
 (0)