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

Commit

Permalink
MainActivity: Hide input method when focus is on androidVersionDropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
YuKongA committed Dec 18, 2023
1 parent 7fe7ae5 commit 6bca479
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/Android CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ jobs:
with:
name: Update-Release
path: "app/build/outputs/apk/release/*.apk"
compression-level: 9

- name: Upload Debug APK
uses: actions/upload-artifact@v4
with:
name: Updater-Debug
path: "app/build/outputs/apk/debug/*.apk"
path: "app/build/outputs/apk/debug/*.apk"
compression-level: 9
15 changes: 11 additions & 4 deletions app/src/main/java/top/yukonga/update/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import android.os.Bundle
import android.text.Html
import android.text.InputType
import android.text.method.LinkMovementMethod
import android.view.View.OnFocusChangeListener
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
import android.widget.LinearLayout
import android.widget.TextView
import androidx.activity.enableEdgeToEdge
Expand Down Expand Up @@ -124,6 +126,15 @@ class MainActivity : AppCompatActivity() {
super.onResume()

mainContentBinding.apply {

// Hide input method when focus is on androidVersionDropdown.
androidVersionDropdown.onFocusChangeListener = OnFocusChangeListener { view, hasFocus ->
if (hasFocus) {
val imm = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(view.windowToken, 0)
}
}

activityMainBinding.implement.setOnClickListener {

val firstViewTitleArray = arrayOf(
Expand Down Expand Up @@ -322,10 +333,6 @@ class MainActivity : AppCompatActivity() {
}

private fun showLogOutDialog() {
val view = LinearLayout(this@MainActivity).apply {
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)
orientation = LinearLayout.VERTICAL
}
val builder = MaterialAlertDialogBuilder(this@MainActivity)
builder.setTitle(getString(R.string.login)).setTitle(getString(R.string.logout)).setMessage(getString(R.string.logout_desc))
.setNegativeButton(getString(R.string.cancel)) { dialog, _ -> dialog.dismiss() }
Expand Down

0 comments on commit 6bca479

Please sign in to comment.