Skip to content

Commit

Permalink
Fixed a bug in which parameters were included in text boxes when swit…
Browse files Browse the repository at this point in the history
…ching themes
  • Loading branch information
sakusaku3939 committed Aug 3, 2024
1 parent 7b97478 commit 8b7a5d7
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,14 @@ class MainActivity : AppCompatActivity() {
super.onSaveInstanceState(outState)
val webView: WebView = findViewById(R.id.webview)
val url = webView.url ?: ""
if (url.length > startUrl.length) {
val urlParam = url.substring(startUrl.length)
val inputText = Uri.decode(urlParam).replace("\\/", "/")

val urlParam = url.substringAfter("translator")
val originUrlParam = startUrl.substringAfter("translator")
val isTextChanged = urlParam != originUrlParam

if (isTextChanged) {
val urlText = urlParam.substring(originUrlParam.length)
val inputText = Uri.decode(urlText).replace("\\/", "/")
outState.putString("SavedText", inputText)
}

Expand Down

0 comments on commit 8b7a5d7

Please sign in to comment.