Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
MainActivity: Only read prefs onCreate
Browse files Browse the repository at this point in the history
  • Loading branch information
YuKongA committed Dec 16, 2023
1 parent 4ce7c74 commit 20bebb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class LoginUtils {

if (description != "成功") {
withContext(Dispatchers.Main) {
Toast.makeText(context, auth["description"].toString(), Toast.LENGTH_SHORT).show()
Toast.makeText(context, description, Toast.LENGTH_SHORT).show()
}
return false
}
Expand Down
9 changes: 4 additions & 5 deletions app/src/main/java/top/yukonga/update/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ class MainActivity : AppCompatActivity() {

// Setup default device information.
mainContentBinding.apply {
codeName.editText!!.setText(prefs.getString("codeName", ""))
systemVersion.editText!!.setText(prefs.getString("systemVersion", ""))
androidVersion.editText!!.setText(prefs.getString("androidVersion", ""))

(codeName.editText as? MaterialAutoCompleteTextView)?.setSimpleItems(deviceCodeList)
(androidVersion.editText as? MaterialAutoCompleteTextView)?.setSimpleItems(dropDownList)
}
Expand All @@ -88,11 +92,6 @@ class MainActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()
mainContentBinding.apply {

codeName.editText!!.setText(prefs.getString("codeName", ""))
systemVersion.editText!!.setText(prefs.getString("systemVersion", ""))
androidVersion.editText!!.setText(prefs.getString("androidVersion", ""))

val cookiesFile = FileUtils.readFile(this@MainActivity, "cookies.json")
if (cookiesFile.isNotEmpty()) {
val cookies = Gson().fromJson(cookiesFile, Map::class.java)
Expand Down

0 comments on commit 20bebb5

Please sign in to comment.