mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
fix(upload): hide keyboard before navigating to Media License screen
This solves keyboard opened at the License screen issue, if we proceed by pressing next at the Upload Categories screen when the keyboard is opened
This commit is contained in:
parent
c91475df94
commit
2f0924678c
1 changed files with 14 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ import android.os.Build.VERSION_CODES
|
|||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.CheckBox
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
|
|
@ -805,6 +806,19 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C
|
|||
|
||||
override fun onNextButtonClicked(index: Int) {
|
||||
if (index < fragments!!.size - 1) {
|
||||
// Hide the keyboard before navigating to Media License screen
|
||||
val isUploadCategoriesFragment = fragments!!.getOrNull(index)?.let {
|
||||
it is UploadCategoriesFragment
|
||||
} ?: false
|
||||
if (isUploadCategoriesFragment) {
|
||||
val inputMethodManager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
currentFocus?.let { focusedView ->
|
||||
inputMethodManager.hideSoftInputFromWindow(
|
||||
focusedView.windowToken,
|
||||
InputMethodManager.HIDE_NOT_ALWAYS
|
||||
)
|
||||
}
|
||||
}
|
||||
binding.vpUpload.setCurrentItem(index + 1, false)
|
||||
fragments!![index + 1].onBecameVisible()
|
||||
(binding.rvThumbnails.layoutManager as LinearLayoutManager)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue