From 6ffa7d8108ecc122ae3bd67c622cb94460223e00 Mon Sep 17 00:00:00 2001 From: LZX <1820455493@qq.com> Date: Tue, 20 Oct 2026 20:36:55 +0800 Subject: [PATCH] fix: localize disabled mock toast and bump version to 1.2.1 --- app/build.gradle.kts | 4 +- .../openloc/core/util/UpdateChecker.kt | 2 +- .../lzxnone/openloc/ui/screens/MainScreen.kt | 6 +- .../openloc/ui/screens/home/HomeScreen.kt | 2 +- .../ui/screens/location/LocationScreen.kt | 6 +- app/src/main/res/values-en/strings.xml | 185 ++++++++++++++++++ app/src/main/res/values-zh-rCN/strings.xml | 2 +- app/src/main/res/values-zh/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 9 files changed, 199 insertions(+), 12 deletions(-) create mode 100644 app/src/main/res/values-en/strings.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7777550..2dc5b8a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -18,8 +18,8 @@ android { applicationId = "com.lzxnone.openloc" minSdk = 28 targetSdk = 36 - versionCode = 3 - versionName = "1.2.0" + versionCode = 4 + versionName = "1.2.1" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/lzxnone/openloc/core/util/UpdateChecker.kt b/app/src/main/java/com/lzxnone/openloc/core/util/UpdateChecker.kt index efb894c..b2308e1 100644 --- a/app/src/main/java/com/lzxnone/openloc/core/util/UpdateChecker.kt +++ b/app/src/main/java/com/lzxnone/openloc/core/util/UpdateChecker.kt @@ -27,7 +27,7 @@ object UpdateChecker { /** * 检查 GitHub 是否有新版本 */ - suspend fun checkUpdate(currentVersion: String = "v1.2.0"): Result = withContext(Dispatchers.IO) { + suspend fun checkUpdate(currentVersion: String = "v1.2.1"): Result = withContext(Dispatchers.IO) { try { val url = URL(GITHUB_API_URL) val conn = (url.openConnection() as HttpURLConnection).apply { diff --git a/app/src/main/java/com/lzxnone/openloc/ui/screens/MainScreen.kt b/app/src/main/java/com/lzxnone/openloc/ui/screens/MainScreen.kt index def340e..7ad9a04 100644 --- a/app/src/main/java/com/lzxnone/openloc/ui/screens/MainScreen.kt +++ b/app/src/main/java/com/lzxnone/openloc/ui/screens/MainScreen.kt @@ -96,7 +96,7 @@ fun MainScreen( // 每次进入软件,若开启了自动检查更新,则在后台静默检测,发现新版才弹窗 LaunchedEffect(Unit) { if (AppPreferences.isAutoCheckUpdateEnabled) { - val result = UpdateChecker.checkUpdate(currentVersion = "v1.2.0") + val result = UpdateChecker.checkUpdate(currentVersion = "v1.2.1") result.getOrNull()?.let { info -> if (info.hasUpdate) { updateInfoToDisplay = info @@ -107,12 +107,12 @@ fun MainScreen( val checkingUpdateText = stringResource(id = R.string.home_checking_update) val checkFailedText = stringResource(id = R.string.home_check_update_failed) - val alreadyLatestText = stringResource(id = R.string.home_already_latest, "v1.2.0") + val alreadyLatestText = stringResource(id = R.string.home_already_latest, "v1.2.1") val performManualCheck: () -> Unit = { Toast.makeText(context, checkingUpdateText, Toast.LENGTH_SHORT).show() coroutineScope.launch { - val result = UpdateChecker.checkUpdate(currentVersion = "v1.2.0") + val result = UpdateChecker.checkUpdate(currentVersion = "v1.2.1") result.onSuccess { info -> if (info.hasUpdate) { updateInfoToDisplay = info diff --git a/app/src/main/java/com/lzxnone/openloc/ui/screens/home/HomeScreen.kt b/app/src/main/java/com/lzxnone/openloc/ui/screens/home/HomeScreen.kt index 009355a..eea3771 100644 --- a/app/src/main/java/com/lzxnone/openloc/ui/screens/home/HomeScreen.kt +++ b/app/src/main/java/com/lzxnone/openloc/ui/screens/home/HomeScreen.kt @@ -58,7 +58,7 @@ fun HomeScreen( // 4. 版本与更新模块卡片 VersionCard( - versionName = "v1.2.0", + versionName = "v1.2.1", isAutoCheckEnabled = AppPreferences.isAutoCheckUpdateEnabled, onAutoCheckChange = { AppPreferences.updateAutoCheckUpdateEnabled(it) }, onCheckUpdate = onCheckUpdate diff --git a/app/src/main/java/com/lzxnone/openloc/ui/screens/location/LocationScreen.kt b/app/src/main/java/com/lzxnone/openloc/ui/screens/location/LocationScreen.kt index fb00ed9..c6a95f8 100644 --- a/app/src/main/java/com/lzxnone/openloc/ui/screens/location/LocationScreen.kt +++ b/app/src/main/java/com/lzxnone/openloc/ui/screens/location/LocationScreen.kt @@ -11,6 +11,7 @@ import android.location.LocationManager import android.os.Bundle import android.os.Looper import android.widget.Toast +import com.lzxnone.openloc.createLocalizedContext import com.lzxnone.openloc.core.util.TraceLogger import androidx.activity.compose.BackHandler import androidx.activity.compose.rememberLauncherForActivityResult @@ -577,9 +578,10 @@ fun LocationScreen( val tapOverlay = MapEventsOverlay(object : MapEventsReceiver { override fun singleTapConfirmedHelper(p: GeoPoint): Boolean { if (!AppPreferences.isServiceEnabled) { + val localizedContext = createLocalizedContext(context, AppPreferences.appLanguage) Toast.makeText( - context, - context.getString(R.string.location_mock_disabled_prompt), + localizedContext, + localizedContext.getString(R.string.location_mock_disabled_prompt), Toast.LENGTH_SHORT ).show() return true diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml new file mode 100644 index 0000000..3cf2f4d --- /dev/null +++ b/app/src/main/res/values-en/strings.xml @@ -0,0 +1,185 @@ + + OpenLoc + OpenLoc virtual location hook module + + + Home + Location + Settings + + + Module Status + Activated + Inactive + + + Master Switch + Virtual location is running + Virtual location is paused + Module inactive, switch is disabled + + + Language + Appearance + + + App Language + Select Language + Follow System + 简体中文 (Chinese) + English + + + Theme Mode + Select Theme Mode + Follow System + Light Mode + Dark Mode + + System Theme Color + Follow system wallpaper dynamic colors (Android 12+) + + Theme Color + Choose Palette + + Cancel + Confirm + + + Search location / address… + Selected Location + Lat: %1$.6f + Lng: %1$.6f + Copy Coordinates + Coordinates copied to clipboard + Reset to current location + Located to current position + Virtual location is not enabled, please enable it first + Back + Clear + Recent Searches + Clear History + No matching places found + Enter place name or coordinates to search + Jump to coordinates + + + Map & Search Service + Search Engine Provider + Select Search Provider + AMap + Baidu + Photon + Nominatim + Key Required + Free / No Key + + API Key + Not Required + Enter Key / AK + Key cannot be empty + Unknown error + Lng: %1$.6f, Lat: %2$.6f + Test + Testing... + Test passed! Key is valid. + Test failed: %1$s + + Configure AMap Key + Get Web Service Key from lbs.amap.com + Configure Baidu AK + Get Server AK from lbsyun.baidu.com + Configured + Not Configured + Clear + Save + + %1$s Key Not Configured + This engine requires an API Key. You can configure it or switch to a free engine. + Configure Key + Switch Provider + Invalid %1$s Key + Key verification failed (%1$s). Please check platform type or re-enter. + Edit Key + Network request failed, please check connection + Collapse + Expand + + + Favorites + Add Favorite Location + Name + e.g. Home / Company + Area / Address + Deriving area name… + Latitude (WGS-84) + Longitude (WGS-84) + Search name or area… + No favorites yet. Tap + to add. + No matching favorites found + Delete Favorite + Are you sure you want to delete \"%1$s\"? + Added to favorites + Favorite deleted + Moved to: %1$s + Please enter valid latitude (-90~90) and longitude (-180~180) + Name cannot be empty + Delete + Drag to reorder + Unknown address + + + App Scope Management + Configure target apps and mock rules + Mock Mode + Global + Blacklist + Whitelist + All applications on this device will receive mocked location. + Apps in the blacklist keep real location, while all other apps receive mocked location. + Only apps in the whitelist receive mocked location, while other apps keep real location. + Blacklist Apps + Whitelist Apps + %1$d apps excluded + %1$d apps enabled + Search app name or package… + Select All + Deselect All + Show system apps + Hide system apps + System + Loading installed applications… + No matching applications found + No applications found + %1$d / %2$d selected + + + Anti-Detection & Realism + Natural Location Drift + Simulate smooth Brownian motion / Gaussian GNSS noise to prevent static location detection + Full Constellation GNSS Simulation + Simulate realistic multi-constellation satellites (GPS, BeiDou, GLONASS, Galileo) with physical C/N0 noise and NMEA GSV/GSA sentences + Cell Tower & Wi-Fi Camouflage + Camouflage cell tower and Wi-Fi BSSID to prevent cloud reverse geolocation lookup + Handheld Motion Sensor Simulation + Inject subtle physiological micro-tremor into accelerometer readings to mimic active human hand-holding + Module Package Stealth + Hide OpenLoc package from target apps to prevent package scanning detection + Mock Flag Sanitization + Sanitize isMock and mIsFromMockProvider flags in Location objects + + + + Current Version + v1.2.1 + Check for Updates + Auto Check on Launch + Automatically check for new releases when opening the app + Checking for updates… + New Version Available: %1$s + A new version of OpenLoc has been released on GitHub. + Go to Update + Later + Failed to check for updates, please check network + Already the latest version (%1$s) + \ No newline at end of file diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index e01c6a2..f9004d0 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -171,7 +171,7 @@ 当前版本 - v1.2.0 + v1.2.1 检查更新 启动时自动检查更新 每次进入软件自动联网检测 GitHub 最新版本 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index e01c6a2..f9004d0 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -171,7 +171,7 @@ 当前版本 - v1.2.0 + v1.2.1 检查更新 启动时自动检查更新 每次进入软件自动联网检测 GitHub 最新版本 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4980990..3cf2f4d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -171,7 +171,7 @@ Current Version - v1.2.0 + v1.2.1 Check for Updates Auto Check on Launch Automatically check for new releases when opening the app